Topic
8 replies Latest Post - ‏2012-11-05T20:42:53Z by bwa
BernardChatin
BernardChatin
1 Post
ACCEPTED ANSWER

Pinned topic Error porting spring/maven from tomcat 7 to WAS8.5 Liberty Profile

‏2012-01-06T15:14:35Z |
Hello,

I run into run-time exceptions when testing in WAS 8.5.1LP a basic spring/maven application that currently works in Tomcat 7 : javax.servlet.ServletException: Filter CharacterEncodingFilter: could not be loaded

Java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
at org.apache.commons.logging.impl.SLF4JLocationAwareLog.debug(SLF4JLocationAwareLog.java:133)
at org.springframework.core.env.AbstractEnvironment.<init>(AbstractEnvironment.java:100)
at org.springframework.core.env.StandardEnvironment.<init>(StandardEnvironment.java:54)
at org.springframework.web.context.support.StandardServletEnvironment.<init>(StandardServletEnvironment.java:43)
at org.springframework.web.filter.GenericFilterBean.<init>(GenericFilterBean.java:94)
at org.springframework.web.filter.OncePerRequestFilter.<init>(OncePerRequestFilter.java:40)
at org.springframework.web.filter.CharacterEncodingFilter.<init>(CharacterEncodingFilter.java:43)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at java.beans.Beans.instantiate(Beans.java:204)
at java.beans.Beans.instantiate(Beans.java:48)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:524)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:466)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterInstanceWrapper(WebAppFilterManager.java:305)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:377)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:883)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1016)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3914)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
at com.ibm.ws.webcontainer.osgi.VirtualHost.handleRequest(VirtualHost.java:213)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:944)
at com.ibm.ws.webcontainer.osgi.WebContainer$1.run(WebContainer.java:1022)
at com.ibm.ws.dispatcher.http.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:310)
at com.ibm.ws.threading.internal.Worker.executeWork(Worker.java:398)
at com.ibm.ws.threading.internal.Worker.run(Worker.java:380)
at java.lang.Thread.run(Thread.java:662)

Seems that the issue is related to a conflict between jar versions of slf4j-simple-1.5.8.jar used by WAS and those embedded in my war archive slf4j-simple-1.6.2.jar (tomcat doesn't actually embedd those libs).

Do you know if there is a workaround on the server side to support those newer library versions or is it necessary to modify the web application to match WAS 8.5.1 LP embedded versions ?

Regards
Bernard

P.S : detailed ffdc traces are available if needed
  • XNF0_Duane_Appleby
    XNF0_Duane_Appleby
    3 Posts
    ACCEPTED ANSWER

    Re: Error porting spring/maven from tomcat 7 to WAS8.5 Liberty Profile

    ‏2012-08-21T12:10:06Z  in response to BernardChatin
    This sounds like a known problem which has a temporary workaround. Try setting an empty classloader element in the application element within your server.xml. For example:

    <application id="my_app_id" name="my_app_name" type="war" location="my_app.war">
    <classloader/>
    </application>

    This should enforce the correct classloading restrictions to take affect.
    • bwa
      bwa
      47 Posts
      ACCEPTED ANSWER

      Re: Error porting spring/maven from tomcat 7 to WAS8.5 Liberty Profile

      ‏2012-10-29T11:50:57Z  in response to XNF0_Duane_Appleby
      I also experiences this kind of error with a Spring 3.0.5 application, but the xml change did not work for me

      <application id="tomcat-web" location="tomcat-web.war" name="tomcat-web" type="war">
      <classloader/>
      </application>

      And still get :

      Exception caught while initializing context: java.lang.NoSuchMethodError: org/slf4j/spi/LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
      at org.apache.commons.logging.impl.SLF4JLocationAwareLog.info(SLF4JLocationAwareLog.java:159)
      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:187)
      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)

      /bwa
      • bwa
        bwa
        47 Posts
        ACCEPTED ANSWER

        Re: Error porting spring/maven from tomcat 7 to WAS8.5 Liberty Profile

        ‏2012-10-29T12:01:58Z  in response to bwa
        This did the job ....

        <application id="tomcat-web" location="tomcat-web.war" name="tomcat-web" type="war">
        <classloader delegation="parentLast"/>
        </application>
        /bwa
        • SystemAdmin
          SystemAdmin
          590 Posts
          ACCEPTED ANSWER

          Re: Error porting spring/maven from tomcat 7 to WAS8.5 Liberty Profile

          ‏2012-11-02T15:37:55Z  in response to bwa
          Hi,

          When you updated the configuration originally to have a <classloader /> did you do a clean start of the server? Some classloader changes are, incorrectly, only picked up after a clean start of the server and I believe this might be one of them.

          In any case we have released 8.5.0.1 which fixes the bug that your switch to parent last classloading was working around. If you could try again with 8.5.0.1 I would be interested to know if your application works without the classloader configuration.

          Thanks
          Alasdair
          • bwa
            bwa
            47 Posts
            ACCEPTED ANSWER

            Re: Error porting spring/maven from tomcat 7 to WAS8.5 Liberty Profile

            ‏2012-11-05T06:44:16Z  in response to SystemAdmin
            Are you talking about the refreshed next alpha ? or the initial next alpha ?

            /bwa
            • bwa
              bwa
              47 Posts
              ACCEPTED ANSWER

              Re: Error porting spring/maven from tomcat 7 to WAS8.5 Liberty Profile

              ‏2012-11-05T06:55:50Z  in response to bwa
              anyway, I deployed it on the initial next alpha, and here it worked without changing the classloader.

              /bwa
              • SystemAdmin
                SystemAdmin
                590 Posts
                ACCEPTED ANSWER

                Re: Error porting spring/maven from tomcat 7 to WAS8.5 Liberty Profile

                ‏2012-11-05T17:39:28Z  in response to bwa
                Hi,
                The fix is actually in both drivers - 8.5.0.1 (current GA release) and 8.5.next alpha. Thanks for confirming that this addresses the issue!
                Regards, Alex.
                • bwa
                  bwa
                  47 Posts
                  ACCEPTED ANSWER

                  Re: Error porting spring/maven from tomcat 7 to WAS8.5 Liberty Profile

                  ‏2012-11-05T20:42:53Z  in response to SystemAdmin
                  Updated my wlp-developer jar 8.5.0.0 to 8.5.0.1 and now the problem is gone here too ....

                  /bwa