• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

ClassNotFoundException for class in WEB-INF/classes!

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I went back to do some maintenance on a deployed web app and when accessing it on my test server, I'm getting a ClassNotFoundException for a class in my WEB-INF/classes directory!

So I put this code in my servlet's doGet() method to check:

Of course, the first thing I did was check to see if the com.domain.myapp.web.SelectPageAction.class was deployed in the WEB-INF/classes directory - and it was.

I'm running JBoss 3.2.x with embedded Tomcat 4.1.x, but have been all along, so I'm not sure what has changed regarding classloading.

Maybe I've just been looking at this too long!

Any suggestions.

Jack
 
Jack J. Jackson
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
FYI: In my original post I forgot to mention that, indeed, the catch block was entered indicating the class could not be found.

jack
 
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it possible that a jar file exists in the app or somewhere in JBoss that has a package "com.domain.myapp.web"? If so, maybe that package got loaded first.
 
Sheriff
Posts: 67753
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

a class in my WEB-INF/classes directory



Directly? Or in the appropriate folder structure for the package?

IOW, is the class file at /WEB-INF/classes/com/domain/myapp/web/SelectPageAction.class?
 
Jack J. Jackson
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
William,

>> Is it possible that a jar file exists in the app or somewhere in JBoss that has a package "com.domain.myapp.web"? If so, maybe that package got loaded first.<<

This is the only app server instance running on the machine and no JARs with that package have been deployed, except in the WAR file.

But let's assume some other JAR containing a com.domain.myapp.web package got loaded first. The package represents little more than a directory for namespace protection. If it doesn't contain the SelectPageAction.class file, then the search would continue and should find the class in my WAR file's WEB-INF/classes directory.

However, I think we agree there's some classpath issue, but I haven't ever had this kind of error about not finding a class in the WEB-INF directory when it's really there.
 
Jack J. Jackson
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bear,

>> IOW, is the class file at /WEB-INF/classes/com/domain/myapp/web/SelectPageAction.class <<

The class is in the appropriate directory structure.

Actually, that was my first concern, too. When building the WAR, did the class get put into some incorrect directory? Since the buid is done with an Ant WAR task, I was pretty confident it went into the right place - and it did.

Thanks for the response though!
 
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could you verify whether the size of your deployed class is the same as the size of the compiled class? Are they indentical? Once I used ftp to deploy a single class and got class not found exception because content of my deployed class was messed up.
 
Jack J. Jackson
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Joey (et al),

Thank you all for your responses. I was finally able to find the problem and here is what happened:

The class not being found inherited from another class. It was a JAR file that contained that class that was missing from my deployment. I'm not sure why the ClassLoader was complaining about the subclass not being found instead of the super class, but that's my story and I'm sticking to it!

Thanks again.
 
I didn't do it. You can't prove it. Nobody saw me. The sheep are lying! This tiny ad is my witness!
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic