cancel
Showing results for 
Search instead for 
Did you mean: 

Using a J2EE Server Component -> Library

Former Member
0 Kudos

Hello everyone:

I needed to include some jar files in my WebDynpro project, so I created a new J2EE Server Component -> Library and added the jar there in the Java Build Path -> Add external Jars.... so I successfully deployed the library in the server.... I heard that was enough to set the required jar file into the server.... but now, how can I get to "use" it in my deployed webDynpro app? I get the classNotFound thing.... how can I reference it? I can't get to do it, I think I'll end uploading the jar file and setting it in the server CLASSPATH =(

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

ok this is what I did:

My main project is called Webform. It needs a jar called CCSDB.jar. When I compile Webform, it's ok since the jar is correctly imported in the libraries.

I created the Java Lib as I explained before and I called it CCSDB2. So I checked the server/provider and I replaced sap.com for "netwin" without the quotes. After that, I compiled CCSSDB2 and created a CCSSDB2.sda file, which I succesfully deployed.

Now I go back to WebForm and added an entry to project->properties->Web dynpro preferences with:

netwin/CCSSDB2

I rebuilt the project and successfully deployed.

now I run the Webform and I see the "login" screen... in that screen I have a GO button which is the one that calls the CCSSBD.jar......... but I keep getting the java.lang.NoClassDefFoundError for that specific classes....

Am I missing something? thanks a lot for your help, I appreciate it a lot.

thanks

Former Member
0 Kudos

hi,

1.Open server/provider.xml

2. You should be able to see 4 tabs in the bottom of that window.

General,Jars,References,Source

3.In this select Jars -> click on Jars folder icon shown. Now add.

4.When u say add it will open a pop up which lists all the projects currently open.YOur webform will also be there if it is open

5.Select and expand it -> now you should be able to see

CCSDB.jar which you have added in the external jars of that project.

6.Add it .

7.Now build archive and deploy that archive.

8.Now take the webform project .Go to webdynproreferences ->library refernce -> add

sap.com/<the library proj name> the one which you have deployed.

Now run the application

Regards

Bharathwaj

Answers (7)

Answers (7)

Former Member
0 Kudos

thanks for everything.... I couldn't exactly test it since my dependencies broke, but it was my fault, due to unorganized projects.... I'm starting all over again.

However, I do believe that will do!

Thanks

Former Member
0 Kudos

Hi,

Prerequisites: A library project

Now expand the project.Now you should be able to see it.

Former Member
0 Kudos

HI:

Where's the server/provider.xml?

Thanks a lot

Former Member
0 Kudos

hello:

I've checked the .ear file and it has only the .wda and deployment descriptors inside.... no jars =(

After a closer look to the wda file I notice a lib dir and an app.jar file.. I wonder if I could put my jar inside that lib directory.... will refactoring and redeployment erase the current ear file (if i put inside the jar manually) for a new one?

Former Member
0 Kudos

Hi,

I dint read your first post properly.

Double click on the server/provider.xml .

Now click the tab jars.

Now this will point to the jar u have added .

Now added it.Rebuild it and check the .ear file.It will be available now.

Deploy this in the server.

Regards

Bharathwaj

Former Member
0 Kudos

Hello:

thanks for your help.

"Well after selecting the external jar in the libraries tab from the JAVA build path also try selecting the jar from the Order/Export Tab though not required.

Now if you have done that where are you getting the error. Are you able to access the class and its methods. Is it giving you a error at runtime or compile time."

I did add the jar file and so it does compile correctly. The thing is, I believe the "Deploy process" doesn't take the external jar too, so those classes does not exists in the server...

Former Member
0 Kudos

Hi Alejandro,

If you have made library project and deployed on server, then just make a reference of this loibrary project in your application.

For that goto properties of your project.then goto Webdynpro references-> library references.

there make one entry sap.com/<Library project name>

then it will take those JARs at runtime from server only.

Regards,

Bhavik

Former Member
0 Kudos

Hi,

Actullay when you are building the archive it builds a .ear file.

Here in this ear file the jar you have referred to should be present .

So when u deploy this it should be available in the server.

Did u check the ear file in the server.

Regards

Bharathwaj

Former Member
0 Kudos

hi,

Go to properties -> WebDynpro References -> Library Reference ..here add sap.com/ur library proj name

Apply the changes and rebuild all .Now it will take the file from the server,

Regards

Bharathwaj

Former Member
0 Kudos

Hi

Well after selecting the external jar in the libraries tab from the JAVA build path also try selecting the jar from the Order/Export Tab though not required.

Now if you have done that where are you getting the error. Are you able to access the class and its methods. Is it giving you a error at runtime or compile time.

regards

ravi