spring Exception when running application on WebSphere with java 8 -
i got several illegalstateexception
,cannotcompileexception
, linkageerror
@ time of application running on websphere 9.0 java 8 . these stack trace of error :
caused by: java.lang.illegalstateexception: javassist.cannotcompileexception: java.lang.linkageerror: org.springframework.aop.framework.proxycreatorsupport @ org.springframework.aop.framework.javassistapplicationcontext.<clinit>(javassistapplicationcontext.java:61) ... 114 more caused by: javassist.cannotcompileexception: java.lang.linkageerror: org.springframework.aop.framework.proxycreatorsupport @ javassist.classpool.toclass(classpool.java:1120) @ javassist.classpool.toclass(classpool.java:1063) @ javassist.classpool.toclass(classpool.java:1021) @ javassist.ctclass.toclass(ctclass.java:1259) @ org.springframework.aop.framework.javassistapplicationcontext.<clinit>(javassistapplicationcontext.java:59) ... 114 more caused by: java.lang.linkageerror: org.springframework.aop.framework.proxycreatorsupport @ java.lang.classloader.defineclassimpl(native method) @ java.lang.classloader.defineclass(classloader.java:346) @ java.lang.classloader.defineclass(classloader.java:283) @ sun.reflect.generatedmethodaccessor17.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:55) @ java.lang.reflect.method.invoke(method.java:508) @ javassist.classpool.toclass2(classpool.java:1133) @ javassist.classpool.toclass(classpool.java:1114) ... 118 more
and getting java.lang.exceptionininitializererror
:
com.ibm.ws.webcontainer.webapp.webapp notifyservletcontextcreated srve0283e: exception caught while initializing context: {0} java.lang.exceptionininitializererror @ java.lang.j9vminternals.ensureerror(j9vminternals.java:141) @ java.lang.j9vminternals.recordinitializationfailure(j9vminternals.java:130) @ sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method) @ sun.reflect.nativeconstructoraccessorimpl.newinstance(nativeconstructoraccessorimpl.java:88) @ sun.reflect.delegatingconstructoraccessorimpl.newinstance(delegatingconstructoraccessorimpl.java:57) @ java.lang.reflect.constructor.newinstance(constructor.java:437) @ org.springframework.beans.beanutils.instantiateclass(beanutils.java:126) @ org.springframework.beans.beanutils.instantiateclass(beanutils.java:104) @ org.springframework.web.context.contextloader.createwebapplicationcontext(contextloader.java:258) @ org.springframework.web.context.contextloader.initwebapplicationcontext(contextloader.java:204) @ org.springframework.web.context.contextloaderlistener.contextinitialized(contextloaderlistener.java:47)
and in pom.xml
file, have following dependency.
<dependencymanagement> <dependencies> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-aop</artifactid> <version>${spring.version}</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-beans</artifactid> <version>${spring.version}</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-context</artifactid> <version>${spring.version}</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-context-support</artifactid> <version>${spring.version}</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-core</artifactid> <version>${spring.version}</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-jdbc</artifactid> <version>${spring.version}</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-orm</artifactid> <version>${spring.version}</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-test</artifactid> <version>${spring.version}</version> <scope>test</scope> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-tx</artifactid> <version>${spring.version}</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-web</artifactid> <version>${spring.version}</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-webmvc</artifactid> <version>${spring.version}</version> </dependency> <dependency> <groupid>org.freemarker</groupid> <artifactid>freemarker</artifactid> <version>2.3.16</version> </dependency> <dependency> <groupid>commons-codec</groupid> <artifactid>commons-codec</artifactid> <version>1.4</version> </dependency> <dependency> <groupid>commons-collections</groupid> <artifactid>commons-collections</artifactid> <version>3.2.1</version> <scope>provided</scope> </dependency> <dependency> <groupid>commons-fileupload</groupid> <artifactid>commons-fileupload</artifactid> <version>1.2.2</version> </dependency> <dependency> <groupid>commons-httpclient</groupid> <artifactid>commons-httpclient</artifactid> <version>3.1</version> </dependency> <dependency> <groupid>commons-io</groupid> <artifactid>commons-io</artifactid> <version>1.4</version> </dependency> <dependency> <groupid>commons-lang</groupid> <artifactid>commons-lang</artifactid> <version>2.5</version> </dependency> <!-- javassist --> <dependency> <groupid>javassist</groupid> <artifactid>javassist</artifactid> <version>3.19.0-ga</version> </dependency> </dependencies> </dependencymanagement> <dependencies> <dependency> <groupid>commons-logging</groupid> <artifactid>commons-logging</artifactid> <version>[1.1.1,)</version> <scope>provided</scope> </dependency> <dependency> <groupid>commons-logging</groupid> <artifactid>commons-logging-api</artifactid> <version>[1.0.3,)</version> <scope>provided</scope> </dependency> <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-api</artifactid> <version>${slf4jversion}</version> <!--<scope>provided</scope>--> </dependency> <dependency> <groupid>org.slf4j</groupid> <artifactid>jcl-over-slf4j</artifactid> <version>${slf4jversion}</version> <!--<scope>provided</scope>--> </dependency> <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-log4j12</artifactid> <version>${slf4jversion}</version> <!--<scope>provided</scope>--> </dependency> <dependency> <groupid>log4j</groupid> <artifactid>log4j</artifactid> <version>1.2.14</version> <!--<scope>provided</scope>--> </dependency> <!-- global test --> <dependency> <groupid>junit</groupid> <artifactid>junit</artifactid> <version>${junit.version}</version> <scope>test</scope> </dependency> <dependency> <groupid>com.ibm</groupid> <artifactid>ibmpkcs</artifactid> <version>8.0</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</artifactid> <version>2.3.2</version> <configuration> <source>1.8</source> <target>1.8</target> <showdeprecation>${maven.compiler.showdeprecation}</showdeprecation> <showwarnings>${maven.compiler.showwarnings}</showwarnings> <encoding>utf-8</encoding> <debug>${maven.compiler.debug}</debug> <optimize>${maven.compiler.optimize}</optimize> </configuration> </plugin> </build> <properties> <spring.version>4.2.5.release</spring.version> <spring-ws.version>2.4.0.release</spring-ws.version> <spring-security.version>4.0.0.release</spring-security.version> <slf4jversion>1.6.1</slf4jversion> <maven.test.skip>true</maven.test.skip> <junit.version>4.8.2</junit.version> <hibernate.version>3.5.6-final</hibernate.version> </properties>
i using spring 4.2.5.release version
, javassist 3.19.0-ga
version .
and in web app, can see following jar files after installing application on websphere /web-inf/lib
aopalliance-1.0.jar
commons-io-1.4.jar
jcl-over-slf4j-1.6.1.jar
spring-aop-4.2.5.release.jar
spring-expression-4.2.5.release.jar
bcprov-jdk16-1.46.jar
freemarker-2.3.16.jar
log4j-1.2.14.jar
spring-beans-4.2.5.release.jar
spring-web-4.2.5.release.jar
commons-codec-1.4.jar
ibmpkcs-8.0.jar
slf4j-api-1.6.1.jar
spring-context-4.2.5.release.jar
spring-webmvc-4.2.5.release.jar
commons-fileupload-1.2.2.jar
javassist-3.19.0-ga.jar
slf4j-log4j12-1.6.1.jar
spring-core-4.2.5.release.jar
also in web.xml
using org.springframework.aop.framework.javassistapplicationcontext
<context-param> <param-name>contextclass</param-name> <param-value>org.springframework.aop.framework.javassistapplicationcontext</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.contextloaderlistener</listener-class> </listener> <listener> <listenerclass>org.springframework.web.util.log4jconfiglistener</listener-class> </listener>
and in class path /web-inf/classes/org/springframework/aop/framework
have javassist classes .
javassistaopproxy$1.class javassistaopproxy$equalsinterceptor.class javassistaopproxy$javassistmethodinvocation.class javassistaopproxy.class javassistaopproxy$adviseddispatcher.class javassistaopproxy$exproxyfactory.class javassistaopproxy$methodinterceptor.class javassistaopproxyfactory.class javassistaopproxy$compositeinterceptor.class javassistaopproxy$fixedchainstatictargetinterceptor.class javassistaopproxy$staticdispatcher.class javassistapplicationcontext.class javassistaopproxy$dynamicadvisedinterceptor.class javassistaopproxy$hashcodeinterceptor.class javassistaopproxy$unadvisedinterceptor.class
any suggestions on error? have tried following methods
class loader parent last method on server , application
update spring latest version
removed javascript jar files
/web-inf/lib
path
i can't understand error means. explanations , suggestions solve error. working fine in websphere 6 java 1.6
update :
mvn dependency:tree [info] ------------------------------------------------------------------------ [info] [info] --- maven-dependency-plugin:2.8:tree (default-cli) @ myapp-parent --- [info] com.test:myapp-parent:pom:6.2.0 [info] +- commons-logging:commons-logging:jar:1.2:provided [info] +- commons-logging:commons-logging-api:jar:1.1:provided [info] +- org.slf4j:slf4j-api:jar:1.6.1:compile [info] +- org.slf4j:jcl-over-slf4j:jar:1.6.1:compile [info] +- org.slf4j:slf4j-log4j12:jar:1.6.1:compile [info] +- log4j:log4j:jar:1.2.14:compile [info] +- junit:junit:jar:4.8.2:test [info] \- com.ibm:ibmpkcs:jar:8.0:compile [info] [info] ------------------------------------------------------------------------ [info] building web application package 6.2.0 [info] ------------------------------------------------------------------------ [info] [info] --- maven-dependency-plugin:2.8:tree (default-cli) @ myapp-webapp --- [info] com.test:myapp-webapp:war:6.2.0 [info] +- org.springframework:spring-webmvc:jar:4.2.5.release:compile [info] | +- org.springframework:spring-beans:jar:4.2.5.release:compile [info] | +- org.springframework:spring-context:jar:4.2.5.release:compile [info] | | \- org.springframework:spring-aop:jar:4.2.5.release:compile [info] | | \- aopalliance:aopalliance:jar:1.0:compile [info] | +- org.springframework:spring-core:jar:4.2.5.release:compile [info] | +- org.springframework:spring-expression:jar:4.2.5.release:compile [info] | \- org.springframework:spring-web:jar:4.2.5.release:compile [info] +- commons-codec:commons-codec:jar:1.4:compile [info] +- commons-io:commons-io:jar:1.4:compile [info] +- commons-fileupload:commons-fileupload:jar:1.2.2:compile [info] +- javax.servlet:servlet-api:jar:2.5:provided [info] +- org.freemarker:freemarker:jar:2.3.16:compile [info] +- org.springframework:spring-test:jar:4.2.5.release:test [info] +- org.javassist:javassist:jar:3.21.0-ga:compile [info] +- org.bouncycastle:bcprov-jdk16:jar:1.46:compile [info] +- commons-logging:commons-logging:jar:1.2:provided [info] +- commons-logging:commons-logging-api:jar:1.1:provided [info] +- org.slf4j:slf4j-api:jar:1.6.1:compile [info] +- org.slf4j:jcl-over-slf4j:jar:1.6.1:compile [info] +- org.slf4j:slf4j-log4j12:jar:1.6.1:compile [info] +- log4j:log4j:jar:1.2.14:compile [info] +- junit:junit:jar:4.8.2:test [info] \- com.ibm:ibmpkcs:jar:8.0:compile [info] [info] ------------------------------------------------------------------------ [info] building enterprise application package 6.2.0 [info] ------------------------------------------------------------------------ [info] [info] --- maven-dependency-plugin:2.8:tree (default-cli) @ myapp-ear --- [info] com.test:myapp-ear:ear:6.2.0 [info] +- com.test:myapp-webapp:war:6.2.0:compile [info] +- org.slf4j:slf4j-api:jar:1.6.1:provided [info] +- org.slf4j:jcl-over-slf4j:jar:1.6.1:provided [info] +- org.slf4j:slf4j-log4j12:jar:1.6.1:provided [info] +- log4j:log4j:jar:1.2.14:provided [info] +- commons-logging:commons-logging:jar:1.2:provided [info] +- commons-logging:commons-logging-api:jar:1.1:provided [info] +- junit:junit:jar:4.8.2:test [info] \- com.ibm:ibmpkcs:jar:8.0:compile [info] ------------------------------------------------------------------------ [info] reactor summary: [info] [info] application...................................... success [ 9.465 s] [info] web application package ............................ success [ 0.104 s] [info] enterprise application package ..................... success [ 0.044 s] [info] ------------------------------------------------------------------------ [info] build success [info] ------------------------------------------------------------------------ [info] total time: 10.721 s [info] finished at: 2017-09-18t13:33:51+05:30 [info] final memory: 13m/245m [info] ------------------------------------------------------------------------
update
and think problem due javassist file . loading specific class using javassist in code .org.spring.aop.framework.proxycreatorsupport class loaded class loader . getting illegalstateexception , cannot compile exceptions when deploy .ear file websphere .
using classpool.getdefault(), looking information system class path . added class loader handed on transformation method argument. have appended class loader javassist's search path .
package org.spring.aop.framework; import javassist.classpool; import javassist.ctclass; import javassist.ctconstructor; import javassist.loaderclasspath; import org.springframework.web.context.support.xmlwebapplicationcontext; public class javassistapplicationcontext extends xmlwebapplicationcontext { static { classpool classpool = classpool.getdefault(); try { classloader classloader = thread.currentthread().getcontextclassloader(); classpool.appendclasspath(new loaderclasspath(classloader)); ctclass cc = classpool.get("org.spring.aop.framework.proxycreatorsupport"); ctconstructor c = cc.getconstructors()[0]; c.insertafter("$0.aopproxyfactory = new org.spring.aop.framework.javassistaopproxyfactory();"); cc.toclass(); } catch (exception e) { throw new illegalstateexception(e); } } }
it working fine java 1.6 websphere 8 . after update java 8 websphere 9 , getting these kind of exceptions .i think javassist toclass()
causing exceptions in websphere . suggestion ?
Comments
Post a Comment