Skip to main content

Can I "mix" spec levels in a single EAR?

4 replies [Last post]
vbkraemer
Offline
Joined: 2003-09-03

I have a J2ee 1.4 ejb-jar. The jar has a stateless session bean with one method on its local interface.

I created a Java EE 5 ear. I put the jar into the ear.

I created a Java EE 5 web application. I created a servlet in the application.

Then I used the @EJB annotation to reference the ejb from the J2EE 1.4 ejb-jar file.

All of this compiles and deploys to build 41.

But when I run it, I see this in the server log:

WebModule[/ea5-war]StandardWrapper.Throwable
java.lang.RuntimeException: WEB5002: Exception in handleBeforeEvent.
at com.sun.web.server.J2EEInstanceListener.handleBeforeEvent(J2EEInstanceListener.java:260)
at com.sun.web.server.J2EEInstanceListener.instanceEvent(J2EEInstanceListener.java:97)
at org.apache.catalina.util.InstanceSupport.fireInstanceEvent(InstanceSupport.java:318)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1118)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:787)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:183)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
Caused by: com.sun.enterprise.InjectionException: Exception attempting to inject Unresolved Ejb-Ref lets.NewServlet/bean@jndi: test.NewSessionLocal@null@test.NewSessionLocal@Session@nullinto class lets.NewServlet
at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:356)
at com.sun.enterprise.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:193)
at com.sun.enterprise.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:104)
at com.sun.web.server.J2EEInstanceListener.handleBeforeEvent(J2EEInstanceListener.java:255)
... 27 more
Caused by: javax.naming.NameNotFoundException: test.NewSessionLocal#test.NewSessionLocal not found
at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:203)
at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:175)
at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:61)
at com.sun.enterprise.naming.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:98)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:309)
at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:833)
at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:156)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:307)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:274)
... 30 more
|#]

Note: I have tested the EJB in a J2EE 1.4 ear (being referenced by a servlet 2.4 web app). That worked. I created an Ejb 3.0 implementation of the "same bean" an was able to execute the 2.5 servlet, when I used annotation...

What do I need to do, short of "rewrite the bean" to use the EOD of Java EE 5 in a situation where I have a non-trivial amount of existing J2EE 1.4 code?

vbk

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
vbkraemer
Offline
Joined: 2003-09-03

Well, color me embarrassed. This issue was a user error. You can look in the bug report and at the following blog entry for details: http://blogs.sun.com/roller/page/vkraemer?entry=ejb_2_1_local_interface

Despite the fact that I bungled this first simple test, I am going to keep searching for the edge of the mixed specification level development envelope.. I will be putting the entries in here: http://blogs.sun.com/roller/page/vkraemer?catname=%2FEase+of+Evolution

vbkraemer
Offline
Joined: 2003-09-03

One additional "note"... This mixed spec app runs through the verifier with a clean bill of health.

ludo
Offline
Joined: 2003-06-10

File a bug...
In any case, one should not see a stack trace in the log for this either user error or container error.
The javac compiler does not emit a stack trace when it does not find a method or variable definition...

vbkraemer
Offline
Joined: 2003-09-03