cancel
Showing results for 
Search instead for 
Did you mean: 

EJB DC use hibernate external library and NoClassDefFoundError at runtime

Former Member
0 Kudos

Hi:

I'm working with a EJB DC + Hibernate 2. EJB --> WS and the data it's display on a WD DC.

Hibernate works in local tests (I have all the libraries local in the project) but when I try to instantiate this class Configuration cfg = new Configuration() testing the WS; this is what I get:

com.sap.engine.services.ejb.exceptions.BaseEJBException: Exception in method com.demo3.test.ejb.Demo3EJBLocalLocalObjectImpl0_0.businessMethod_ejb3().

at com.demo3.test.ejb.Demo3EJBLocalLocalObjectImpl0_0.businessMethod_ejb3(Demo3EJBLocalLocalObjectImpl0_0.java:138)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at com.sap.engine.services.webservices.runtime.EJBImplementationContainer.invokeMethod(EJBImplementationContainer.java:126)

at com.sap.engine.services.webservices.runtime.RuntimeProcessor.process(RuntimeProcessor.java:157)

at com.sap.engine.services.webservices.runtime.RuntimeProcessor.process(RuntimeProcessor.java:79)

at com.sap.engine.services.webservices.runtime.servlet.ServletDispatcherImpl.doPost(ServletDispatcherImpl.java:92)

at SoapServlet.doPost(SoapServlet.java:51)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:387)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:365)

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:944)

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:266)

at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)

at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)

at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)

at java.security.AccessController.doPrivileged(Native Method)

at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)

Caused by: java.lang.NoClassDefFoundError: net/sf/hibernate/cfg/Configuration

at com.demo3.test.ejb.Demo3EJBBean.businessMethod_ejb3(Demo3EJBBean.java:78)

at com.demo3.test.ejb.Demo3EJBLocalLocalObjectImpl0_0.businessMethod_ejb3(Demo3EJBLocalLocalObjectImpl0_0.java:129)

... 25 more

I have at my EJB DC --> used DC the "library DC (J2ee Server Component)" which have hibernate's jars

So... I look at Visual administration 3 things:

1- At Libraries I lookup for my hibernate library and at "JARs Contained" are all the jars

2- At Services --> ClassLoader Viewer --> Libraries --> look for my library DC --> all the jars are display

3- At Services --> ClassLoader Viewer --> Applications --> look for EAR DC --> I can only see services dependencies (? red line)

So...it seems to be that at the server are all deploy, and all the classes are in place.

I can see at my EJB DC that the classpath reference the library DC and all classes are included.

Any idea?

Thanks a lot for your time on this thread.

Rocío.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I'm a bit unclear about something you've said:

3- At Services --> ClassLoader Viewer --> Applications --> look for EAR DC --> I can only see services dependencies (? red line)

Are you saying that you can't see any library dependencies? If this is the case, then this is the problem. You should see a dependency between your ear and the library DC that contains the hibernate libraries.

There are also other depenencies that hibernate has to other 3rd party java libraries - have you included all of those as well? In our configuration, the Hibernate library DC has runtime dependencies to antlr, Jakarta Commons, log4j, cglib, dom4j, and ehcache. If you're missing any of these libs, you could get class not found errors. From what you describe, however, you do have 'all the jar files' in the same DC, so this may not be your problem.

All I can suggest at this time is to make sure that your EAR has a runtime reference to your hibernate library DC 'defLib' public part.

Former Member
0 Kudos

Hi Ken:

What I see is:

Fame ClassLoader <--- (blue electric line) my ear that wrap the EJB project DC --> (all red lines)

--> common@2

--> service:ejb

--> common@4

--> service:jmsconnector

--> library:jsse

--> library:servlet

--> common@1

--> service:ejb20

--> library:j2eeca

--> library:jms

--> library: opensql

--> common@5

--> interface:resourcecontext_api

--> interface:webservices

--> interface:cross

--> interface: ejbserialization

so....I checked the runtime references again..., delete the ear file, the result was the same....

The deflib is reference by my ear DC and by my EJB DC at the NWDS.

I try with runtime qualifier: strong, weak, none....and nothing....

Any idea?.

Thanks for your time on this thread.

Rocío.

Answers (0)