cancel
Showing results for 
Search instead for 
Did you mean: 

How to use external library in EAR deployed onto J2EE engine

Former Member
0 Kudos

For certain reasons some classes in .jar file in operation system level should be used in the EAR project I've deployed onto J2EE Engine.

Can some one tell me what steps I should perform to acheive this?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Check details about Library projects. you would need to create a Library project with those jar files , have reference to it in your EAr project, and deploy both to the J2EE engine.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

Go through this link<a href="/people/valery.silaev/blog/2005/09/14/a-bit-of-impractical-scripting-for-web-dynpro External lib</a>

1.Create an External libray project(Local Development -> My Components", right-click and select "Create New DC...).

2.Add the jars to the libraries(In root project directory find a folder <var>libraries</var>).

3.RightClick the added jar and add it to public part.

4.After we have created and built <var>External Library</var> DC we need to deploy it to SAP J2EE server somehow. So next create "J2EE Server Component / Library" DC.

5.Note that during project createion NetWeaver IDE may prompt you to open <var>JEE Development Perspective</var>. Just agree with it. Along this it will open <var>J2EE DC Explorer</var> view (switch to this view yourself if this doesn't happen). Now expand project structure to "DC Metadata -> DC Definition -> Used DCs". Activate contextual menu on last node and invoke "Add Used DC...". Add reference to the public part of previously created <b>Extrenal Library</b> here. Note, that you have to specify both build time and run-time dependency here. Otherwise created SDA file will not contain <...>.jar from external library.

6.Add used DC (External Library) to J2EE library

Regards

DhanyaR Nair

Former Member
0 Kudos

hi, buddies.

Actually what I need to know is how to use operation system level jars.

When the jars in operation system upgrades, the Program I've deploy on J2EE engine will use the up-to-date jars.

Is that possible?

DhanyaR, what's the difference between the method you applied and the method of Amol?

Former Member
0 Kudos

Hi

Both the methods are same.In your case as u need to deploy it as ear, u need to create a EAR project in the step 4 and use the ExternalLibrary in its used DC.

The libraries then get deployed to J2EE engine.

If the jars get changes later, u need to redeploy it so that it will be available for ur application.Hope i solved ur query.

Regards

Dhanya

Former Member
0 Kudos

hey there,

Think im already late for this... but it may be useful to someone who reads this forum later.

I am struggling with exactly the same problem for the past more than 24

odd hours now. The sad part - Im sure I have seen this being done in a

matter of a few minutes when my team mate had an older version on NWDS.

(I am currently using SP16 NWDS). May be this indeed is a bug that SAP

needs to fix in its SP16 NWDS release.

I need to use the HSSF POI libraries for my webdynpro components and

have been trying ALL possible options given out here on SDN. To mention a

few, I have tried -

1) Jarrod's method of making a Java DC and then declaring a usage

dependency for it inside a J2EE Server (library) DC. It didnt work... it

gave me a warning that an illegal reference has been made to the runtime

public part. And the final SDA file generated in the J2EE server

component DC DIDNOT contain the jar files that I had added to the public part

of the Java DC. On investigating further, I found that there were NO

entities present in BOTH the public parts of the Java DC, even though the

folder actually contained all the required .jar files.

2) Creating an External Library DC, adding the JAR files to the

'libraries' folder. Creating two public parts, one for assembly and the second

for compilation. Then adding this DC as a 'Used DC' into a J2EE Server

(library) DC. Yet, the .sda file that is created on building the J2ee

Server (library) DC DOESNOT contain the JAR files.

3) Creating an external library DC, adding the JAR files to the

'libraries' folder. Creating two public parts, one for assembly and the second

for compilation. Then adding this DC as a 'Used DC' into a webdynpro

DC. On building this webdynpro DC, the .ear file DOESNOT contain the JAR

files.

4) Directly adding the JAR files to my own webdynpro component in the

'src/packages' folder. This didnt work because on rebuilding the

project, the JAR files get deleted on their own.

5) Renaming my .JAR files to .ZIP, extracting the entire package

structure into folders, copy pasting this entire folder structure along with

its .class files into the src/packages folder. On rebuilding, the NWDS

deletes these folders and files on its own / behaves erratically. Also

copy pasted these .class files along with the proper package structure

into the '/bin' directory of my webdynpro application, but it still

didnt work.

The only thing that I have to try yet is to shift to SP10 of NWDS,

build this external library project and get the required JAR files put on

the wendynpro server. After that I might choose to get back onto the

SP16 version and hopefully continue productive work... !

Regards,

Navneet.

Former Member
0 Kudos

Hi,

Did you get a solution for the problem? I am facing the same problem, I tried Dhanya's method.

Could you explain the second method(no.2 in your post) in more detail. We need to create 2 public parts one of type API and other of type SDA, right? And then how exactly are we going to use these public parts?

Thanks and regards,

Harshit

Former Member
0 Kudos

Hi Naveen/Dhanya,

Thanks for your documents ,i have created the Project with Hibernate cfg.xml and pojo classes.

When i tried to run that application i am getting following exception,

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176)

Caused by: java.lang.reflect.InvocationTargetException

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:82)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:44)

at java.lang.reflect.Constructor.newInstance(Constructor.java:315)

at com.sap.tc.webdynpro.progmodel.generation.ControllerHelper.createDelegate(ControllerHelper.java:74)

... 27 more

Caused by: java.lang.NoClassDefFoundError: org.hibernate.Query

at java.lang.J9VMInternals.verifyImpl(Native Method)

at java.lang.J9VMInternals.verify(J9VMInternals.java:69)

at java.lang.J9VMInternals.initialize(J9VMInternals.java:131)

at com.heinkein.idm.wdp.InternalUserAccessForm.<init>(InternalUserAccessForm.java:142)

... 32 more

I have already deployed dependent jars as external library over the SDM and made corresponding entries over the project too.

Still it is not able to find those files.

I am able to see those hibernate jars in the form of ear and entire project (With Hibernate.cfg.xml,POJO class,Mapping hbm files) in the api.jar inside the EAR file.

Kindly help out in this issue.

Thanks

MG

sankar_narayana
Active Participant
0 Kudos

Hi Madhan,

Iam also facing a similar issue. Could you please let me know how you solved it

Thanks,

Sankar