cancel
Showing results for 
Search instead for 
Did you mean: 

Problem Importing .jar file

Former Member
0 Kudos

I have three Web Dynpro applications that all will use a library of java classes.

I have a Java project with the classes in it and have exported to a .jar file.

I have added the .jar file to the projects through Properties --> Java Build Path --> Libraries and added it to the deployment through Proeprties --> Java Build Path --> Order and Export

Everything compiles and deploys fine, but when I attempt to access the deployed application, I get ClassNotFoundExceptions for all the classes in the .jar file.

The .jar file does show in the /lib directory when viewing the project in Navigator view. I don't understand what's going on. I only want to maintain the java class files once for all three applications.

Accepted Solutions (1)

Accepted Solutions (1)

former_member751941
Active Contributor
0 Kudos

Hi Tom,

Check this threads,

Regards,

Mithu.

Answers (3)

Answers (3)

Former Member
0 Kudos

HI Tom,

Copy the jar file WebDynproProject\src\mimes\Components\package\*.jar

Instead of the previous one,Include this jar file in build path.

Otherwise u have to create and deploy a library in to J2EE engine and specify that library in WebDynpro Project's Library ReferenceTab.

Regards

Fahad Hamsa

Former Member
0 Kudos

Tom,

As you have unfortunately discovered, SAP has totally blown it when it comes to this most basic of Java development tasks.

On my particular project, we have wasted a ridiculous amount of time with the various hacks that are offered for referencing external jar files. The mind-numbingly complex suggestions work in one release but break in the next.

We had a solution using an external lib DC that worked fine in SP08. But, while attempting to solve a different SAP bug (enumerated data type in Java data dictionary), we upgraded to SP09 and our external DC solution is now broken. We are hoping that upgrading to SP10 will fix both problems.

I hope SAP is paying attention to the numerous threads about this problem. <b>They have a serious problem that needs immediate attention!</b>

Whew, now I feel better and will step off of the soap box

Regards,

Kelly<u></u>

Former Member
0 Kudos

I found the problem, maybe someone can help explain if it's a NetWeaver problem or if I've done something incorrectly.

In the resulting .ear file there are two .jar files both located in the PORTAL-INF\lib\ directory:

app.jar

workflow.jar (the jar the library is packaged in)

The problem is although I've updated the external .jar file AND the IDE IS using it for compilation, it's not deploying that version of the jar file. It's deploying the version that existed at the time I added it to the project.

Ironically enough other Eclipse plug-ins that I use redeploy the .jar if it's changed. This is the only one that isn't smart enough to detect this.

former_member186016
Active Contributor
0 Kudos

HI Tom,

Have you updated the ear file by running Create archive action on your project ?

May be you have update jar but havn't run the action create archive, hence is not getting updated jar in the ear archive.

Regards,

Ashwani Kr Sharma

former_member186016
Active Contributor
0 Kudos

If you are having web Dynpro dc projects. you can create an external dc and add the libraries to the this dc.

Later use jar from this dc from other dc by creating dependency to this dc.

i.e.

1) Create External Library DC.

2) Add the jar under libraries folder in the DC.

3) Expose this jar as public part.While exposing select "Can be packaged in other build result (e.g. SDA)"

4) Create the Web Dynpro dc.

5) Add the External Library DC as used dc in the Web Dynpro dc.

6) Build the Web Dynpro dc.

7) After dc build the web dynpro archive should have the jar from the external dc.

Check the sda/ear archive. It should have the jar from External Library DC.

If you have errors while getting the external dc up, refer to this thread;

Regards,

Ashwani Kr Sharma

Former Member
0 Kudos

Well it's a Web Dynpro project, so I simply deploy and run the application. Do I need to create archive first when upating external resources?

former_member186016
Active Contributor
0 Kudos

Hi Tom,

If your are archiving external jars, on updation of external jars/resources you must re-archive.

The re-archive is done by the Create archive action.

Regards,

Ashwani Kr Sharma