Announcement Announcement Module
Collapse
No announcement yet.
Classloader issue with BEA WLS8.1 and ContextLoaderListener? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Classloader issue with BEA WLS8.1 and ContextLoaderListener?

    I am developing a spring application for Weblogic Server 8.1SP4. Currently having the following problem:

    Defining ContextLoaderListener in web.xml for reloading resources as following:

    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/envreg-servlet.xml</param-value>
    </context-param>
    <listener>
    <listener-class>org.springframework.web.context.ContextLoade rListener</listener-class>
    </listener>

    results in a classcast exception in development while weblogic automatically redeploys webapp an exploded webapp after recompilation.

    Stacktrace follows:

    java.lang.IllegalStateException: Root context attribute is not of type WebApplicationContext: org.springframework.web.context.support.XmlWebAppl icationContext: display name [Root WebApplicationContext]; startup date [Wed Jul 27 10:37:34 EEST 2005]; root of context hierarchy; config locations [/WEB-INF/bug-servlet.xml]
    at org.springframework.web.context.support.WebApplica tionContextUtils.getWebApplicationContext(WebAppli cationContextUtils.java:64)
    at org.springframework.web.servlet.FrameworkServlet.i nitWebApplicationContext(FrameworkServlet.java:249 )
    at org.springframework.web.servlet.FrameworkServlet.i nitServletBean(FrameworkServlet.java:219)
    at org.springframework.web.servlet.HttpServletBean.in it(HttpServletBean.java:111)
    at javax.servlet.GenericServlet.init(GenericServlet.j ava:258)
    at weblogic.servlet.internal.ServletStubImpl$ServletI nitAction.run(ServletStubImpl.java:1028)
    at weblogic.security.acl.internal.AuthenticatedSubjec t.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(Se curityManager.java:121)
    at weblogic.servlet.internal.ServletStubImpl.createSe rvlet(ServletStubImpl.java:904)
    ...

    I have provided a minimal testcase for the issue which can be downloaded from http://ivo.webmedia.ee/bug.zip

    Steps to reproduce:

    1. Have a Weblogic Server 8.1SP4 running in development mode.
    2. unzip bug.zip
    3. deploy war folder (exploded .war file)
    4. Open browser for URL http://localhost:7001/bug/. You should see a "Hello world" message.
    5. Change ee.bug.HelloController.java file and recompile it to the WEB-INF/classes folder. ant compile target should do it.
    6. Refresh the browser window. Stacktrace should be displayed to you.

    Alternate scenarios:

    - redeploy webapp from weblogic console before hitting the URL - everything works
    - remove following from the web.xml. Now everything works even without redeployment from console.
    <listener>
    <listener-class>
    org.springframework.web.context.ContextLoaderListe ner
    </listener-class>
    </listener>
    - put to the server's classpath all the supporting libraries from WEB-INF/lib (common-log, spring, jstl) and remove those from WEB-INF/lib. Everything works now.

    Business effect for the issue: notable development slowdown due to the need of manual redeployment after each change in class files.

    I have previously opened a case in BEA support environment, but their claim was it to be a spring problem, most likely a classloader issue (inforrect static reference somewhere?)

    Case can be reproduced with at least Spring versions 1.2.2 and 1.2.3

  • #2
    Same behaviour with spring sample applications

    - tried countries sample application - after switching the sample app also to the exploded format (slightly modifying build scripts as compiling everything to the WEB-INF/classes and removing counties.jar from WEB-INF/lib) the same exception occured:

    java.lang.IllegalStateException: Root context attribute is not of type WebApplicationContext: org.springframework.web.context.support.XmlWebAppl icationContext: display name [Root WebApplicationContext]; startup date [Wed Jul 27 12:05:51 EEST 2005]; root of context hierarchy; config locations [/WEB-INF/applicationContext.xml]
    at org.springframework.web.context.support.WebApplica tionContextUtils.getWebApplicationContext(WebAppli cationContextUtils.java:64)
    at org.springframework.web.servlet.FrameworkServlet.i nitWebApplicationContext(FrameworkServlet.java:249 )
    at org.springframework.web.servlet.FrameworkServlet.i nitServletBean(FrameworkServlet.java:219)
    at org.springframework.web.servlet.HttpServletBean.in it(HttpServletBean.java:111)
    at javax.servlet.GenericServlet.init(GenericServlet.j ava:258)
    at weblogic.servlet.internal.ServletStubImpl$ServletI nitAction.run(ServletStubImpl.java:1028)
    at weblogic.security.acl.internal.AuthenticatedSubjec t.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(Se curityManager.java:121)
    at weblogic.servlet.internal.ServletStubImpl.createSe rvlet(ServletStubImpl.java:904)
    at weblogic.servlet.internal.ServletStubImpl.createIn stances(ServletStubImpl.java:883)
    at weblogic.servlet.internal.ServletStubImpl.prepareS ervlet(ServletStubImpl.java:822)

    Comment


    • #3
      Works with Tomcat 5.0.28

      Seems like an issue related to WLS 8.1 classloading and spring initialization - checked the provided code with tomcat 5.0.28 with automatic redeployment flags turned on and it works.

      Comment


      • #4
        No reply within a week from neither vendor

        Groovy - prefectly clear reproducible issue and:

        - one of the market leaders in J2EE container market with possible classloader issue - no reply
        - one of the most used frameworks in market with possible classloader issue - no reply

        It's a wonderful world.

        Comment


        • #5
          Please can you raise a JIRA issue for this. Unfortunately, many bug repots get missed on here - and your post doesn't show up as an unanswered post which means many people will have missed it. The best way to get a bug addressed it to post to JIRA.

          Also, make sure that you don't have multiple versions of the spring.jar on your classpath - this is a common cause of issues such as this.

          Regards,

          Rob

          Comment


          • #6
            Posted a JIRA issue SPR-1217

            Posted a JIRA issue SPR-1217

            Comment

            Working...
            X