Results 1 to 6 of 6

Thread: Classloader issue with BEA WLS8.1 and ContextLoaderListener?

  1. #1
    Join Date
    Jul 2005
    Location
    Estonia
    Posts
    8

    Default 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. #2
    Join Date
    Jul 2005
    Location
    Estonia
    Posts
    8

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

  3. #3
    Join Date
    Jul 2005
    Location
    Estonia
    Posts
    8

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

  4. #4
    Join Date
    Jul 2005
    Location
    Estonia
    Posts
    8

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

  5. #5
    Join Date
    Aug 2004
    Location
    Southampton, UK
    Posts
    826

    Default

    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
    Rob Harrop
    Lead Engineer, dm Server
    SpringSource
    http://www.springsource.com

    Co-Author - Pro Spring

  6. #6
    Join Date
    Jul 2005
    Location
    Estonia
    Posts
    8

    Default Posted a JIRA issue SPR-1217

    Posted a JIRA issue SPR-1217

Similar Threads

  1. Replies: 6
    Last Post: Jan 11th, 2008, 07:36 AM
  2. Bizzare ClassLoader issue in Java WebStart?
    By timothygordon32 in forum Container
    Replies: 1
    Last Post: Sep 6th, 2005, 05:19 AM
  3. ClassLoader issue ! - Need Help
    By pkkishore in forum Container
    Replies: 11
    Last Post: Jun 3rd, 2005, 05:57 AM
  4. JMX / Tomcat / ClassLoader problem?
    By charlesb in forum Container
    Replies: 6
    Last Post: Apr 4th, 2005, 06:58 PM
  5. Replies: 3
    Last Post: Dec 8th, 2004, 10:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •