ejb servlet demo
官方文档:
http://docs.oracle.com/javaee/6/tutorial/doc/gijre.html
package converter.ejb; import java.math.BigDecimal; import javax.ejb.Stateless; @Stateless
public class ConverterBean {
private BigDecimal yenRate = new BigDecimal("83.0602");
private BigDecimal euroRate = new BigDecimal("0.0093016"); public BigDecimal dollarToYen(BigDecimal dollars) {
BigDecimal result = dollars.multiply(yenRate);
return result.setScale(2, BigDecimal.ROUND_UP);
} public BigDecimal yenToEuro(BigDecimal yen) {
BigDecimal result = yen.multiply(euroRate);
return result.setScale(2, BigDecimal.ROUND_UP);
}
}
package converter.web; import java.io.IOException;
import java.io.PrintWriter;
import java.math.BigDecimal; import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import converter.ejb.ConverterBean; @WebServlet
public class ConverterServlet extends HttpServlet { private static final long serialVersionUID = 1L; @EJB
ConverterBean converterBean; @Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String amount = request.getParameter("amount");
if (amount != null && amount.length() > 0) {
// convert the amount to a BigDecimal from the request parameter
BigDecimal d = new BigDecimal(amount);
// call the ConverterBean.dollarToYen() method to get the amount
// in Yen
BigDecimal yenAmount = converterBean.dollarToYen(d); // call the ConverterBean.yenToEuro() method to get the amount
// in Euros
BigDecimal euroAmount = converterBean.yenToEuro(yenAmount); response.setCharacterEncoding("utf-8");
PrintWriter writer = response.getWriter();
writer.write("yenAmount:" + String.valueOf(yenAmount) + "\n");
writer.write("euroAmount:" + String.valueOf(euroAmount) + "\n");
writer.flush();
writer.close();
}
} }
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<servlet>
<servlet-name>ConverterServlet</servlet-name>
<servlet-class>converter.web.ConverterServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>ConverterServlet</servlet-name>
<url-pattern>/ConverterServlet</url-pattern>
</servlet-mapping>
</web-app>
<html>
<body>
<h2>Hello World!</h2>
</body>
</html>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>converter.ejb</groupId>
<artifactId>converter</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>converter Maven Webapp</name>
<url>http://maven.apache.org</url> <dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0-6</version>
</dependency>
</dependencies> <build>
<finalName>converter</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
启动log:
Aug 25, 2016 4:54:21 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:converter' did not find a matching property.
Aug 25, 2016 4:54:21 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat (TomEE)/7.0.68 (1.7.4)
Aug 25, 2016 4:54:21 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Feb 8 2016 20:25:54 UTC
Aug 25, 2016 4:54:21 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 7.0.68.0
Aug 25, 2016 4:54:21 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 7
Aug 25, 2016 4:54:21 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 6.1
Aug 25, 2016 4:54:21 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
Aug 25, 2016 4:54:21 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: F:\e\java\jdk1.7.0_79\jre
Aug 25, 2016 4:54:21 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.7.0_79-b15
Aug 25, 2016 4:54:21 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Aug 25, 2016 4:54:21 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: F:\e\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Aug 25, 2016 4:54:21 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: F:\e\apache-tomee-webprofile-1.7.4
Aug 25, 2016 4:54:21 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:27025
Aug 25, 2016 4:54:21 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=F:\e\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Aug 25, 2016 4:54:21 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=F:\e\apache-tomee-webprofile-1.7.4
Aug 25, 2016 4:54:21 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=F:\e\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
Aug 25, 2016 4:54:21 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=F:\e\apache-tomee-webprofile-1.7.4\endorsed
Aug 25, 2016 4:54:21 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
Aug 25, 2016 4:54:21 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: F:\e\java\jdk1.7.0_79\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;F:\e\java\jdk1.7.0_79\jre\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;F:\e\java\jdk1.7.0_79\bin;C:\Program Files\TortoiseSVN\bin;E:\apache-ant-1.9.6\bin;C:\Program Files (x86)\HP\LoadRunner\strawberry-perl\perl\bin;E:\Program Files;.
Aug 25, 2016 4:54:21 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Aug 25, 2016 4:54:21 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Aug 25, 2016 4:54:22 PM org.apache.openejb.util.OptionsLog info
INFO: Using 'openejb.jdbc.datasource-creator=org.apache.tomee.jdbc.TomEEDataSourceCreator'
Aug 25, 2016 4:54:22 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: ********************************************************************************
Aug 25, 2016 4:54:22 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: OpenEJB http://tomee.apache.org/
Aug 25, 2016 4:54:22 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: Startup: Thu Aug 25 16:54:22 CST 2016
Aug 25, 2016 4:54:22 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: Copyright 1999-2015 (C) Apache OpenEJB/TomEE Project, All Rights Reserved.
Aug 25, 2016 4:54:22 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: Version: 4.7.4
Aug 25, 2016 4:54:22 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: Build date: 20160304
Aug 25, 2016 4:54:22 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: Build time: 09:05
Aug 25, 2016 4:54:22 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: ********************************************************************************
Aug 25, 2016 4:54:22 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: openejb.home = F:\e\apache-tomee-webprofile-1.7.4
Aug 25, 2016 4:54:22 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: openejb.base = F:\e\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Aug 25, 2016 4:54:22 PM org.apache.openejb.cdi.CdiBuilder initializeOWB
INFO: Created new singletonService org.apache.openejb.cdi.ThreadSingletonServiceImpl@20ec6f2f
Aug 25, 2016 4:54:22 PM org.apache.openejb.cdi.CdiBuilder initializeOWB
INFO: Succeeded in installing singleton service
Aug 25, 2016 4:54:22 PM org.apache.openejb.config.ConfigurationFactory init
INFO: openejb configuration file is 'F:\e\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\openejb.xml'
Aug 25, 2016 4:54:22 PM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=Tomcat Security Service, type=SecurityService, provider-id=Tomcat Security Service)
Aug 25, 2016 4:54:22 PM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)
Aug 25, 2016 4:54:22 PM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=My DataSource, type=Resource, provider-id=Default JDBC Database)
Aug 25, 2016 4:54:22 PM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=My Unmanaged DataSource, type=Resource, provider-id=Default JDBC Database)
Aug 25, 2016 4:54:22 PM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=My Singleton Container, type=Container, provider-id=Default Singleton Container)
Aug 25, 2016 4:54:22 PM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=My Stateful Container, type=Container, provider-id=Default Stateful Container)
Aug 25, 2016 4:54:22 PM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=My Stateless Container, type=Container, provider-id=Default Stateless Container)
Aug 25, 2016 4:54:22 PM org.apache.openejb.config.DeploymentsResolver loadFrom
WARNING: File error: <Deployments dir="apps/"> - Does not exist: F:\e\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\apps
Aug 25, 2016 4:54:22 PM org.apache.openejb.util.OptionsLog info
INFO: Using 'openejb.system.apps=true'
Aug 25, 2016 4:54:22 PM org.apache.openejb.config.ConfigurationFactory configureApplication
INFO: Configuring enterprise application: openejb
Aug 25, 2016 4:54:22 PM org.apache.openejb.config.InitEjbDeployments deploy
INFO: Using openejb.deploymentId.format '{ejbName}'
Aug 25, 2016 4:54:22 PM org.apache.openejb.config.InitEjbDeployments deploy
INFO: Auto-deploying ejb openejb/Deployer: EjbDeployment(deployment-id=openejb/Deployer)
Aug 25, 2016 4:54:22 PM org.apache.openejb.config.InitEjbDeployments deploy
INFO: Auto-deploying ejb openejb/ConfigurationInfo: EjbDeployment(deployment-id=openejb/ConfigurationInfo)
Aug 25, 2016 4:54:22 PM org.apache.openejb.config.InitEjbDeployments deploy
INFO: Auto-deploying ejb MEJB: EjbDeployment(deployment-id=MEJB)
Aug 25, 2016 4:54:23 PM org.apache.openejb.config.AppInfoBuilder build
INFO: Enterprise application "openejb" loaded.
Aug 25, 2016 4:54:23 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating TransactionManager(id=Default Transaction Manager)
Aug 25, 2016 4:54:23 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating SecurityService(id=Tomcat Security Service)
Aug 25, 2016 4:54:23 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating Resource(id=My DataSource)
Aug 25, 2016 4:54:23 PM org.apache.tomee.jdbc.TomEEDataSourceCreator$TomEEDataSource readOnly
INFO: Disabling testOnBorrow since no validation query is provided
Aug 25, 2016 4:54:23 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating Resource(id=My Unmanaged DataSource)
Aug 25, 2016 4:54:23 PM org.apache.tomee.jdbc.TomEEDataSourceCreator$TomEEDataSource readOnly
INFO: Disabling testOnBorrow since no validation query is provided
Aug 25, 2016 4:54:23 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating Container(id=My Singleton Container)
Aug 25, 2016 4:54:23 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating Container(id=My Stateful Container)
Aug 25, 2016 4:54:23 PM org.apache.openejb.core.stateful.SimplePassivater init
INFO: Using directory C:\Users\wl\AppData\Local\Temp for stateful session passivation
Aug 25, 2016 4:54:23 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating Container(id=My Stateless Container)
Aug 25, 2016 4:54:23 PM org.apache.openejb.assembler.classic.Assembler createAppClassLoader
INFO: Not creating another application classloader for openejb
Aug 25, 2016 4:54:23 PM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Assembling app: openejb
Aug 25, 2016 4:54:23 PM org.apache.openejb.util.OptionsLog info
INFO: Using 'openejb.jndiname.format={deploymentId}{interfaceType.openejbLegacyName}'
Aug 25, 2016 4:54:23 PM org.apache.openejb.assembler.classic.JndiBuilder bind
INFO: Jndi(name=openejb/DeployerBusinessRemote) --> Ejb(deployment-id=openejb/Deployer)
Aug 25, 2016 4:54:23 PM org.apache.openejb.assembler.classic.JndiBuilder bind
INFO: Jndi(name=global/openejb/openejb/Deployer!org.apache.openejb.assembler.Deployer) --> Ejb(deployment-id=openejb/Deployer)
Aug 25, 2016 4:54:23 PM org.apache.openejb.assembler.classic.JndiBuilder bind
INFO: Jndi(name=global/openejb/openejb/Deployer) --> Ejb(deployment-id=openejb/Deployer)
Aug 25, 2016 4:54:23 PM org.apache.openejb.assembler.classic.JndiBuilder bind
INFO: Jndi(name=openejb/ConfigurationInfoBusinessRemote) --> Ejb(deployment-id=openejb/ConfigurationInfo)
Aug 25, 2016 4:54:23 PM org.apache.openejb.assembler.classic.JndiBuilder bind
INFO: Jndi(name=global/openejb/openejb/ConfigurationInfo!org.apache.openejb.assembler.classic.cmd.ConfigurationInfo) --> Ejb(deployment-id=openejb/ConfigurationInfo)
Aug 25, 2016 4:54:23 PM org.apache.openejb.assembler.classic.JndiBuilder bind
INFO: Jndi(name=global/openejb/openejb/ConfigurationInfo) --> Ejb(deployment-id=openejb/ConfigurationInfo)
Aug 25, 2016 4:54:23 PM org.apache.openejb.assembler.classic.JndiBuilder bind
INFO: Jndi(name=MEJB) --> Ejb(deployment-id=MEJB)
Aug 25, 2016 4:54:23 PM org.apache.openejb.assembler.classic.JndiBuilder bind
INFO: Jndi(name=global/openejb/MEJB!javax.management.j2ee.ManagementHome) --> Ejb(deployment-id=MEJB)
Aug 25, 2016 4:54:23 PM org.apache.openejb.assembler.classic.JndiBuilder bind
INFO: Jndi(name=global/openejb/MEJB) --> Ejb(deployment-id=MEJB)
Aug 25, 2016 4:54:23 PM org.apache.openejb.assembler.classic.Assembler startEjbs
INFO: Created Ejb(deployment-id=openejb/Deployer, ejb-name=openejb/Deployer, container=My Stateless Container)
Aug 25, 2016 4:54:23 PM org.apache.openejb.assembler.classic.Assembler startEjbs
INFO: Created Ejb(deployment-id=MEJB, ejb-name=MEJB, container=My Stateless Container)
Aug 25, 2016 4:54:23 PM org.apache.openejb.assembler.classic.Assembler startEjbs
INFO: Created Ejb(deployment-id=openejb/ConfigurationInfo, ejb-name=openejb/ConfigurationInfo, container=My Stateless Container)
Aug 25, 2016 4:54:23 PM org.apache.openejb.assembler.classic.Assembler startEjbs
INFO: Started Ejb(deployment-id=openejb/Deployer, ejb-name=openejb/Deployer, container=My Stateless Container)
Aug 25, 2016 4:54:23 PM org.apache.openejb.assembler.classic.Assembler startEjbs
INFO: Started Ejb(deployment-id=MEJB, ejb-name=MEJB, container=My Stateless Container)
Aug 25, 2016 4:54:23 PM org.apache.openejb.assembler.classic.Assembler startEjbs
INFO: Started Ejb(deployment-id=openejb/ConfigurationInfo, ejb-name=openejb/ConfigurationInfo, container=My Stateless Container)
Aug 25, 2016 4:54:23 PM org.apache.openejb.assembler.classic.Assembler deployMBean
INFO: Deployed MBean(openejb.user.mbeans:application=openejb,group=org.apache.openejb.assembler.monitoring,name=JMXDeployer)
Aug 25, 2016 4:54:23 PM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Deployed Application(path=openejb)
Aug 25, 2016 4:54:23 PM org.apache.openejb.server.SimpleServiceManager start
INFO: ** Bound Services **
Aug 25, 2016 4:54:23 PM org.apache.openejb.server.SimpleServiceManager printRow
INFO: NAME IP PORT
Aug 25, 2016 4:54:23 PM org.apache.openejb.server.SimpleServiceManager start
INFO: -------
Aug 25, 2016 4:54:23 PM org.apache.openejb.server.SimpleServiceManager start
INFO: Ready!
Aug 25, 2016 4:54:23 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 3185 ms
Aug 25, 2016 4:54:23 PM org.apache.tomee.catalina.OpenEJBNamingContextListener bindResource
INFO: Importing a Tomcat Resource with id 'UserDatabase' of type 'org.apache.catalina.UserDatabase'.
Aug 25, 2016 4:54:23 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating Resource(id=UserDatabase)
Aug 25, 2016 4:54:23 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Aug 25, 2016 4:54:23 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat (TomEE)/7.0.68 (1.7.4)
Aug 25, 2016 4:54:23 PM org.apache.tomee.catalina.TomcatWebAppBuilder init
INFO: ------------------------- localhost -> /
Aug 25, 2016 4:54:23 PM org.apache.openejb.config.ConfigurationFactory configureApplication
INFO: Configuring enterprise application: F:\e\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ROOT
Aug 25, 2016 4:54:24 PM org.apache.openejb.config.AppInfoBuilder build
INFO: Enterprise application "F:\e\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ROOT" loaded.
Aug 25, 2016 4:54:24 PM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Assembling app: F:\e\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ROOT
Aug 25, 2016 4:54:24 PM org.apache.openejb.cdi.CdiBuilder initSingleton
INFO: Existing thread singleton service in SystemInstance(): org.apache.openejb.cdi.ThreadSingletonServiceImpl@20ec6f2f
Aug 25, 2016 4:54:24 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container is starting...
Aug 25, 2016 4:54:24 PM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [CdiPlugin]
Aug 25, 2016 4:54:24 PM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin]
Aug 25, 2016 4:54:24 PM org.apache.webbeans.config.BeansDeployer validateInjectionPoints
INFO: All injection points were validated successfully.
Aug 25, 2016 4:54:24 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container has started, it took 110 ms.
Aug 25, 2016 4:54:24 PM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Deployed Application(path=F:\e\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ROOT)
Aug 25, 2016 4:54:24 PM org.apache.tomee.catalina.TomcatWebAppBuilder init
INFO: ------------------------- localhost -> /converter
Aug 25, 2016 4:54:24 PM org.apache.catalina.loader.WebappClassLoaderBase validateJarFile
INFO: validateJarFile(F:\e\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\converter\WEB-INF\lib\javaee-api-6.0-6.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
Aug 25, 2016 4:54:24 PM org.apache.openejb.config.ConfigurationFactory configureApplication
INFO: Configuring enterprise application: F:\e\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\converter
Aug 25, 2016 4:54:24 PM org.apache.openejb.config.InitEjbDeployments deploy
INFO: Auto-deploying ejb ConverterBean: EjbDeployment(deployment-id=ConverterBean)
Aug 25, 2016 4:54:24 PM org.apache.openejb.config.AppInfoBuilder build
INFO: Enterprise application "F:\e\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\converter" loaded.
Aug 25, 2016 4:54:24 PM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Assembling app: F:\e\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\converter
Aug 25, 2016 4:54:24 PM org.apache.openejb.assembler.classic.JndiBuilder bind
INFO: Jndi(name=ConverterBeanLocalBean) --> Ejb(deployment-id=ConverterBean)
Aug 25, 2016 4:54:24 PM org.apache.openejb.assembler.classic.JndiBuilder bind
INFO: Jndi(name=global/converter/ConverterBean!converter.ejb.ConverterBean) --> Ejb(deployment-id=ConverterBean)
Aug 25, 2016 4:54:24 PM org.apache.openejb.assembler.classic.JndiBuilder bind
INFO: Jndi(name=global/converter/ConverterBean) --> Ejb(deployment-id=ConverterBean)
Aug 25, 2016 4:54:24 PM org.apache.openejb.cdi.CdiBuilder initSingleton
INFO: Existing thread singleton service in SystemInstance(): org.apache.openejb.cdi.ThreadSingletonServiceImpl@20ec6f2f
Aug 25, 2016 4:54:24 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container is starting...
Aug 25, 2016 4:54:24 PM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [CdiPlugin]
Aug 25, 2016 4:54:24 PM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin]
Aug 25, 2016 4:54:24 PM org.apache.webbeans.config.BeansDeployer validateInjectionPoints
INFO: All injection points were validated successfully.
Aug 25, 2016 4:54:24 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container has started, it took 12 ms.
Aug 25, 2016 4:54:24 PM org.apache.openejb.assembler.classic.Assembler startEjbs
INFO: Created Ejb(deployment-id=ConverterBean, ejb-name=ConverterBean, container=My Stateless Container)
Aug 25, 2016 4:54:24 PM org.apache.openejb.assembler.classic.Assembler startEjbs
INFO: Started Ejb(deployment-id=ConverterBean, ejb-name=ConverterBean, container=My Stateless Container)
Aug 25, 2016 4:54:24 PM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Deployed Application(path=F:\e\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\converter)
Aug 25, 2016 4:54:24 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Aug 25, 2016 4:54:24 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Aug 25, 2016 4:54:24 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1222 ms
访问:
http://localhost:8080/converter/ConverterServlet?amount=100
结果:
yenAmount:8306.02
euroAmount:77.26
ps:
访问http://localhost:8080/converter/
会进入欢迎页
需要制定具体的servlet或者在index.jsp中做重定向
ejb servlet demo的更多相关文章
- Web---JSP注册技术的的演绎(3代)-JSP/EJB/Servlet/POJO/JavaBean
我们可以这么理解JSP注册技术的发展过程: 第一代JSP技术:纯JSP开发. 第二代JSP技术:JSP+EJB开发. (EJB简单来说就是把已经编写好的程序(即:类)打包放在服务器上执行.) 第三代J ...
- Java下载Servlet Demo
request.setCharacterEncoding("utf-8"); String name=request.getParameter("name"); ...
- Jquery+ajax+json+servlet原理和Demo
Jquery+ajax+json+servlet原理和Demo 大致过程: 用户时间点击,触发js,设置$.ajax,开始请求.服务器响应,获取ajax传递的值,然后处理.以JSON格式返回给ajax ...
- SpringMVC-Spring-Hibernate项目搭建之一-- 搭建maven 项目 & servlet的demo
一. 搭建maven项目 1. 新建maven项目,选择maven Project --> Next 2. 勾选 Create a simple project --> Next 3. ...
- Servlet 3.0
Servlet 3.0 作为 Java EE 6 规范体系中一员,随着 Java EE 6 规范一起发布.该版本在前一版本(Servlet 2.5)的基础上提供了若干新特性用于简化 Web 应用的开发 ...
- JAVAWEB学习总结 SERVLET开发(二)
一.ServletConfig对象 1.1.配置servlet初始化参数 在servlet的配置文件中web.xml中,可以使用一个或多个<init-param>标签为servlet配置一 ...
- javaweb学习总结 servlet开发(一)
转载:http://www.cnblogs.com/xdp-gacl/p/3760336.html 这里主要是将其加入自己的理解过一遍. 这里的代码全在eclipse java ee中执行的. 一.s ...
- Servlet 3.0 新特性
Servlet 3.0 作为 Java EE 6 规范体系中一员,随着 Java EE 6 规范一起发布.该版本在前一版本(Servlet 2.5)的基础上提供了若干新特性用于简化 Web 应用的开发 ...
- 利用servlet技术实现验证码功能
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" ...
随机推荐
- 34-BigInteger详解
在用C或者C++处理大数时感觉非常麻烦,但是在Java中有两个类BigInteger和BigDecimal分别表示大整数类和大浮点数类,至于两个类的对象能表示最大范围不清楚,理论上能够表示无线大的数, ...
- vue.js路由vue-router
学习网址:https://segmentfault.com/blog/vueroad 转载至:https://segmentfault.com/a/1190000009350679#articleHe ...
- js iterable类型
遍历Array可以采用下标循环,遍历Map和Set就无法使用下标.为了统一集合类型,ES6标准引入了新的iterable类型,Array.Map和Set都属于iterable类型. 具有iterabl ...
- C# json解析字符串总是多出双引号
json好久没用了,今天在用到json的时候,发现对字符串做解析的时候总是多出双引号. 代码如下: string jsonText = "{'name':'test','phone':'18 ...
- OpenGL3D图形、旋转、纹理、键盘移动、光照、滤波、透明(完整) 转自http://www.cnblogs.com/tiandsp/archive/2012/01/23/2329049.html
#include <windows.h> // Windows的头文件 #include <stdio.h> #include <gl\gl.h> // OpenG ...
- 单细胞RNA测序技术之入门指南
单细胞RNA测序技术之入门指南 [字体: 大 中 小 ] 时间:2018年09月12日 来源:生物通 编辑推荐: 在这个飞速发展的测序时代,DNA和RNA测序已经逐渐成为“实验室中的家常菜”.若要 ...
- 转:百度MySql5.7安装配置
原文地址:http://jingyan.baidu.com/article/8cdccae946133f315513cd6a.html MySQL 5.7以上版本的配置和以前有所不同,在这里与大家分享 ...
- BZOJ2730 [HNOI2012]矿场搭建 - Tarjan割点
Solution 输入中没有出现过的矿场点是不用考虑的, 所以不用考虑只有 一个点 的点双联通分量. 要使某个挖矿点倒塌, 相当于割去这个点, 所以我们求一遍割点和点双联通分量. 之后的点双联通分量构 ...
- Python之路(第十一篇)装饰器
一.什么是装饰器? 装饰器他人的器具,本身可以是任意可调用对象,被装饰者也可以是任意可调用对象. 强调装饰器的原则:1 不修改被装饰对象的源代码 2 不修改被装饰对象的调用方式 装饰器的目标:在遵循1 ...
- js对象通过属性路径获取属性值 - getPropByPath
function getPropByPath(obj, path) { let tempObj = obj; path = path.replace(/\[(\w+)\]/g, '.$1'); pat ...