Apache Geronimo > Discussion Forums  User List | Dev List | Wiki | Issue Tracker  

 « Return to Thread: Could not locate class in jar package in the WEB-INF/lib folder - classloader problem?

Re: Could not locate class in jar package in the WEB-INF/lib folder - classloader problem?

by timo.ratilainen :: Rate this Message:

Reply to Author | View in Thread

Okey, I found the solution. It was too easy to be seen and have nothing to do with the Geronimo. Sorry, this question should have been in the Stripes forum.

Answer lies in the url filter, it should accept actions from the WEB-INF/lib -folder too:

<param-name>ActionResolver.UrlFilters</param-name>
<param-value>/WEB-INF/classes,WEB-INF/lib</param-value>



timo.ratilainen wrote:
Hello

I have created a very simple web application just with a login page (index.jsp). Application is using geronimo 2.1.

My application ear contains:

MyWebApplication.ear:
  MyBackEndComponents.jar
  commons-logging-1.1.1.jar
  log4j-1.2.15.jar
  spring.jar
  MyGui.war

and the war contains (among other stuff):

MyGui.war:
  index.jsp
  WEB-INF
     lib
       cos.jar
       stripes.jar
       MyStripesActions.jar


Now, I would assume that Stripes actions in the MyStripesActions.jar package would be available, but they are not (classNotFound kind of exception it thrown: net.sourceforge.stripes.exception.StripesServletException: Could not locate an ActionBean that is bound to the URL [/Login.action].). Basicly it means that Stripes could not locate the Login-action class.

If I extract MyStripesActions.jar package and put those action classes into WEB-INF/classes folder, application is working as it should.

Why the geronimo could not load the the jar package?

Thanks in advance and regards,
Timo Ratilainen



Other information:

geronimo-web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1"
        xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1"
        xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1"
        xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2">
  <environment>
    <moduleId>
      <groupId>mygui</groupId>
      <artifactId>MyGui</artifactId>
      <version>1.0</version>
      <type>car</type>
    </moduleId>    
                <hidden-classes>
                        <filter>org.springframework</filter>
                        <filter>org.apache.commons.</filter>
                        <filter>org.apache.log4j</filter>
                </hidden-classes>    
                <inverse-classloading/>
  </environment>
        <context-root>/MyGui</context-root>
</web-app>

web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app
        id="sutki"
        version="2.4"
        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">
       
        <display-name>MyGui</display-name>
       
        <welcome-file-list>
                <welcome-file>index.jsp</welcome-file>
        </welcome-file-list>
                       
        <filter>
                <display-name>Stripes Filter</display-name>
                <filter-name>StripesFilter</filter-name>
                <filter-class>net.sourceforge.stripes.controller.StripesFilter</filter-class>
                <init-param>
                        <param-name>ActionResolver.UrlFilters</param-name>
                        <param-value>/WEB-INF/classes</param-value>
                </init-param>
                <init-param>
                        <param-name>Interceptor.Classes</param-name>
                        <param-value>
                                net.sourceforge.stripes.integration.spring.SpringInterceptor,
                                net.sourceforge.stripes.controller.BeforeAfterMethodInterceptor
                        </param-value>
                </init-param>
        </filter>
       
        <filter-mapping>
                <filter-name>StripesFilter</filter-name>
                <url-pattern>*.jsp</url-pattern>
                <dispatcher>REQUEST</dispatcher>
        </filter-mapping>
       
        <filter-mapping>
                <filter-name>StripesFilter</filter-name>
                <servlet-name>StripesDispatcher</servlet-name>
                <dispatcher>REQUEST</dispatcher>
        </filter-mapping>
       
        <servlet>
                <servlet-name>StripesDispatcher</servlet-name>
                <servlet-class>net.sourceforge.stripes.controller.DispatcherServlet</servlet-class>
                <load-on-startup>1</load-on-startup>
        </servlet>
       
        <servlet-mapping>
                <servlet-name>StripesDispatcher</servlet-name>
                <url-pattern>*.action</url-pattern>
        </servlet-mapping>
       
    <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>
</web-app>


applicationContext.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>      
        <bean name="Login" class="backendpackage...Login"/>
</beans>

 « Return to Thread: Could not locate class in jar package in the WEB-INF/lib folder - classloader problem?