Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-16019

javassit linkage error with spring-aop while deploying on websphere java 8

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Invalid
    • Affects Version/s: 4.3.5
    • Fix Version/s: None
    • Component/s: Core:AOP
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      I have tried to deploy JDK1.8 compatible .EAR file on websphere java 8 . I am getting following exception

      Caused by: java.lang.IllegalStateException: javassist.CannotCompileException: by java.lang.LinkageError: org.springframework.aop.framework.ProxyCreatorSupport
              at org.springframework.aop.framework.JavassistApplicationContext.<clinit>(JavassistApplicationContext.java:61)
              ... 114 more
      Caused by: javassist.CannotCompileException: by java.lang.LinkageError: org.springframework.aop.framework.ProxyCreatorSupport
              at javassist.ClassPool.toClass(ClassPool.java:1120)
              at javassist.ClassPool.toClass(ClassPool.java:1063)
              at javassist.ClassPool.toClass(ClassPool.java:1021)
              at javassist.CtClass.toClass(CtClass.java:1259)
              at org.springframework.aop.framework.JavassistApplicationContext.<clinit>(JavassistApplicationContext.java:59)
              ... 114 more
      Caused by: java.lang.LinkageError: org.springframework.aop.framework.ProxyCreatorSupport
              at java.lang.ClassLoader.defineClassImpl(Native Method)
              at java.lang.ClassLoader.defineClass(ClassLoader.java:346)
              at java.lang.ClassLoader.defineClass(ClassLoader.java:283)
              at sun.reflect.GeneratedMethodAccessor17.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
              at java.lang.reflect.Method.invoke(Method.java:508)
              at javassist.ClassPool.toClass2(ClassPool.java:1133)
              at javassist.ClassPool.toClass(ClassPool.java:1114)
              ... 118 more    
      

      I am using spring

      <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>
      

      and javassit

      <!-- Javassist -->
              <dependency>
                  <groupId>javassist</groupId>
                  <artifactId>javassist</artifactId>
                  <version>3.19.0-GA</version>
              </dependency>
      

      But when i deploy same application on JDK 1.6 , it was working fine with out any exception error .

      I am getting errors on

      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);
              }
          }
      }
      

      Any idea ? Anything i am missing ?

        Attachments

          Activity

            People

            Assignee:
            juergen.hoeller Juergen Hoeller
            Reporter:
            vkp vkp
            Last updater:
            Spring Issues Spring Issues
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              3 years, 29 weeks, 6 days ago