2 Replies Latest reply on Jan 18, 2009 5:11 PM by robert lazarski

    Strange classloader problems

    robert lazarski Newbie

      Hi all,

      I'm porting our production app from jboss 4.0.5 to jboss 5. I have an expanded war that I put in server/default/deploy. I defined this listener:

      <listener>
       <listener-class>com.wazollc.alphatheory.session.SessionListener</listener-class>
      </listener>
      


      That I'm %100 sure is in the classpath, defined here:

      /programs/jboss-5.0.0.GA/server/default/deploy/alphatheoryServicesDev/WEB-INF/classes/com/wazollc/alphatheory/session/SessionListener.class
      


      Yet I get this error:

      2009-01-18 11:06:37,536 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/web.xml]] Error configuring application listener of class com.wazollc.alphatheory.session.SessionListener
      java.lang.ClassNotFoundException: com.wazollc.alphatheory.session.SessionListener
       at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
      


      If I comment out the above listener, I have even stranger problems with spring (not jboss spring as for now I'm just porting) that is also classpath related. This definition:

      <context-param>
       <param-name>contextConfigLocation</param-name>
       <param-value>/WEB-INF/springMVC-servlet.xml</param-value>
      </context-param>
      


      Gives this error:
      2009-01-18 11:19:42,115 ERROR [org.springframework.web.context.ContextLoader] Context initialization failed
      org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/springMVC-servlet.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/springMVC-servlet.xml]
      


      That file is definitely there, because adding an absolute path finds the file:
      <context-param>
       <param-name>contextConfigLocation</param-name>
       <param-value>file:///programs/jboss-5.0.0.GA/server/default/deploy/alphatheoryServicesDev/WEB-INF/springMVC-servlet.xml</param-value>
       </context-param>
      


      But then gives ClassNotFoundException for all my beans defined, For example:
      2009-01-18 11:23:54,040 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Ignoring bean class loading failure for bean 'byteMailer'
      org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.wazollc.alphatheory.spring.ByteMailer] for bean with name 'byteMailer' defined in URL [file:/programs/jboss-5.0.0.GA/server/default/deploy/alphatheoryServicesDev/WEB-INF/springMVC-servlet.xml]; nested exception is java.lang.ClassNotFoundException: com.wazollc.alphatheory.spring.ByteMailer
      


      Thats really weird!!! I spent the last two days googling and reading the jboss classloader docs, and after trying everything I'm stuck. Please help! My entire web.xml is:

      <?xml version="1.0" encoding="ISO-8859-1"?>
      
      <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
       version="2.4">
      
       <!-- Note: The servlets/filters referenced here are documented in the SDK javadoc -->
      
       <!-- General description of your web application -->
       <display-name>isomorphic</display-name>
       <description>Isomorphic SmartClient</description>
      
       <filter>
       <filter-name>UrlRewriteFilter</filter-name>
       <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
       </filter>
       <filter-mapping>
       <filter-name>UrlRewriteFilter</filter-name>
      
       <url-pattern>/*</url-pattern>
       <!--
       <url-pattern>/*</url-pattern>
       -->
       </filter-mapping>
      
       <!-- acegi security -->
       <filter>
       <filter-name>Acegi Filter Chain Proxy</filter-name>
       <filter-class>org.acegisecurity.util.FilterToBeanProxy</filter-class>
       <init-param>
       <param-name>targetClass</param-name>
       <param-value>org.acegisecurity.util.FilterChainProxy</param-value>
       <!-- use FilterChainProxy for basic auth
       <param-value>org.acegisecurity.ui.webapp.AuthenticationProcessingFilter</param-value>
       -->
       </init-param>
       </filter>
      
       <filter-mapping>
       <filter-name>Acegi Filter Chain Proxy</filter-name>
       <url-pattern>/*</url-pattern>
       </filter-mapping>
      
       <!-- filters added by Robert -->
       <filter>
       <filter-name>hibernate</filter-name>
       <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
       <init-param>
       <param-name>singleSession</param-name>
       <param-value>true</param-value>
       </init-param>
       <init-param>
       <param-name>sessionFactoryBeanName</param-name>
       <param-value>mySessionFactory</param-value>
       </init-param>
       </filter>
      
       <filter-mapping>
       <filter-name>hibernate</filter-name>
       <url-pattern>*.form</url-pattern>
       </filter-mapping>
      
       <filter-mapping>
       <filter-name>hibernate</filter-name>
       <url-pattern>*.jsp</url-pattern>
       </filter-mapping>
       <!-- end filters added by Robert -->
      
      
       <filter>
       <filter-name>CompressionFilter</filter-name>
       <filter-class>com.isomorphic.servlet.CompressionFilter</filter-class>
       </filter>
      
       <filter-mapping>
       <filter-name>CompressionFilter</filter-name>
       <url-pattern>/*</url-pattern>
       </filter-mapping>
      
      
       <jsp-config>
      
       <taglib>
       <taglib-uri>/spring</taglib-uri>
       <taglib-location>/WEB-INF/spring.tld</taglib-location>
       </taglib>
      
       <!-- Isomorphic JSP tags -->
       <taglib>
       <taglib-uri>isomorphic</taglib-uri>
       <taglib-location>/WEB-INF/iscTaglib.xml</taglib-location>
       </taglib>
      
       <!-- Serve *.isc files with iscHeader/iscFooter -->
       <jsp-property-group>
       <url-pattern>*.isc</url-pattern>
       <el-ignored>true</el-ignored>
       <include-prelude>/shared/jsp/iscHeader.jsp</include-prelude>
       <include-coda>/shared/jsp/iscFooter.jsp</include-coda>
       </jsp-property-group>
      
       <!-- Process *.rpc files as RPC requests - puts you in an iterator over current RPC requests -->
       <jsp-property-group>
       <url-pattern>*.rpc</url-pattern>
       <include-prelude>/shared/jsp/rpcHeader.jsp</include-prelude>
       <include-coda>/shared/jsp/rpcFooter.jsp</include-coda>
       </jsp-property-group>
      
       <jsp-property-group>
       <url-pattern>*.jsp</url-pattern>
       <el-ignored>true</el-ignored>
       </jsp-property-group>
       <jsp-property-group>
       <url-pattern>/shared/ds/*</url-pattern>
       </jsp-property-group>
       <jsp-property-group>
       <url-pattern>/democonfig/*</url-pattern>
       </jsp-property-group>
       </jsp-config>
      
       <!-- The IDACall servlet handles all Built-in DataSource operations -->
       <servlet>
       <servlet-name>IDACall</servlet-name>
       <servlet-class>com.isomorphic.servlet.IDACall</servlet-class>
       </servlet>
      
       <servlet>
       <servlet-name>XMLSelect</servlet-name>
       <servlet-class>com.isomorphic.xml.XMLSelectServlet</servlet-class>
       </servlet>
      
       <!-- The FileDownload servlet downloads static files, like a webserver -->
      
       <servlet>
       <servlet-name>FileDownload</servlet-name>
       <servlet-class>com.isomorphic.servlet.FileDownload</servlet-class>
       <init-param>
       <param-name>expires</param-name>
       <param-value>text/javascript:10368000,image/gif:10368000,image/jpg:10368000,image/jpeg:10368000,image/png:10368000,text/css:10368000,image/vnd.microsoft.icon:10368000</param-value>
       </init-param>
       </servlet>
      
      
       <!-- ISC init: initializes ISC framework -->
       <servlet>
       <servlet-name>Init</servlet-name>
       <servlet-class>com.isomorphic.base.Init</servlet-class>
       <load-on-startup>1</load-on-startup>
       </servlet>
      
       <!-- The PreCache servlet initializes when the servlet engine starts up and pre-loads
       data need for all client requests. This is optional, and improves performance
       of the first few page requests. PreCache cannot be invoked by a browser, because
       there is no "servlet-mapping" defined for it. -->
       <servlet>
       <servlet-name>PreCache</servlet-name>
       <servlet-class>com.isomorphic.servlet.PreCache</servlet-class>
       <load-on-startup>2</load-on-startup>
       </servlet>
      
       <servlet>
       <servlet-name>FileAssembly</servlet-name>
       <servlet-class>com.isomorphic.servlet.FileAssembly</servlet-class>
       </servlet>
      
       <servlet-mapping>
       <servlet-name>FileAssembly</servlet-name>
       <url-pattern>/js/at_js_static.js</url-pattern>
       </servlet-mapping>
      
       <servlet>
       <servlet-name>springMVC</servlet-name>
       <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
       <load-on-startup>1</load-on-startup>
       </servlet>
      
       <display-name>Apache-Axis2</display-name>
       <servlet>
       <servlet-name>AxisServlet</servlet-name>
       <servlet-class>org.apache.axis2.transport.http.AxisServlet</servlet-class>
       <!--<init-param>-->
       <!--<param-name>axis2.xml.path</param-name>-->
       <!--<param-value>/WEB-INF/conf/axis2.xml</param-value>-->
       <!--<param-name>axis2.xml.url</param-name>-->
       <!--<param-value>http://localhot/myrepo/axis2.xml</param-value>-->
       <!--<param-name>axis2.repository.path</param-name>-->
       <!--<param-value>/WEB-INF</param-value>-->
       <!--<param-name>axis2.repository.url</param-name>-->
       <!--<param-value>http://localhot/myrepo</param-value>-->
       <!--</init-param>-->
       <load-on-startup>1</load-on-startup>
       </servlet>
       <servlet>
       <servlet-name>AxisAdminServlet</servlet-name>
       <servlet-class>
       org.apache.axis2.transport.http.AxisAdminServlet</servlet-class>
       </servlet>
       <servlet>
       <servlet-name>HSQLInit</servlet-name>
       <servlet-class>
       com.wazollc.alphatheory.hsql.HSQLInit
       </servlet-class>
       <init-param>
       <param-name>hsql-inserts-file</param-name>
       <param-value>hsql-auto-create-atdev-db.sql</param-value>
       </init-param>
       <load-on-startup>-1</load-on-startup>
       </servlet>
       <servlet>
       <servlet-name>ATInit</servlet-name>
       <servlet-class>
       com.wazollc.alphatheory.sunguard.ATInit
       </servlet-class>
       <init-param>
       <param-name>init-time</param-name>
       <param-value>60</param-value>
       </init-param>
       <load-on-startup>2</load-on-startup>
       </servlet>
       <servlet>
       <servlet-name>ExportDataServlet</servlet-name>
       <servlet-class>
       com.wazollc.alphatheory.exports.ExportDataServlet
       </servlet-class>
       <load-on-startup>1</load-on-startup>
       </servlet>
      
       <!-- FEED RSS2
       -->
       <servlet>
       <servlet-name>FeedServlet</servlet-name>
       <servlet-class>com.wazollc.alphatheory.feed.FeedServlet</servlet-class>
       <init-param>
       <param-name>default.feed.type</param-name>
       <param-value>rss_2.0</param-value>
       </init-param>
       <load-on-startup>1</load-on-startup>
       </servlet>
      
       <!--
       <servlet>
       <servlet-name>SOAPMonitorService</servlet-name>
       <servlet-class>
       org.apache.axis2.soapmonitor.servlet.SOAPMonitorService
       </servlet-class>
       <init-param>
       <param-name>SOAPMonitorPort</param-name>
       <param-value>5001</param-value>
       </init-param>
       <load-on-startup>1</load-on-startup>
       </servlet>
       -->
      
       <servlet-mapping>
       <servlet-name>ExportDataServlet</servlet-name>
       <url-pattern>/AlphaTheory_Export.xls</url-pattern>
       </servlet-mapping>
      
       <!--
       <servlet-mapping>
       <servlet-name>SOAPMonitorService</servlet-name>
       <url-pattern>/SOAPMonitor</url-pattern>
       </servlet-mapping>
       -->
       <servlet-mapping>
       <servlet-name>AxisServlet</servlet-name>
       <url-pattern>/servlet/AxisServlet</url-pattern>
       </servlet-mapping>
      
       <servlet-mapping>
       <servlet-name>AxisServlet</servlet-name>
       <url-pattern>*.jws</url-pattern>
       </servlet-mapping>
      
       <servlet-mapping>
       <servlet-name>AxisServlet</servlet-name>
       <url-pattern>/services/*</url-pattern>
       </servlet-mapping>
      
       <servlet-mapping>
       <servlet-name>AxisAdminServlet</servlet-name>
       <url-pattern>/axis2-admin/*</url-pattern>
       </servlet-mapping>
       <servlet-mapping>
       <servlet-name>springMVC</servlet-name>
       <url-pattern>*.form</url-pattern>
       </servlet-mapping>
      
      
       <!-- RPCManager uses this URL by default for Built-in DataSource operations -->
       <servlet-mapping>
       <servlet-name>IDACall</servlet-name>
       <url-pattern>/isoversion/6.5.1/isomorphic/IDACall/*</url-pattern>
       </servlet-mapping>
      
       <!-- Built-in DataSource operations backcompat -->
       <servlet-mapping>
       <servlet-name>IDACall</servlet-name>
       <url-pattern>/isoversion/6.5.1/isomorphic/IDACall.aspx/*</url-pattern>
       </servlet-mapping>
      
       <servlet-mapping>
       <servlet-name>XMLSelect</servlet-name>
       <url-pattern>/isoversion/6.5.1/isomorphic/XMLSelect/*</url-pattern>
       </servlet-mapping>
      
       <!-- Use FileDownload servlet to download all static content that's part of the skin, such as
       image files, so we can set Expires headers and other cache control directives. In a
       production deployment, you'd want to use a webserver such as Apache to do this.
       -->
      
      
       <servlet-mapping>
       <servlet-name>FileDownload</servlet-name>
       <url-pattern>/isoversion/6.5.1/isomorphic/skins/*</url-pattern>
       </servlet-mapping>
      
      
      
       <servlet-mapping>
       <servlet-name>FileDownload</servlet-name>
       <url-pattern>/isoversion/6.5.1/isomorphic/system/modules/*</url-pattern>
       </servlet-mapping>
      
       <servlet-mapping>
       <servlet-name>FileDownload</servlet-name>
       <url-pattern>/isoversion/6.5.1/isomorphic/system/development/*</url-pattern>
       </servlet-mapping>
      
       <servlet-mapping>
       <servlet-name>FileDownload</servlet-name>
       <url-pattern>/isoversion/6.5.1/isomorphic/system/explorerTabs/*</url-pattern>
       </servlet-mapping>
      
       <servlet-mapping>
       <servlet-name>FileDownload</servlet-name>
       <url-pattern>/lsversion/4.2.3.1329.12.1/ls/*</url-pattern>
       </servlet-mapping>
      
       <servlet-mapping>
       <servlet-name>FileDownload</servlet-name>
       <url-pattern>/images/favicon.ico</url-pattern>
       </servlet-mapping>
      
       <servlet-mapping>
       <servlet-name>FileDownload</servlet-name>
       <url-pattern>/styles/*</url-pattern>
       </servlet-mapping>
      
       <servlet-mapping>
       <servlet-name>FileDownload</servlet-name>
       <url-pattern>/favicon.ico</url-pattern>
       </servlet-mapping>
      
       <!-- FEED RSS2
       -->
       <servlet-mapping>
       <servlet-name>FeedServlet</servlet-name>
       <url-pattern>/feed</url-pattern>
       </servlet-mapping>
      
      <!--once we are using the command line fileAssembler for some environments, we should
      enable this servlet-mapping for those environments -->
      <!--
       <servlet-mapping>
       <servlet-name>FileDownload</servlet-name>
       <url-pattern>/js/at_js_static.js</url-pattern>
       </servlet-mapping>
      -->
      
       <session-config>
       <session-timeout>240</session-timeout>
       </session-config>
      
      
       <!--
       <listener>
       <listener-class>com.wazollc.alphatheory.session.SessionListener</listener-class>
       </listener>
       -->
      
       <listener>
       <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
       </listener>
      
       <context-param>
       <param-name>contextConfigLocation</param-name>
       <param-value>file:///programs/jboss-5.0.0.GA/server/default/deploy/alphatheoryServicesDev/WEB-INF/springMVC-servlet.xml</param-value>
       </context-param>
      
       <welcome-file-list>
       <welcome-file>start.jsp</welcome-file>
       <welcome-file>../demo/quickdemo.html</welcome-file>
       </welcome-file-list>
      
       <error-page>
       <error-code>404</error-code>
       <location>/jsp/404error.jsp</location>
       </error-page>
      
      
      </web-app>