facebook

How does "deploy" feature work? ClassNotFound :(

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #226659 Reply

    ivj
    Member

    I’m using resin-3.0.12-pro, and I’m having a problem – I get java.lang.NoClassDefFoundError when it’s reading my web.xml. Web.xml:

    
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app 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>Test</display-name>
    
        <listener>
            <listener-class>package.MyClass</listener-class>
        </listener>
    
        <!-- The Usual Welcome File List -->
        <welcome-file-list>
            <welcome-file>index.jsp</welcome-file>
        </welcome-file-list>
    
        <error-page>
            <exception-type>java.lang.Throwable</exception-type>
            <location>/Error/Throwable.jsp</location>
        </error-page>
    
        <error-page>
            <error-code>404</error-code>
            <location>/Error/404.jsp</location>
        </error-page>
    
        <error-page>
            <error-code>403</error-code>
            <location>/Error/403.jsp</location>
        </error-page>
        
    </web-app>
    

    And package.myClass exists as it’s supposed to (WEB-INF/classes/package/MyClass).

    The error I get is:

    [18:41:20.156] com.caucho.config.LineConfigException: WEB-INF/web.xml:9: java.lang.NoClassDefFoundError: package/MyClass$1

    I have no idea why. Such thing never happened in the past. The only thing I can think of is the fact that this application is deployed. So I look in my $RESIN_HOME/deploy folder – everything’s perfect.

    Anybody knows what could be causing this?

    I begin to wonder, how does deploy feature work? My resin.conf doesn’t say anything about “deploy” folder except that it’s for ear and rar expansion (which doesn’t seem to be the case), so anybody knows?

    It doesn’t matter, but I will note that MyClass is a proper Listener.

    Thanks in advance!

    #226663 Reply

    ivj
    Member

    I arrived at a very idiotic solution. I packaged that class into a .jar, and put that jar into WEB-INF/lib. Now everything works just fine.

    The question is: why the hell?

    BTW my CLASSPATH is: .

    #226664 Reply

    ivj
    Member

    YAY I Solved it!

    I set my CLASSPATH to:

    %CLASSPATH%;.

    And it started working. But I want to understand WHY.. What the hell does %CLASSPATH% do? Calling myself a programmer, wouldn’t java look inside the %CLASSPATH% variable, which would recursively give us %CLASSPATH% and so on? Somebody please reveal this mystery to me or I will kill my dog.

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: How does "deploy" feature work? ClassNotFound :(

You must be logged in to post in the forum log in