Announcement Announcement Module
Collapse
No announcement yet.
Spring in RAD7 with WebSphere 6.1 fails to find AbstractStatelessSessionBean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring in RAD7 with WebSphere 6.1 fails to find AbstractStatelessSessionBean

    Hi!

    Has anyone got Spring to work in such an environment?
    I have problem to get RAD to find the AbstractStatelessSessionBean.
    I have put the spring.jar in the classpath of the EAR project.
    I get this result when i try to start the application:


    Code:
    [2008-04-22 17:33:14:564 CEST] 0000002a EJBContainerI E   WSVR0068E: Attempt to start EnterpriseBean NyAServices#NyAServicesEJB.jar#CatalogueController failed with exception: com.ibm.ejs.container.ContainerException: Failed to initialize BeanMetaData instance; nested exception is: 
    	java.lang.NoClassDefFoundError: Error while defining class: se.vhs.nya.services.catalogue.server.common.facade.CatalogueControllerBean
    This error indicates that the class: Error while defining class: se.vhs.nya.framework.server.common.facade.NyASpringBaseFacade
    This error indicates that the class: org.springframework.ejb.support.AbstractStatelessSessionBean
    could not be located while defining the class: se.vhs.nya.framework.server.common.facade.NyASpringBaseFacade
    This is often caused by having the class at a higher point in the classloader hierarchy
    Dumping the current context classloader hierarchy:
        ==> indicates defining classloader
        *** indicates classloader where the missing class could have been found
       [0] com.ibm.ws.bootstrap.ExtClassLoader@60a260a2
       [1] [email protected]f8a
       [2] sun.misc.Launcher$AppClassLoader@2bce2bce
       [3] sun.misc.Launcher$ExtClassLoader@9600960
    ---Original exception---
    java.lang.NoClassDefFoundError: org.springframework.ejb.support.AbstractStatelessSessionBean
    	at java.lang.ClassLoader.defineClassImpl(Native Method)
    	at java.lang.ClassLoader.defineClass(ClassLoader.java:222)
    	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:148)
    	at com.ibm.ws.classloader.CompoundClassLoader._defineClass(CompoundClassLoader.java:526)
    	at com.ibm.ws.classloader.CompoundClassLoader.findClass(CompoundClassLoader.java:477)
    	at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:373)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:561)
    	at java.lang.ClassLoader.defineClassImpl(Native Method)
    	at java.lang.ClassLoader.defineClass(ClassLoader.java:222)
    	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:148)
    	at com.ibm.ws.classloader.CompoundClassLoader._defineClass(CompoundClassLoader.java:526)
    	at com.ibm.ws.classloader.CompoundClassLoader.findClass(CompoundClassLoader.java:477)
    	at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:373)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:561)
    	at com.ibm.ejs.container.BeanMetaData.<init>(BeanMetaData.java:1346)
    	at com.ibm.ws.runtime.component.EJBContainerImpl.createBeanMetaData(EJBContainerImpl.java:1956)
    	at com.ibm.ws.runtime.component.EJBContainerImpl.createDeferredBeanMetaData(EJBContainerImpl.java:4600)
    	at com.ibm.ws.runtime.component.EJBContainerImpl.access$000(EJBContainerImpl.java:435)
    	at com.ibm.ws.runtime.component.EJBContainerImpl$3.run(EJBContainerImpl.java:4399)
    	at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
    	at com.ibm.ws.runtime.component.EJBContainerImpl.initializeDeferredEJB(EJBContainerImpl.java:4396)
    	at com.ibm.ejs.container.HomeOfHomes.getHome(HomeOfHomes.java:345)
    I have allready tried the "undeploy redeploy" workaround for the similar problem in the forum. And I have allso tried to downgrade to spring 2.5.2 and rebuilt, republished and so on.. but to no avail.

    Any ideas what might be the problem?

  • #2
    Spring in RAD7 with WebSphere 6.1 fails to find AbstractStatelessSessionBean

    I would check how your spring jar is packaged in your application regarding to a class path loader order. Is your spring jar defined in a manifest of your ejb module? Or do you put your spring jar in the war module?

    I am using Spring with WS 6.1 and I have not experienced with spring and a class loader at all. An example exploded ear file for me will look like this:

    \META-INF\application.xml
    myEJB.jar
    spring.jar
    comms-lang.jar
    log4j-1.2.14.jar

    In myEJB.jar, the manifest.mf will look like this
    Manifest-Version: 1.0
    Class-Path: spring.jar
    commons-lang.jar
    log4j-1.2.14.jar

    The manifest.mf is very "sensitive" to changes in WS 6.x so I would modify it using WS jar dependency editor.

    HTH

    Vu

    Comment


    • #3
      can't spring jar

      I got a very similar problem. Here is my situation:
      - RAD7 with WAS6.1
      - Three projects:
      1) a EJB project with a session bean with spring (MyEJBwithSring)
      Manifest-Version: 1.0
      Class-Path: spring.jar
      commons-logging-1.1.1.jar
      2) auto-generated EAR project (MyEJBwithSringEAR)
      3) a j2ee application client (MyEJBwithSringApplicationClient) containg a test class myServiceTest with main()
      Manifest-Version: 1.0
      Class-Path: MyEJBwithSring.jar
      spring.jar
      commons-logging-1.1.1.jar
      Main-Class: myServiceTest
      - EAR is packaged with the EJB and the Application Client
      - WAS Sever v6.1 was started
      - MyEJBwithSringApplicationClient was Run As was V6.1 Application Client

      If Run without pull in spring.jar in the classpath of the luncher, got exception:
      Caused by: java.lang.NoClassDefFoundError: org.springframework.context.support.AbstractApplic ationContext

      If Run with spirng.jar in the classpath of the luncher, got a different exception:
      This error indicates that the class: org.springframework.ejb.support.AbstractStatelessS essionBean could not be located while defining the class: xxxxxx
      This is often caused by having the class at a higher point in the classloader hierarchy

      Here is the complete console output for former:
      IBM WebSphere Application Server, Release 6.1
      ................................................
      WSCL0013I: Initializing the J2EE Application Client Environment.
      [5/23/08 16:38:35:191 EDT] 0000000a W UOW=null source=com.ibm.ws.ssl.config.SSLConfig org=IBM prod=WebSphere component=Application Server thread=[P=114551:O=0:CT]
      CWPKI0041W: One or more key stores are using the default password.
      WSCL0025I: Binding EJB reference object:
      JNDI name: ejb/myService ==> ejb/MyServiceHome @ iiop://localhost:2810/
      Description:
      WSCL0031I: The object was bound successfully.

      WSCL0600I: Binding HandleDelegate object.
      WSCL0031I: The object was bound successfully.
      .................................................. .........
      WSCL0035I: Initialization of the J2EE Application Client Environment has completed.
      WSCL0014I: Invoking the Application Client class MyServiceTest
      Client ready to invoke EJB!
      WSCL0100E: Exception received: java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
      .........................................
      at com.ibm.wsspi.bootstrap.WSPreLauncher.main(WSPreLa uncher.java:89)
      Caused by: java.lang.NoClassDefFoundError: org.springframework.context.support.AbstractApplic ationContext
      at java.lang.J9VMInternals.verifyImpl(Native Method)
      ......................
      at myServiceTest.invokeEJBbySpring(ActionServiceTest. java:22)
      at MyServiceTest.main(MyServiceTest.java:16)
      ... 27 more


      Here is the complete console output for later:

      ************ Start Display Current Environment ************
      WebSphere Platform 6.1 [BASE 6.1.0.9 cf90722.41] [WEBSERVICES 6.1.0.9 x0723.22]
      Host Operating System is Windows XP, version 5.1 build 2600 Service Pack 2
      Java version = J2RE 1.5.0 IBM J9 2.3 Windows XP x86-32 j9vmwi3223-20070426 (JIT enabled)
      J9VM - 20070420_12448_lHdSMR
      JIT - 20070419_1806_r8
      GC - 200704_19, Java Compiler = j9jit23, Java VM name = IBM J9 VM
      was.install.root = C:\RAD7\runtimes\base_v61
      user.install.root = C:\RAD7\runtimes\base_v61\profiles\AppSrv01
      Java Home = C:\RAD7\runtimes\base_v61\java\jre
      ws.ext.dirs = C:\RAD7\runtimes\base_v61/java/lib;C:\RAD7\runtimes\base_v61\profiles\AppSrv01/classes;C:\RAD7\runtimes\base_v61/classes;C:\RAD7\runtimes\base_v61/lib;C:\RAD7\runtimes\base_v61/installedChannels;C:\RAD7\runtimes\base_v61/lib/ext;C:\RAD7\runtimes\base_v61/web/help;C:\RAD7\runtimes\base_v61/deploytool/itp/plugins/com.ibm.etools.ejbdeploy/runtime
      Classpath = C:\RAD7\runtimes\base_v61\profiles\AppSrv01/properties;C:\RAD7\runtimes\base_v61/properties;C:\RAD7\runtimes\base_v61/lib/startup.jar;C:\RAD7\runtimes\base_v61/lib/bootstrap.jar;C:\RAD7\runtimes\base_v61/lib/j2ee.jar;C:\RAD7\runtimes\base_v61/lib/lmproxy.jar;C:\RAD7\runtimes\base_v61/lib/urlprotocols.jar;C:\RAD7\runtimes\base_v61/deploytool/itp/batchboot.jar;C:\RAD7\runtimes\base_v61/deploytool/itp/batch2.jar;C:\RAD7\runtimes\base_v61/java/lib/tools.jar
      Java Library path = C:\RAD7\runtimes\base_v61\java\jre\bin;.;C:\RAD7\r untimes\base_v61\bin;C:\RAD7\runtimes\base_v61\jav a\bin;C:\RAD7\runtimes\base_v61\java\jre\bin;C:\Se rena\Dimensions 10.1\CM\prog;C:\Program Files\Java\jre1.5.0_11\bin;C:\oracle\ora92\bin;C:\ Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\ WINDOWS;C:\Serena\CHANGE~1\DIMENS~1\9.1\PROG;;C:\W INDOWS\System32\Wbem;C:\WINDOWS\system32\nls;C:\WI NDOWS\system32\nls\ENGLISH;C:\PROGRA~1\IBM\SQLLIB\ BIN;C:\PROGRA~1\IBM\SQLLIB\FUNCTION;C:\mq53\bin;C: \mq53\tools\c\samples\bin;C:\apache-ant-1.7.0\bin;C:\Program Files\Putty
      ************* End Display Current Environment *************
      [5/23/08 16:04:17:765 EDT] 0000000a ManagerAdmin I TRAS0017I: The startup trace state is *=info.
      ................................................
      [5/23/08 16:04:26:859 EDT] 0000000a WsServerImpl A WSVR0001I: Server server1 open for e-business
      .................................................. .................................................. ........
      [5/23/08 16:04:40:765 EDT] 00000011 ApplicationMg A WSVR0200I: Starting application: MyEJBwithSringEAR
      [5/23/08 16:04:40:765 EDT] 00000011 ApplicationMg A WSVR0204I: Application: MyEJBwithSringEAR Application build level: Unknown
      [5/23/08 16:04:40:828 EDT] 00000011 EJBContainerI I WSVR0037I: Starting EJB jar: MyEJBwithSring.jar
      [5/23/08 16:04:40:937 EDT] 00000011 EJBContainerI I WSVR0057I: EJB jar started: MyEJBwithSring.jar
      [5/23/08 16:04:40:953 EDT] 00000011 ApplicationMg A WSVR0221I: Application started: MyEJBwithSringEAR
      [5/23/08 16:34:52:727 EDT] 0000001d EJBContainerI E WSVR0068E: Attempt to start EnterpriseBean MyEJBwithSringEAR#MyEJBwithSring.jar#MyService failed with exception: com.ibm.ejs.container.ContainerException: Failed to initialize BeanMetaData instance; nested exception is:
      java.lang.NoClassDefFoundError: Error while defining class: MyServiceBean
      This error indicates that the class: org.springframework.ejb.support.AbstractStatelessS essionBean could not be located while defining the class: XXXX
      This is often caused by having the class at a higher point in the classloader hierarchy
      Dumping the current context classloader hierarchy:
      ==> indicates defining classloader
      *** indicates classloader where the missing class could have been found
      [0] com.ibm.ws.bootstrap.ExtClassLoader@62886288
      [1] org.eclipse.osgi.internal.baseadaptor.DefaultClass Loader@73807380
      [2] sun.misc.Launcher$AppClassLoader@5dd85dd8
      [3] sun.misc.Launcher$ExtClassLoader@7e6c7e6c
      ---Original exception---
      java.lang.NoClassDefFoundError: org.springframework.ejb.support.AbstractStatelessS essionBean
      at java.lang.ClassLoader.defineClassImpl(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java :228)
      .................................................. ...............
      at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.j ava:1469)

      Thanks in advance!

      Comment


      • #4
        problem solved

        Thank you vksoft,
        I met the same problem, but get solved by checking the manifest.mf .
        Add spring.jar into classpath will solve the problem.

        Comment


        • #5
          Also if you right-click on your main EAR project and go to J2EE dependencies, do you have your spring.jar in there as well? For me that was a key part of getting it to find it in addition to having it in the manifest and in the sub-project's classpath file.

          Comment

          Working...
          X