Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ClassNotFoundException for class in WEB-INF/classes!

 
Jack J. Jackson
Greenhorn
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Scott Duncan
Ranch Hand
Posts: 364
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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!
 
Joe Nguyen
Ranch Hand
Posts: 161
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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 agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic