embeddable EJB container of WebSphere 8 can not created - NoClassDefFoundError HpelHelper

Tornado01 picture Tornado01 · Mar 11, 2013 · Viewed 16.1k times · Source

I am using the embeddable EJB container of WebSphere 8 to write some unit tests for my EJBs with JUnit4. My IDE is the RAD 8.

Here is my simple test code snippet:

 

    Map properties = new HashMap();
    properties.put(EJBContainer.PROVIDER,
                "com.ibm.websphere.ejbcontainer.EmbeddableContainerProvider");
    EJBContainer ec = EJBContainer.createEJBContainer(properties);

I get a NoClassDefFoundError:

    java.lang.NoClassDefFoundError: com/ibm/ejs/ras/hpel/HpelHelper
at com.ibm.ejs.ras.RasHelper.getThreadId(RasHelper.java:1760)
at com.ibm.ejs.ras.RasEvent6$1.initialValue(RasEvent6.java:101)
at java.lang.ThreadLocal.setInitialValue(ThreadLocal.java:152)
at java.lang.ThreadLocal.get(ThreadLocal.java:142)
at com.ibm.ejs.ras.RasEvent6.<init>(RasEvent6.java:292)
at com.ibm.ejs.ras.MessageEvent6.<init>(MessageEvent6.java:203)
at com.ibm.ejs.ras.Tr.fireMessageEvent(Tr.java:1555)
at com.ibm.ejs.ras.Tr.warning(Tr.java:1207)
at com.ibm.ws.naming.java.javaNameSpaceImpl.localNameSpaceInit(javaNameSpaceImpl.java:347)
at com.ibm.ws.naming.java.javaNameSpaceImpl.init(javaNameSpaceImpl.java:267)
at      com.ibm.ws.naming.java.javaURLInitialContextFactory.getInitialContext(javaURLInitialContextFactory.java:156)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:247)
at javax.naming.InitialContext.initializeDefaultInitCtx(InitialContext.java:318)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:348)
at javax.naming.InitialContext.internalInit(InitialContext.java:286)
at javax.naming.InitialContext.<init>(InitialContext.java:211)
at com.ibm.ejs.csi.DefaultComponentMetaData.initializeJavaNameSpace(DefaultComponentMetaData.java:150)
at com.ibm.ejs.csi.DefaultComponentMetaData.<init>(DefaultComponentMetaData.java:122)
at com.ibm.ejs.csi.DefaultComponentMetaData.<clinit>(DefaultComponentMetaData.java:94)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:228)
at com.ibm.ws.threadContext.ComponentMetaDataAccessorImpl.<init>(ComponentMetaDataAccessorImpl.java:59)
at com.ibm.ws.threadContext.ComponentMetaDataAccessorImpl.<clinit>(ComponentMetaDataAccessorImpl.java:54)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:228)
at com.ibm.ws.threadContext.JavaNameSpaceAccessorImpl.<init>(JavaNameSpaceAccessorImpl.java:56)
at com.ibm.ws.threadContext.JavaNameSpaceAccessorImpl.<clinit>(JavaNameSpaceAccessorImpl.java:48)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:228)
at com.ibm.websphere.ejbcontainer.EmbeddableContainer.initNaming(EmbeddableContainer.java:353)
at com.ibm.websphere.ejbcontainer.EmbeddableContainer.initialize(EmbeddableContainer.java:454)
at com.ibm.websphere.ejbcontainer.EmbeddableContainer.open(EmbeddableContainer.java:428)
at com.ibm.websphere.ejbcontainer.EmbeddableContainer.newContainer(EmbeddableContainer.java:382)
at com.ibm.websphere.ejbcontainer.EmbeddableContainerProvider.createEJBContainer(EmbeddableContainerProvider.java:75)

I can not find a jar with the class com/ibm/ejs/ras/hpel/HpelHelper anywhere.

Here is my classpath:

