0

I can't get any pages of my webapp to load (locally on Tomcat 7.0.2.6), due to this NoClassDefFound error. I'm at my wits end trying to figure out what the cause is, here is what I know:

My coworker has this project successfully running locally (on Tomcat) and on our development server (WebLogic).

I have done a fresh pulldown from svn so my code is exactly the same as his. I've verified that I have a shared library reference to Aspose (and that the required .jars are in there), and that weblogic.xml has an entry for it.

We saw this same error when initially deploying on WebLogic because the Aspose library was named incorrectly, but it ran fine locally on his Tomcat server.

I've tried cleaning and rebuilding the project to no effect.

As best as I can figure, it has to be either a Tomcat issue, or maybe an Eclipse setting.

Has anyone encountered a similar situation? Any ideas on what to try to resolve this?

Corwin01
  • 479
  • 3
  • 7
  • 24

2 Answers2

1

First thing you need to do is determine if you are colliding with another class with the same name and package. The easiest way to do this is with the cygwin/linux console, save this shell script to a file say, findjar

find "$1" -name "*.jar" -exec sh -c 'jar -tf {}|grep -H --label {} '$2'' \;

put it in your path and navigate to the root of the server instance and run the script like this

findjar . yourclass

Note the period, dont forget it. this will return if you have multiple classes with the same name in your project.

once your sure the project is clean and there is only one copy of the class, i would try actually adding your shared libraries folder to the websphere server instances JVM arguments. to do that:

  1. Go into the admin, click on servers
  2. Open server types, click on websphere application servers
  3. You should see your server listed there, click on it
  4. On the right hand side, you will see a section “server infrastructure” and below that is a subsection “Java and process Management”
  5. Open that section and click on “Process Definition”
  6. On the process definition screen is another right hand column. Click on “Java Virtual Machine”
  7. Yes, finally we are on the correct screen, there is an end in sight here, I promise
  8. On the virtual machine page, there is a large text field labeled “Classpath” What you need to do is enter the full path to the shared libraries folder

its odd and makes no sense to have to do it, but i have had to do that in the past to allow my code to see the properties files in a shared resource.

scphantm
  • 4,293
  • 8
  • 43
  • 77
  • Actually I don't have any websphere application servers. Apparently somehow the app wasn't seeing those jars, despite them being in the Shared Library ref. I cheated, and just dumped them into my WEB-INF\lib. Oh well. – Corwin01 Feb 15 '13 at 19:35
  • eclipse is funny like that. Thats why i always do deployments and compiles from the command line. The only thing i ever use eclipse for is simply editing the files. – scphantm Feb 15 '13 at 21:47
0

It is possible that your colleague has java librarys installed within his Tomcat instance itself.

Take a look in the Tomcat directory for some lib folders (I cant remember the exact location and I think it changes based on the version) but something like ${CATALINE_HOME}/common/lib

Verify that he doesnt have differen JAR files in his tomcat installation as yours.

From this question: Does Tomcat load the same library file into memory twice if they are in two web apps? They are apparently stored here:

Tomcat 6 $CATALINA_HOME/lib
Tomcat 5 $CATALINA_HOME/common/lib
Community
  • 1
  • 1
cowls
  • 24,013
  • 8
  • 48
  • 78