Please try the latest 3.0 trunk. 3.0-M1 might not support that new feature.
Forrest On Thu, Apr 21, 2011 at 8:24 AM, joquetaire <joqueta...@chlewik.pl> wrote: > hi all, > > i've tried to run the tutorial on accessing EJB inWeb application but got > the error while deploying the Web part > > the tutorial is located: > https://cwiki.apache.org/GMOxDOC30/accessing-ejb-in-web-applications.html > (Home > Apache Geronimo v3.0 > Documentation > Developing > Tutorials > > Developing Web applications > Accessing EJB in Web applications) > > server seems to work fine - SDK, Eclipse, GEP, Geronimo > > server: Debian > version: 2.22.3 > > $ java -version > java version "1.6.0_24" > Java(TM) SE Runtime Environment (build 1.6.0_24-b07) > Java HotSpot(TM) Server VM (build 19.1-b02, mixed mode) > > geronimo-jetty8-javaee6-3.0-M1 > > eclipse-jee-helios-SR2-linux-gtk > > Eclipse Java EE IDE for Web Developers. > Version: Helios Service Release 2 > Build id: 20110218-0911 > > Apache Geronimo v3.0 Server Adapter > Version: 3.0.0-20100706214934 > > > all files in 2 projects of the tutorial are presented below (tried to > follow > the tutorial 'a la lettre') > > --> Converter.java > > package ejb; > > import java.math.BigDecimal; > import javax.ejb.Remote; > > @Remote > public interface Converter { > > public BigDecimal dollarToRupees(BigDecimal dollars); > > public BigDecimal rupeesToEuro(BigDecimal rupees); > } > > > --> ConverterBean.java > > package ejb; > > import java.math.BigDecimal; > import javax.ejb.*; > > @Stateless > public class ConverterBean implements Converter { > > private BigDecimal rupeeRate = new BigDecimal("40.58"); > private BigDecimal euroRate = new BigDecimal("0.018368"); > > public BigDecimal dollarToRupees(BigDecimal dollars) { > BigDecimal result = dollars.multiply(rupeeRate); > return result.setScale(2, BigDecimal.ROUND_UP); > } > > public BigDecimal rupeesToEuro(BigDecimal rupees) { > BigDecimal result = rupees.multiply(euroRate); > return result.setScale(2, BigDecimal.ROUND_UP); > } > } > > > --> ejb-jar.xml > > <?xml version="1.0" encoding="UTF-8"?> > <ejb-jar > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns="http://java.sun.com/xml/ns/javaee" > xmlns:ejb="http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" > xsi:schemaLocation="http://java.sun.com/xml/ns/javaee > http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd" > version="3.1"> > <display-name>CurrencyConvertEJB</display-name> > </ejb-jar> > > > --> openejb-jar.xml > > <?xml version="1.0" encoding="UTF-8" standalone="no"?> > <ejb:openejb-jar > xmlns:app="http://geronimo.apache.org/xml/ns/j2ee/application-2.0" > > xmlns:client=" > http://geronimo.apache.org/xml/ns/j2ee/application-client-2.0" > xmlns:conn="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2" > xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2" > xmlns:ejb="http://openejb.apache.org/xml/ns/openejb-jar-2.2" > xmlns:log="http://geronimo.apache.org/xml/ns/loginconfig-2.0" > xmlns:name="http://geronimo.apache.org/xml/ns/naming-1.2" > xmlns:pers="http://java.sun.com/xml/ns/persistence" > xmlns:pkgen="http://openejb.apache.org/xml/ns/pkgen-2.1" > xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0" > xmlns:web="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1"> > <dep:environment> > <dep:moduleId> > <dep:groupId>default</dep:groupId> > <dep:artifactId>CurrencyConverterEJB</dep:artifactId> > <dep:version>1.0</dep:version> > <dep:type>car</dep:type> > </dep:moduleId> > </dep:environment> > </ejb:openejb-jar> > > > --> index.jsp > > <?xml version="1.0" encoding="UTF-8" ?> > <%@ page language="java" contentType="text/html; charset=UTF-8" > pageEncoding="UTF-8"%> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > <html xmlns="http://www.w3.org/1999/xhtml"> > <head> > <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> > <title>Converter</title> > </head> > <body bgcolor="white"> > Converter > > <hr /> > <p>Enter an amount to convert:</p> > <form method="get" action="index.jsp"> > <input type="text" name="amount" size="25" /><br /> > <p> > <input type="submit" value="Submit" /> > > <input type="reset" value="Reset" /> > </p> > </form> > > <jsp:include page="/ConverterHandler" /> > > </body> > > </html> > > > --> ConverterHandler.java > > package webejb; > > 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 ejb.Converter; > > /** > * Servlet implementation class ConverterHandler > */ > @WebServlet("/ConverterHandler") > public class ConverterHandler extends HttpServlet { > private static final long serialVersionUID = 1L; > > @EJB(name = "ejb/Converter") > private Converter converter; > > /** > * @see HttpServlet#HttpServlet() > */ > public ConverterHandler() { > > super(); > } > > /** > * @see HttpServlet#doGet(HttpServletRequest request, > HttpServletResponse > response) > */ > protected void doGet(HttpServletRequest request, HttpServletResponse > response) throws ServletException, IOException { > > PrintWriter out = response.getWriter(); > String amount = request.getParameter("amount"); > if (amount != null && amount.length() > 0) { > BigDecimal d = new BigDecimal(amount); > BigDecimal rupeeAmount = > converter.dollarToRupees(d); > out.println("<p>" + amount + " Dollars are " + > rupeeAmount + " > Rupees.<p>"); > BigDecimal euroAmount = > converter.rupeesToEuro(rupeeAmount); > out.println(amount + " Dollars are " + euroAmount + > " Euro."); > } > } > > /** > * @see HttpServlet#doPost(HttpServletRequest request, > HttpServletResponse > response) > */ > protected void doPost(HttpServletRequest request, > HttpServletResponse > response) throws ServletException, IOException { > > doGet(request, response); > } > > } > > > --> web.xml > > <?xml version="1.0" encoding="UTF-8"?> > <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns="http://java.sun.com/xml/ns/javaee" > xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" > xsi:schemaLocation="http://java.sun.com/xml/ns/javaee > http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> > <display-name>WebEJB</display-name> > <welcome-file-list> > <welcome-file>index.html</welcome-file> > <welcome-file>index.htm</welcome-file> > <welcome-file>index.jsp</welcome-file> > <welcome-file>default.html</welcome-file> > <welcome-file>default.htm</welcome-file> > <welcome-file>default.jsp</welcome-file> > </welcome-file-list> > </web-app> > > > --> geronimo-web.xml > > <?xml version="1.0" encoding="UTF-8"?> > <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1" > xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2" > xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0" > xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2"> > > <sys:environment> > <sys:moduleId> > <sys:groupId>default</sys:groupId> > <sys:artifactId>WebEJB</sys:artifactId> > <sys:version>1.0</sys:version> > <sys:type>car</sys:type> > </sys:moduleId> > <sys:dependencies> > <sys:dependency> > <sys:groupId>default</sys:groupId> > <sys:artifactId>CurrencyConvertEJB</sys:artifactId> > <sys:version>1.0</sys:version> > <sys:type>car</sys:type> > </sys:dependency> > </sys:dependencies> > </sys:environment> > > <context-root>/WebEJB</context-root> > > <nam:ejb-ref xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2"> > <nam:ref-name>ejb/Converter</nam:ref-name> > <nam:pattern> > <nam:groupId>default</nam:groupId> > <nam:artifactId>CurrencyConvertEJB</nam:artifactId> > <nam:version>1.0</nam:version> > <nam:name>ConverterBean</nam:name> > </nam:pattern> > </nam:ejb-ref> > > </web-app> > > > --> Error Message Box > > 'Publishing to Apache Geronimo v3.0 Server at localhost...' has encouterred > a problem. > > NLS missing message: DISTRIBUTE_FAIL in: > org.apache.geronimo.st.v30.core.internal.Messages > Classloader for nullcan't find Could not fully load class: > webejb.ConverterHandler > due to:Lejb/Converter; > in classLoader: > 412.0 > org.apache.geronimo.common.DeploymentException: Classloader for nullcan't > find Could not fully load class: webejb.ConverterHandler > due to:Lejb/Converter; > in classLoader: > 412.0 > at > > org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder.createWebAppClassFinder(AbstractWebModuleBuilder.java:678) > at > > org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder.createWebAppClassFinder(AbstractWebModuleBuilder.java:623) > at > > org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder.configureBasicWebModuleAttributes(AbstractWebModuleBuilder.java:700) > at > > org.apache.geronimo.jetty8.deployment.JettyModuleBuilder.addGBeans(JettyModuleBuilder.java:482) > at > > org.apache.geronimo.j2ee.deployment.SwitchingModuleBuilder.addGBeans(SwitchingModuleBuilder.java:175) > at > > org.apache.geronimo.j2ee.deployment.EARConfigBuilder.buildConfiguration(EARConfigBuilder.java:690) > at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:250) > at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:138) > at sun.reflect.GeneratedMethodAccessor78.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at > > org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34) > at > > org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:131) > at > > org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:856) > at > org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:245) > at > org.apache.geronimo.kernel.KernelGBean.invoke(KernelGBean.java:344) > at sun.reflect.GeneratedMethodAccessor53.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at > > org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34) > at > > org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:131) > at > > org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:856) > at > org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:245) > at > > org.apache.geronimo.system.jmx.MBeanGBeanBridge.invoke(MBeanGBeanBridge.java:172) > at > com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(Unknown > Source) > at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(Unknown Source) > at javax.management.remote.rmi.RMIConnectionImpl.doOperation(Unknown > Source) > at javax.management.remote.rmi.RMIConnectionImpl.access$200(Unknown > Source) > at > > javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(Unknown > Source) > at java.security.AccessController.doPrivileged(Native Method) > at > javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(Unknown > Source) > at javax.management.remote.rmi.RMIConnectionImpl.invoke(Unknown > Source) > at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source) > at sun.rmi.transport.Transport$1.run(Unknown Source) > at java.security.AccessController.doPrivileged(Native Method) > at sun.rmi.transport.Transport.serviceCall(Unknown Source) > at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source) > at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown > Source) > at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown > Source) > at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown > Source) > at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown > Source) > at java.lang.Thread.run(Unknown Source) > Caused by: java.lang.NoClassDefFoundError: Could not fully load class: > webejb.ConverterHandler > due to:Lejb/Converter; > in classLoader: > 412.0 > at org.apache.xbean.finder.ClassFinder.<init>(ClassFinder.java:161) > at > > org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder.createWebAppClassFinder(AbstractWebModuleBuilder.java:676) > ... 44 more > > > --> Console > > 2011-04-21 01:54:36,567 ERROR [DependencyManager] Could not install bundle > dependecy > org.osgi.framework.BundleException: Unable to cache bundle: > mvn:default/CurrencyConvertEJB/1.0/car > at org.apache.felix.framework.Felix.installBundle(Felix.java:2378) > at org.apache.felix.framework.Felix.installBundle(Felix.java:2334) > at > > org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:130) > at > > org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:108) > at > > org.apache.geronimo.system.configuration.DependencyManager.starting(DependencyManager.java:182) > at > > org.apache.geronimo.system.configuration.DependencyManager.bundleChanged(DependencyManager.java:89) > at > > org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:800) > at > > org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:728) > at > > org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:610) > at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:3612) > at org.apache.felix.framework.Felix.activateBundle(Felix.java:1750) > at org.apache.felix.framework.Felix.startBundle(Felix.java:1682) > at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:905) > at > > org.apache.geronimo.deployment.DeploymentContext.createTempConfiguration(DeploymentContext.java:202) > at > > org.apache.geronimo.deployment.DeploymentContext.initializeConfiguration(DeploymentContext.java:188) > at > > org.apache.geronimo.j2ee.deployment.EARConfigBuilder.buildConfiguration(EARConfigBuilder.java:606) > at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:250) > at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:138) > at sun.reflect.GeneratedMethodAccessor78.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at > > org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34) > at > > org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:131) > at > > org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:856) > at > org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:245) > at > org.apache.geronimo.kernel.KernelGBean.invoke(KernelGBean.java:344) > at sun.reflect.GeneratedMethodAccessor53.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at > > org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34) > at > > org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:131) > at > > org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:856) > at > org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:245) > at > > org.apache.geronimo.system.jmx.MBeanGBeanBridge.invoke(MBeanGBeanBridge.java:172) > at > com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(Unknown > Source) > at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(Unknown Source) > at javax.management.remote.rmi.RMIConnectionImpl.doOperation(Unknown > Source) > at javax.management.remote.rmi.RMIConnectionImpl.access$200(Unknown > Source) > at > > javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(Unknown > Source) > at java.security.AccessController.doPrivileged(Native Method) > at > javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(Unknown > Source) > at javax.management.remote.rmi.RMIConnectionImpl.invoke(Unknown > Source) > at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source) > at sun.rmi.transport.Transport$1.run(Unknown Source) > at java.security.AccessController.doPrivileged(Native Method) > at sun.rmi.transport.Transport.serviceCall(Unknown Source) > at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source) > at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown > Source) > at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown > Source) > at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown > Source) > at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown > Source) > at java.lang.Thread.run(Unknown Source) > Caused by: java.lang.RuntimeException: URL > [mvn:default/CurrencyConvertEJB/1.0/car] could not be resolved. > at > > org.ops4j.pax.url.mvn.internal.Connection.getInputStream(Connection.java:195) > at > > org.apache.felix.framework.util.SecureAction.getURLConnectionInputStream(SecureAction.java:487) > at > > org.apache.felix.framework.cache.JarRevision.initialize(JarRevision.java:163) > at > org.apache.felix.framework.cache.JarRevision.<init>(JarRevision.java:80) > at > org.apache.felix.framework.cache.JarRevision.<init>(JarRevision.java:58) > at > > org.apache.felix.framework.cache.BundleArchive.createRevisionFromLocation(BundleArchive.java:1020) > at > > org.apache.felix.framework.cache.BundleArchive.revise(BundleArchive.java:631) > at > > org.apache.felix.framework.cache.BundleArchive.<init>(BundleArchive.java:147) > at > org.apache.felix.framework.cache.BundleCache.create(BundleCache.java:169) > at org.apache.felix.framework.Felix.installBundle(Felix.java:2374) > ... 54 more > > > --> Servers > +-> Apache Geronimo v3.0 Server at localhost [Started, Republish] > +--> CurrencyCOnverterEJB [SYnchronized] > +--> WebEJB [Error publishing module to server] > > > --> http://localhost:8080/console/ > > Web App WArs > > Component Name Display Name URL State Commands > org.apache.geronimo.configs/dojo-jetty/3.0-M1/car Dojo Webapp > /dojo > running Stop Stop Restart Restart Uninstall > Uninstall > org.apache.geronimo.configs/remote-deploy-jetty/3.0-M1/car Geronimo > Remote Deployer /remote-deploy > running Stop Stop Restart Restart Uninstall > Uninstall > org.apache.geronimo.configs/welcome-jetty/3.0-M1/car Welcome to > Geronimo > / > running Stop Stop Restart Restart Uninstall > Uninstall > org.apache.geronimo.plugins/plugin-console-jetty/3.0-M1/car Geronimo > Management Console Portlets /plugin > running Stop Restart Uninstall > > > Application EARs > > Component Name URL State Commands > org.apache.geronimo.plugins/console-jetty/3.0-M1/car running > Stop > Restart Uninstall > > > EJB JARs > > Component Name State Commands > default/CurrencyConverterEJB/1.0/car running Stop Restart > Uninstall > > > so... the question is: what do i miss here? > > joquetaire > > > -- > View this message in context: > http://apache-geronimo.328035.n3.nabble.com/EJB-and-Web-tutorial-3-0-deplyment-error-tp2844215p2844215.html > Sent from the Users mailing list archive at Nabble.com. >