5 Replies Latest reply: Jan 6, 2011 1:06 AM by 828304 RSS

    Spring java.lang.IllegalAccessError: tried to access method org.springframe

    117480
      Hi

      I am looking to use OEPE to allow me to adapt a RAD approach to the web part of our applications while keeping our CI builds consistant.

      We use WebLogic 10.3 with struts 1.2.9, Spring 2.5, Hibernate 3.X and maven 2.

      I am using Eclipse 3.5 SR1 with OEPE version Oracle Enterprise Pack for Eclipse 11.1.1.3.0

      I created a test Dynamic Web Application using maven 2 and this works OK with a test WebLogic Server 10.3. I then deleted this from the WebLogic Server so I could try using it with OEPE.

      I deploy this Dynamic Web Application using OEPE (via autogenerated_ear_) to WebLogic Server

      My initial problems were classpath errors where it seems that my Maven dependent jars were NOT picked up by my web application. To overcome this I copied the maven dependencies to <my web app>\src\main\webapp\WEB-INF\lib

      I could then use my initial struts action but failed with:

      Root cause of ServletException.
      java.lang.IllegalAccessError: tried to access method org.springframework.web.struts.ActionSupport.getWebApplicationContext()Lorg/springframework/web/context/WebApplicationContext; from class com.myco.springtxn.web.struts.SaveNewCakeAction_beaVersion0_7
           at com.myco.springtxn.web.struts.SaveNewCakeAction_beaVersion0_7.execute(SaveNewCakeAction.java:31)
           at com.myco.springtxn.web.struts.SaveNewCakeAction.execute(SaveNewCakeAction.java)

           CakeService cakeService = (CakeService) getWebApplicationContext().getBean("cakeService");

      Some more data:
      TRACE:
      Saving Cake with name oepe cake and description copied in jars
      <24-Oct-2009 21:13:16 o'clock BST> <Error> <HTTP> <BEA-101017> <[weblogic.servlet.internal.WebAppServletContext@d9f6cb - appName: '_auto_generated_ear_', name: 'sdw', context-path: '/sdw', spec-version: '2.5', request: weblogic.servlet.internal.ServletRequestImpl@148bedb[
      POST /sdw/saveNewCake.do HTTP/1.1
      Accept: */*
      Referer: http://localhost:7001/sdw/enterCake.do
      Accept-Language: en-gb
      Content-Type: application/x-www-form-urlencoded
      UA-CPU: x86
      Accept-Encoding: gzip, deflate
      User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; NGD_build; .NET CLR 1.1.4322; .NET CLR 2.0.50727; MS-RTC LM 8; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
      Content-Length: 41
      Connection: Keep-Alive
      Cache-Control: no-cache
      Cookie: refresh=; JSESSIONID=dG4BKjLBdL3LWMPkJG3r1Tw64hjpBMWwvplvypkGZlTYhb6cJD9M!-36198065; ADMINCONSOLESESSION=7gyTKjLQgQfNlPlQ1cBydQXgHcgljjQn8tnHL4Qn5GWr8pLWZG0W!1523650153

      ]] Root cause of ServletException.
      java.lang.IllegalAccessError: tried to access method org.springframework.web.struts.ActionSupport.getWebApplicationContext()Lorg/springframework/web/context/WebApplicationContext; from class com.myco.springtxn.web.struts.SaveNewCakeAction_beaVersion0_7
           at com.myco.springtxn.web.struts.SaveNewCakeAction_beaVersion0_7.execute(SaveNewCakeAction.java:31)
           at com.myco.springtxn.web.struts.SaveNewCakeAction.execute(SaveNewCakeAction.java)
           at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
           at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
           at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
           at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
           at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
           at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
           at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
           at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
           at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
           at weblogic.servlet.utils.FastSwapFilter.doFilter(FastSwapFilter.java:66)
           at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
           at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3496)
           at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
           at weblogic.security.service.SecurityManager.runAs(Unknown Source)
           at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
           at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
           at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
           at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
           at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
      >

      I AM USING;
      1. Operating System - Windows XP Professional
      2. Eclipse Version - 3.5.1
      3. WLS Version - 10.3
      4. Brief app shape description. Dynamic Web App
      5. The .classpath a
      <?xml version="1.0" encoding="UTF-8"?>
      <classpath>
           <classpathentry kind="src" output="target/classes" path="src/main/java"/>
           <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
           <classpathentry kind="con" path="oracle.eclipse.tools.weblogic.lib.system">
                <attributes>
                     <attribute name="owner.project.facets" value="jst.web"/>
                </attributes>
           </classpathentry>
           <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
           <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
           <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Spring2.5">
                <attributes>
                     <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
                     <attribute name="owner.project.facets" value="oracle.struts;spring.core"/>
                </attributes>
           </classpathentry>
           <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Struts">
                <attributes>
                     <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
                     <attribute name="owner.project.facets" value="oracle.struts"/>
                </attributes>
           </classpathentry>
           <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
           <classpathentry kind="output" path="target/classes"/>
      </classpath>

      web app cache
      <webapp-structure>
      <registeredFiles>
      <entry>
      <string>currentBuild</string>
      <path-set>
      <pathsSet class="linked-hash-set">
      <string>index.jsp</string>
      <string>META-INF/MANIFEST.MF</string>
      <string>pages/cakeSavedInfo.jsp</string>
      <string>pages/enterCake.jsp</string>
      <string>pages/welcome.jsp</string>
      <string>WEB-INF/applicationContext.xml</string>
      <string>WEB-INF/config/struts-config.xml</string>
      <string>WEB-INF/tld/c.tld</string>
      <string>WEB-INF/tld/fmt.tld</string>
      <string>WEB-INF/tld/struts-bean.tld</string>
      <string>WEB-INF/tld/struts-html-el.tld</string>
      <string>WEB-INF/tld/struts-html.tld</string>
      <string>WEB-INF/tld/struts-logic.tld</string>
      <string>WEB-INF/tld/struts-tiles.tld</string>
      <string>WEB-INF/web.xml</string>
      <string>WEB-INF/weblogic.xml</string>
      <string>WEB-INF/classes/com/myco/springtxn/web/controller/CakeController.class</string>
      <string>WEB-INF/classes/com/myco/springtxn/web/controller/spring/AnnotatedSpringCakeController.class</string>
      <string>WEB-INF/classes/com/myco/springtxn/web/struts/CakeForm.class</string>
      <string>WEB-INF/classes/com/myco/springtxn/web/struts/EnterNewCakeAction.class</string>
      <string>WEB-INF/classes/com/myco/springtxn/web/struts/SaveNewCakeAction.class</string>
      <string>WEB-INF/classes/com/myco/springtxn/web/util/Logging.class</string>
      <string>WEB-INF/lib/SpringTxnServices-0.0.1-SNAPSHOT.jar</string>
      <string>WEB-INF/lib/spring-2.5.6.jar</string>
      <string>WEB-INF/lib/commons-logging-1.0.4.jar</string>
      <string>WEB-INF/lib/commons-lang-2.4.jar</string>
      <string>WEB-INF/lib/hibernate-core-3.3.1.GA.jar</string>
      <string>WEB-INF/lib/antlr-2.7.2.jar</string>
      <string>WEB-INF/lib/commons-collections-3.1.jar</string>
      <string>WEB-INF/lib/dom4j-1.6.1.jar</string>
      <string>WEB-INF/lib/xml-apis-1.0.b2.jar</string>
      <string>WEB-INF/lib/jta-1.1.jar</string>
      <string>WEB-INF/lib/slf4j-api-1.5.2.jar</string>
      <string>WEB-INF/lib/hibernate-annotations-3.4.0.GA.jar</string>
      <string>WEB-INF/lib/ejb3-persistence-1.0.2.GA.jar</string>
      <string>WEB-INF/lib/hibernate-commons-annotations-3.1.0.GA.jar</string>
      <string>WEB-INF/lib/hibernate-entitymanager-3.4.0.GA.jar</string>
      <string>WEB-INF/lib/javassist-3.4.GA.jar</string>
      <string>WEB-INF/lib/hibernate-validator-3.1.0.GA.jar</string>
      <string>WEB-INF/lib/slf4j-log4j12-1.5.2.jar</string>
      <string>WEB-INF/lib/log4j-1.2.14.jar</string>
      <string>WEB-INF/lib/SpringLegacyModule-0.0.1-SNAPSHOT.jar</string>
      <string>WEB-INF/lib/struts-1.2.9.jar</string>
      <string>WEB-INF/lib/commons-beanutils-1.7.0.jar</string>
      <string>WEB-INF/lib/commons-digester-1.6.jar</string>
      <string>WEB-INF/lib/commons-fileupload-1.0.jar</string>
      <string>WEB-INF/lib/commons-validator-1.1.4.jar</string>
      <string>WEB-INF/lib/oro-2.0.7.jar</string>
      <string>WEB-INF/lib/xalan-2.5.1.jar</string>
      <string>WEB-INF/lib/struts-el-1.2.9.jar</string>
      <string>WEB-INF/lib/standard-1.0.6.jar</string>
      <string>WEB-INF/lib/jstl-1.1.2.jar</string>
      <string>WEB-INF/lib/spring-webmvc-struts-2.5.6.jar</string>
      <string>WEB-INF/lib/spring-beans-2.5.6.jar</string>
      <string>WEB-INF/lib/spring-core-2.5.6.jar</string>
      <string>WEB-INF/lib/spring-context-2.5.6.jar</string>
      <string>WEB-INF/lib/aopalliance-1.0.jar</string>
      <string>WEB-INF/lib/spring-web-2.5.6.jar</string>
      <string>WEB-INF/lib/spring-webmvc-2.5.6.jar</string>
      <string>WEB-INF/lib/spring-context-support-2.5.6.jar</string>
      </pathsSet>
      </path-set>
      </entry>
      </registeredFiles>
      </webapp-structure>
        • 1. Re: Spring java.lang.IllegalAccessError: tried to access method org.springframe
          117480
          SORTED

          The problem was that I was not creating the project using http://docs.codehaus.org/display/M2ECLIPSE/WTP+mini+howto which is important if you are using maven and an eclipse distro based on WTP (which OEPE is).

          Edited by: hickssp on 02-Nov-2009 14:45
          • 3. Re: Spring java.lang.IllegalAccessError: tried to access method org.springframe
            117480
            Problem will occur if fast-swap is enabled
            • 4. Re: Spring java.lang.IllegalAccessError:  - FastSwop problem
              117480
              Got back to testing this (been busy in my day job). I realised that I had not tested hot deployment. So I switched on FastSwop by adding the following the the weblogic.xml (of the web applicatiion):

              Gives

              Accept-Encoding: gzip, deflate
              User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; NGD_build; .NET CLR 1.1.4322; .NET CLR 2.0.50727; MS-RTC LM 8; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
              Content-Length: 22
              Connection: Keep-Alive
              Cache-Control: no-cache
              Cookie: JSESSIONID=T6PTK7yS3jdJzzLsP5nNB6TNCyLFMcYxZf8j1rRRGBXZ8hSbBQT2!580994594

              ]] Root cause of ServletException.
              java.lang.IllegalAccessError: tried to access method org.springframework.web.struts.ActionSupport.getWebApplicationContext()Lorg/springframework/web/context/WebApplicationContext; from class com.myco.springtxn.web.struts.SaveNewCakeAction_beaVersion0_8
                   at com.myco.springtxn.web.struts.SaveNewCakeAction_beaVersion0_8.execute(SaveNewCakeAction.java:31)
                   at com.myco.springtxn.web.struts.SaveNewCakeAction.execute(SaveNewCakeAction.java)
                   at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
                   at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
                   at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
                   Truncated. see log file for complete stacktrace
              >

              I find this sad since using tomcat I can hot deploy without any problem
              • 5. Re: Spring java.lang.IllegalAccessError:  - FastSwop problem
                828304
                Hi,
                Have same problem.

                Now the error occure
                init:
                deps-module-jar:
                deps-ear-jar:
                deps-jar:
                library-inclusion-in-archive:
                library-inclusion-in-manifest:
                compile:
                compile-jsps:
                In-place deployment at D:\javaprg\projects\MyService\build\web
                D:\javaprg\projects\MyService\build\web\META-INF\context.xml (The system cannot find the file specified)
                D:\javaprg\projects\MyService\nbproject\build-impl.xml:687: The module has not been deployed.
                BUILD FAILED (total time: 0 seconds)