Tuesday 21 June 2016

Caused by: java.lang.ClassNotFoundException: com.ibm.ws.javaee.dd.ejb.Method

Hello Everyone,

Hope you all are doing well. It's after five months I am writing this post. I was getting below error while starting the adminagent in one of my Websphere 7 environment. I am getting this error while startup and adminagent was not getting start. You may face the same error on dmgr or on application server instance. When I checked for the issue I got below details in SystemOut.log

Error :


************* End Display Current Environment *************
[4/15/16 18:16:15:386 EDT] 00000001 ManagerAdmin  I   TRAS0017I: The startup trace state is *=info.
[4/15/16 18:16:15:389 EDT] 00000001 ManagerAdmin  I   TRAS0111I: The message IDs that are in use are deprecated
[4/15/16 18:16:15:738 EDT] 00000001 ModelMgr      I   WSVR0800I: Initializing core configuration models
[4/15/16 18:16:16:612 EDT] 00000001 WsServerImpl  E   WSVR0009E: Error occurred during startup
java.lang.IllegalStateException: java.lang.IllegalStateException: java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException
        at com.ibm.ws.config.ModelMgr.initializeModels(ModelMgr.java:355)
        at com.ibm.ws.config.ModelMgr.initialize(ModelMgr.java:162)
        at com.ibm.ws.runtime.WsServerImpl.start(WsServerImpl.java:221)
        at com.ibm.ws.runtime.WsServerImpl.main(WsServerImpl.java:697)
        at com.ibm.ws.runtime.WsServer.main(WsServer.java:59)
        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:597)
        at com.ibm.wsspi.bootstrap.WSLauncher.launchMain(WSLauncher.java:234)
        at com.ibm.wsspi.bootstrap.WSLauncher.main(WSLauncher.java:96)
        at com.ibm.wsspi.bootstrap.WSLauncher.run(WSLauncher.java:77)
        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:597)
        at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:587)
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
        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:597)
        at org.eclipse.core.launcher.Main.invokeFramework(Main.java:340)
        at org.eclipse.core.launcher.Main.basicRun(Main.java:282)
        at org.eclipse.core.launcher.Main.run(Main.java:981)
        at com.ibm.wsspi.bootstrap.WSPreLauncher.launchEclipse(WSPreLauncher.java:400)
        at com.ibm.wsspi.bootstrap.WSPreLauncher.main(WSPreLauncher.java:163)
Caused by: java.lang.IllegalStateException: java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException
        at com.ibm.ws.config.ModelMgr.performInitialization(ModelMgr.java:620)
        at com.ibm.ws.config.ModelMgr.processInitializer(ModelMgr.java:577)
        at com.ibm.ws.config.ModelMgr.loadModelsViaEclipse(ModelMgr.java:512)
        at com.ibm.ws.config.ModelMgr.initializeModels(ModelMgr.java:351)
        ... 30 more
Caused by: java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException
        at com.ibm.ws.config.ModelMgr.performInitialization(ModelMgr.java:647)
        at com.ibm.ws.config.ModelMgr.performInitialization(ModelMgr.java:617)
        ... 33 more
Caused by: java.lang.reflect.InvocationTargetException
        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:597)
        at com.ibm.ws.config.ModelMgr.performInitialization(ModelMgr.java:644)
        ... 34 more
Caused by: java.lang.NoClassDefFoundError: com/ibm/ws/javaee/dd/ejb/Method
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:188)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:580)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:550)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:481)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_LockClassLoader(ClasspathManager.java:469)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:449)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
        at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:393)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:469)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        at org.eclipse.jst.j2ee.internal.J2EEInit.init(J2EEInit.java:123)
        at org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveInit.invokePrereqInits(ArchiveInit.java:100)
        at org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveInit.init(ArchiveInit.java:81)
        at org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveInit.init(ArchiveInit.java:45)
        at com.ibm.websphere.models.config.init.ReadOnlyConfigInit.initializeCommonArchive(ReadOnlyConfigInit.java:110)
        at com.ibm.websphere.models.config.init.ReadOnlyConfigInit.init(ReadOnlyConfigInit.java:90)
        ... 39 more
Caused by: java.lang.ClassNotFoundException: com.ibm.ws.javaee.dd.ejb.Method
        at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        ... 61 more


Cause:


There are several reasons for this Error. After an upgrade , it is possible that the class cache's are still holding onto previous versions of classes. Or improper stop start, It is also possible that the caches became corrupted.

Solution:


You need to clear the two types of the cache, the JVM's cache and the OSGi cache. The server has to be stopped before clearing the cache

To clear the OSGi class cache:
For UNIX platforms, run the following script in each profile:
<WebSphere_HOME>/profiles/profile_name/bin/osgiCfgInit.sh

To clear the JVM's class cache:
For UNIX platforms, run the following script:
<WebSphere_HOME>/bin/clearClassCache.sh

And clear the following directory contents:
<WinUsers_home>\Local Settings\ApplicationData\javasharedresources\

Procedure:


1. The server has to be stopped before clearing the cache

2. You must be logged in as the user who started WebSphere Application Server. In our case we are executing the commands for adminagent.

3. Execute the command <WebSphere_HOME>/profiles/profile_name/bin/osgiCfgInit.sh

Example:
bash-3.2$ su - was
bash-3.2$ cd /IBM/WebSphere7/profiles/Agent01/bin
bash-3.2$ ./osgiCfgInit.sh
OSGi profile cache successfully cleaned for /IBM/WebSphere7/profiles/Agent01/.
OSGi server cache successfully cleaned for /IBM/WebSphere7/profiles/Agent01/servers/adminagent.

4. Execute the command <WebSphere_HOME>/bin/clearClassCache.sh 

Example:
bash-3.2$ ./clearClassCache.sh
bash-3.2$ ./startServer.sh adminagent
ADMU0116I: Tool information is being logged in file
          /IBM/WebSphere7/profiles/Agent01/logs/adminagent/startServer.log
ADMU0128I: Starting tool with the Agent01 profile
ADMU3100I: Reading configuration for server: adminagent
ADMU3200I: Server launched. Waiting for initialization status.
ADMU3000I: Server adminagent open for e-business; process id is NNNN


Hope this will help you. Kindly comment for your suggestion and quires.  

"Effort only fully releases its reward after a person refuses to quit.”

 Regards,
 Akhilesh B. Humbe

Popular Posts