Skip to main content

EJB 3.* with glassfish eclipse

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
No replies
michaelgoossens
Offline
Joined: 2010-12-20

Hello, I'm new to EJB and I want to create a small web application. I want to use jsp's for the view, servlets for the controller and EJB for the model. As IDE I downloaded GlassFish eclipse, this makes life a lot easier but I have come to think that it hides more complexity than is good for me.
I first made a dynamic webproject for the creation of a servlet "UserServlet" and a jsp to view some dummy data: http://www.sourcepod.com/thkhvv81-4027. And everything went smoothly, I first did it with a dummy model(created with a POJO) and left out the EJB.
After the servlet structure worked I created a second project, this time an EJB project.
business interface: http://www.sourcepod.com/lguyhm17-4028
remote interface: http://www.sourcepod.com/hfacgn14-4029
local interface: http://www.sourcepod.com/dzsdsx87-4031
bean: http://www.sourcepod.com/smyibe56-4030
I also made a jar of this and added it to the dynamic web project so I could call the EJB from the servlet and replace the old POJO model with the EJB model.
Everything is smoothly I thought but this is not the case, I'm stuck on this for a month now and the only result I seem to get is:
maandag 20 december 2010 20:58:49 Europe/Brussels [#|2010-12-20T20:59:06.730+0100|SEVERE|glassfishv3.0|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=26;_ThreadName=Thread-1;|javax.naming.NamingException: Lookup failed for 'ejb/UserManagerBean' in SerialContext [Root exception is javax.naming.NamingException: ejb ref resolution error for remote business interfaceuser.UserManagerRemote [Root exception is java.lang.ClassNotFoundException: user.UserManagerRemote]]
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:442)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at immo.user.UserServlet.init(UserServlet.java:45)
at javax.servlet.GenericServlet.init(GenericServlet.java:242)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1428)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:1060)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:187)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:680)
Caused by: javax.naming.NamingException: ejb ref resolution error for remote business interfaceuser.UserManagerRemote [Root exception is java.lang.ClassNotFoundException: user.UserManagerRemote]
at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:430)
at com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:70)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
at com.sun.enterprise.naming.impl.SerialContext.getObjectInstance(SerialContext.java:472)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:437)
When I fool around a bit with the lookup method I can generate another exception: classdefnotfoundexception.
Who can tell me what I'm doing wrong and how to fix it?