cancel
Showing results for 
Search instead for 
Did you mean: 

exception while accessing a .jar file in EJB project

Former Member
0 Kudos

Hi

I have a .jar file (of another J2EE project) which I want to refer in EJB project. when I am using this .jar file as an external reference , it does runs successfully n I can access the method in .jar file. But when I create an extra folder in the EJB project and put the .jar file in that n refer it it as internal jar,it deploys successfully but gives an exception of methodname not found on running.

Please tell me where does the problem lie?

Regards

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hai ,

its the problem becuase your refered jar is not available in server in first case.

in second case its in the project directory so it was avail on server.

better approach is to create a library project for refer jars.

create J2ee library project.

add jars in server/provider.xml

deploy it to j2ee engine.

for your j2ee projects refer the jars from this library.

regards,

former_member187702
Active Participant
0 Kudos

But the problem with the library would be that we hav to refer the library in the EJB project. So again the project remaims dependent on the library. When the library is not open , the reference gives error.

Former Member
0 Kudos

Hai,

then you need to copy jar file in ejb project itself.

but it is not a good approach . becuase more than one project using the same jar file.so you need to copy the same jar file in all your projects.

but if you make it as a library you can refer for any number of the projects.

regards,

Former Member
0 Kudos

hi,

shilpa

can u tell me exception cleary.

if jar is not available in server means it will give exception like no classdef found......etc at runtime?

so first u need to find wht is the exception cleary????

wht is client is client for that session bean ???

regards

Guru

former_member187702
Active Participant
0 Kudos

Hi

The exception is ClassNotFound Exception.

Actually i m using a jar file that is extracted of a par file. The par file is already deployed on the server. Can u tell me if there is sth else that is needed to refer a jar file extraced of par component.

Thanks

Former Member
0 Kudos

if you have an application say XYZ.ear deployed on the same server, then you can set referecne to that application inside your client EJB application ear. For this add an entry to the application-j2ee-engine.xml file in the ear project as

<reference

reference-type="weak">

<reference-target

provider-name="sap.com"

target-type="application">XYZ</reference-target>

</reference>

this establishes runtime references with your deployed application.

if you are using DCs then you must set runtime dependency of the client app DC onto the already deployed DC.

Former Member
0 Kudos

hi,

sholpa

u can do one thing that is copy the .java files of that .jar file to ur current j2ee project with same package

regards

Guru

former_member187702
Active Participant
0 Kudos

Thanks Amol, but can u tell me how should I refer to the par/jar file in EJB project.

Do I still need to give an external reference ??

Former Member
0 Kudos

a PAR as far as I know is a Protal project and I really dont think it makes sense to set reference to a PAR project...I somehow feel its not correct!!

what you can do is take out the jar file, create an external library project using the jar file , deploy it and then have references...not sure if this suits your requirement but..

Former Member
0 Kudos

Dear Shilpa,

Try to redploy the .jar file and access the file you wanted.

Actually according to J2EE specifications once you have deployed a application and run it that it will run successfully but if you change the application you have to redeploy and run the application.