C:\workspaces\irad8\JSF2.0Test\MyEJBPrj\ejbModule;
C:\Program Files\IBM\WebSphere\AppServer\plugins\com.ibm.ws.wccm.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\com.ibm.ws.emf.jar;
C:\Program Files\IBM\WebSphere\AppServer\dev\JavaEE\6.0\j2ee.jar;
C:\Program Files\IBM\WebSphere\AppServer\lib\mail-impl.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\com.ibm.ws.runtime.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\com.ibm.ws.ejbportable.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\com.ibm.ws.admin.core.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\com.ibm.ws.admin.services.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\com.ibm.ws.portletcontainer.jar;
C:\Program Files\IBM\WebSphere\AppServer\lib\bootstrap.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\com.ibm.ws.sib.server.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\com.ibm.ws.sip.container.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\com.ibm.ws.sip.interface.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\com.ibm.ws.jsf.myfaces.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\com.ibm.ws.webcontainer.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\com.ibm.ws.wsadie\marshall.jar;
C:\Program Files\IBM\WebSphere\AppServer\lib\ffdcSupport.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\com.ibm.ws.wsadie\wsatlib.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\com.ibm.ws.runtime.dist.jar;
C:\Program Files\IBM\WebSphere\AppServer\installedConnectors\wmq.jmsra.rar\com.ibm.mq.jar;
C:\Program Files\IBM\WebSphere\AppServer\installedConnectors\wmq.jmsra.rar\com.ibm.mq.headers.jar;
C:\Program Files\IBM\WebSphere\AppServer\installedConnectors\wmq.jmsra.rar\com.ibm.mq.pcf.jar;
C:\Program Files\IBM\WebSphere\AppServer\installedConnectors\wmq.jmsra.rar\com.ibm.mq.jmqi.jar;
C:\Program Files\IBM\WebSphere\AppServer\installedConnectors\wmq.jmsra.rar\com.ibm.mq.connector.jar;
C:\Program Files\IBM\WebSphere\AppServer\installedConnectors\wmq.jmsra.rar\com.ibm.mq.commonservices.jar;
C:\Program Files\IBM\WebSphere\AppServer\installedConnectors\wmq.jmsra.rar\dhbcore.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\org.eclipse.emf.common.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\org.eclipse.emf.commonj.sdo.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\org.eclipse.emf.ecore.change.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\org.eclipse.emf.ecore.sdo.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\org.eclipse.emf.ecore.xmi.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\org.eclipse.emf.ecore.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\com.ibm.ws.prereq.wsdl4j.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\com.ibm.wsfp.main.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\com.ibm.ws.prereq.jackson.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\com.ibm.ws.prereq.xlxp.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\com.ibm.ws.prereq.jaxrs.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\javax.j2ee.jaxrs.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\com.ibm.ws.jaxrs.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\com.ibm.ws.prereq.vajava.jar;
C:\Program Files\IBM\WebSphere\AppServer\lib\rsadbutils.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\com.ibm.ws.jpa.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\com.ibm.ws.prereq.commonj-twm.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\com.ibm.ws.prereq.soap.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\org.apache.tuscany.sca.api.jar;
C:\Program Files\IBM\WebSphere\AppServer\dev\sca\1.0\sca_api.jar;
C:\Program Files\IBM\WebSphere\AppServer\dev\xml\xmlapi.jar;
C:\Program Files\IBM\WebSphere\AppServer\plugins\com.ibm.ws.batch.runtime.jar;
C:\Program Files\IBM\WebSphere\AppServer\tivoli\tam\PD.jar;
C:\Program Files\IBM\WebSphere\AppServer\installedConnectors\wmq.jmsra.rar\com.ibm.mqjms.jar;
C:\Program Files (x86)\IBM\SDPShared\plugins\org.junit_4.8.1.v4_8_1_v20100427-1100\junit.jar;
C:\Program Files (x86)\IBM\SDPShared\plugins\org.hamcrest.core_1.1.0.v20090501071000.jar;
C:\Program Files\IBM\WebSphere\AppServer\runtimes\com.ibm.ws.ejb.embeddableContainer_8.0.0.jar;
/C:/Program Files/IBM/SDP/configuration/org.eclipse.osgi/bundles/1486/1/.cp/;
/C:/Program Files/IBM/SDP/configuration/org.eclipse.osgi/bundles/1484/1/.cp/;
/C:/Program Files/IBM/SDP/configuration/org.eclipse.osgi/bundles/1485/1/.cp/

Answer

Brett Kail picture Brett Kail · Mar 16, 2013

The RAS included in the WebSphere embeddable EJB container does not use HPEL. This error message implies that some JAR on your classpath is using a different RAS. You should remove all WebSphere JARs except C:\Program Files\IBM\WebSphere\AppServer\runtimes\com.ibm.ws.ejb.embeddableContainer_8.0.0.‌​jar.