aspose file tools*
The moose likes BEA/Weblogic and the fly likes Getting NoClassDefFoundError exception when running web application in weblogic Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "Getting NoClassDefFoundError exception when running web application in weblogic" Watch "Getting NoClassDefFoundError exception when running web application in weblogic" New topic
Author

Getting NoClassDefFoundError exception when running web application in weblogic

Chaitanya Rach
Greenhorn

Joined: Feb 07, 2013
Posts: 12
    
    1

I have developed a web application in Tomcat earlier and I had some jar files in my tomcat/lib directory. Now I am trying to run my application on weblogic server so I have installed weblogic 10.3.6, created a weblogic domain and deployed my application. I copied my jar files which I placed earlier in tomcat/lib to below lib directory:



I believe lib directory should be in class-path but when I access the class file in my web application I am getting below error:

Carles Gasques
Ranch Hand

Joined: Apr 19, 2013
Posts: 199
    
    1
Hi,

Seems OK regarding the BEA documentation Adding JARs to the Domain /lib Directory
Are you sure that this class com/test/SampleFile is in the jars and that you run the BEA instance on the test_domain?


Best regards,


PD: If BEA is running in a unix like distro check the jar's file permissions
Chaitanya Rach
Greenhorn

Joined: Feb 07, 2013
Posts: 12
    
    1
Thanks a lot Carles for quick reply,

Here are the details:

I have deployed .ear file in weblogic and the ear file is having APP-INF/lib directory
In APP-INF/lib directory I am having this class file: com/test/SampleFile
Now I have placed a new jar file in the path : Middleware/user_projects/domains/test_domain/lib/
In this new jar file I have a class file called com/test/Calculate and I am using SampleFile class methods in my Calculate class
Now when I try to access Calculate class from web application I am getting the java.lang.NoClassDefFoundError: com/test/SampleFile
Carles Gasques
Ranch Hand

Joined: Apr 19, 2013
Posts: 199
    
    1
Hi,

I understand that your app ┬┐ear? finds the domain lib (Calculate) but not your shared lib (SampleFile).

Have you checked your shared library ear structure and application.xml descriptor?

Have your weblogic-application.xml descriptor a reference to the shared library?

Chaitanya Rach
Greenhorn

Joined: Feb 07, 2013
Posts: 12
    
    1
Hi Carles, I am new to weblogic application server and I am trying to run my application in weblogic. Thanks a lot for your support.

In weblogic-application.xml file I have below content with respect to sharing:



and other tags are:



In application.xml file I have multiple module tags of the format:



Please let me know if I need to check any other files.
Carles Gasques
Ranch Hand

Joined: Apr 19, 2013
Posts: 199
    
    1
Hi,

You must reference you shared library from your app (weblogic-application.xml)
Referencing Shared Java EE Libraries in an Enterprise Application

Chaitanya Rach
Greenhorn

Joined: Feb 07, 2013
Posts: 12
    
    1
Hi Carles,

Can you please help me in understanding this, what should be the value for "myLibrary" as per the code snippet you have provided. It would be a great help if you can tell me how to configure this, I am new to weblogic so confused on how to configure this.
Carles Gasques
Ranch Hand

Joined: Apr 19, 2013
Posts: 199
    
    1
Hi,

you have packaged your library as an ear file with an application.xml descriptor and your library must have a MANIFEST.MF file.
This manifest file must have an attribute Extension-Name: myLibrary as the reference documentation states

library-name must exactly match the value of the Extension-Name attribute in the library's manifest file

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Getting NoClassDefFoundError exception when running web application in weblogic