cancel
Showing results for 
Search instead for 
Did you mean: 

referring Jar files from WD DC

ashish_shah
Contributor
0 Kudos

Hi Experts,

I am facing problem in referring External jar files from webdynpro DC.

I am using NWDS version 2.0.16

I saw two blogs:

1) By Valery Silaev [https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2361] [original link is broken] [original link is broken] [original link is broken];

2) By Bala Krishnan [https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/4512] [original link is broken] [original link is broken] [original link is broken];

I tried both the approaches creating External library and using directly in WD Dc

And using external library in J2EE server component library and referring it in WD DC but none of them seems to work for me.

I get this error: java.lang.NoClassDefFoundError: jxl/Workbook

My DC names are ( all are local development component)

1) WD DC u2013 sap.com -leapp

2) J2ee server component libraryDC u2013 sap.com - gp/lib

3) External library DC u2013 sap.com u2013 gp/jars

I have added library reference as u201Csap.comgplibu201D in WebDynpro DC, is this reference correct?

Or is there any other problem , can you please guide?

Regards,

Ashish Shah

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hey Ashish,

There is a bug in SP 16 J2EE server component.it won't pack the external jars in it's ear file.so i suggest you to directly add the both public parts of External DC to Web dynpro DC.

when you add external DC sda public part with build time and runtime dependency to Webdynpro DC,those jars will be packed in webdynpro ear file.

I hope this solvs your problem.

Regards,

Balaram Naidu

ashish_shah
Contributor
0 Kudos

Hi Balu and Daniel,

Thanks for your help.

Adding asssembly and compilation PP of ext lib DC in WD DC with build time dependency solved the problem.

No need to even use "postbuild.vm" file.

So i guess properly following blog by Bala Krishnan will solve the purpose

[https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/4512] [original link is broken] [original link is broken] [original link is broken];

Ashish

Former Member
0 Kudos

Hi,

First, great that you solved your problem. But to clarify some thinks so that you won't make the same mistake again, some hints.

1. Always think of the build results of your DC, e.g. External Libray has a *.jar file as build result, so it cant't be deployed and so a runtime dep to an

External library makes no sence and will always gets ignored!!!

2. PP of type assembly tells NWDS to pack the build result of an other DC into its own build result, so it could be deployed on the server and is available for this DC at runtime (but also don't declare a runtime dependency on this public part).

3. Runtime dep means, the refered DC has to be available on the server at runtime (this could only work with DCs that could be deployed on the server, that means that they have a deployable build result, *.sca, *.sda, *.war, *.ear, ...)

4. J2EE libs makes sense if they contain libraries which are often used within different applications, so that not every DC has to pack the same ExtLib again and again

So keep on NWDIing and have fun with it and I hope after a while you also see that development gets much more easier (as I do after hard hours of learning).

Regards,

Daniel

ashish_shah
Contributor
0 Kudos

Hi Daniel,

Thanks for the explanation.:)

In case if i need this J2EE DC Lib to work with my NWDS version i.e. SP 16

then as per my understanding, this is what i would do .. please correct me if i am wrong.

In J2EE lib DC i would add build time dependency of Assembly PP of ExtLib DC.

in WD DC i would add build time and run time dependency of Compilation PP of J2EE lib DC.

Also i will add library reference for J2EE lib DC in WD DC.

Would this all be it to get J2EE lib DC work?

Ashish

Answers (1)

Answers (1)

former_member182046
Contributor
0 Kudos

When creating DC dependencies by using a public part of another DC, errors sometimes result from the fact that an ASSEMBLY time dependency is required but only a COMPILATION time dependency exists.

ASSEMBLY means that the build process will included the used resources in your archive. For example, an EAR archive that is supposed to include the contents of an EJB project must have an ASSEMBLY time dependency.

COMPILATION means that the dependencies are resolved at compile time, but the used resources are not included in the archive of the DC that declares the dependency.

ASSEMBLY or COMPILATION are properties of the public parts of a DC. In the component properties view of the dependent DC, go to the dependencies tab and hover the mouse over the public parts you are using. A tooltipp with ASSEMBLY or COMPILATION will appear.

Cheers,

Thorsten

Former Member
0 Kudos

And please close the thread if you're problem is solved!!!!

ashish_shah
Contributor
0 Kudos

Hi Daniel,

I am still unable to solve the problem.

Do you know any solution to this?

Ashish

ashish_shah
Contributor
0 Kudos

Hi Thorsten,

Can you suggest, in this case which type of public part to use? compilation or assembly?

Ashish

former_member182046
Contributor
0 Kudos

Ashish,

I'm still a beginner, but from my little experience, the exception you report occurs normally when a class is not in the classpath at runtime. Since your project was successfully built, the class was in the build path at build time, but not in the class path at run time, which means that you probably have a COMPILATION public part while you need an ASSEMBLY public part.

So ASSEMBLY is what I'd go for.

Cheers,

Thorsten

Former Member
0 Kudos

Hi,

You've to create both types of public parts for the external library DC. In the J2EE library DC you add the reference to the assembly pp with "build time" and "run time" dependencie (without "run time" dependencie wd app won't find the lib!!!!). After build of the DC the jar should be packed into the J2EE lib ear. Please check the ear if it contains the jar. If yes, everything is fine.

If not check the build logs for more details. Also check the Extlib DC jar if it contains the relevant jars. With some versions of NWDS the build doesn't work, so check SAP notes for your version of NWDS.

Regards,

daniel

ashish_shah
Contributor
0 Kudos

Hi Daniel,

My NWDS version is

Version: 2.0.16

Build id: 200602130353

Do you have any idea whether there is any SAP note for this version or not?

Ashish

Former Member
0 Kudos

Hi,

No, I don't know a note. I also have to search. Have you checked the build results if the contain the relevant jar files?

Regards,

Daniel

ashish_shah
Contributor
0 Kudos

Hi Daniel,

When i checked my J2EE librarary DC build result, it says

[cda] WARNING: Ignoring invalid runtime dependency on js/jar (sap.com), type External Library

So i guess you are right in pointing out why WD application is unable to find Jar files.

can you tell me what do i need to do now?

Ashish

ashish_shah
Contributor
0 Kudos

Hi Daniel,

I found a thread talking about the same problem and also the solution.

[;

trying to create a "postbuild.vm" file in the cfg/-folder of the external library DC with the following content


#StartProject("dummy" "build" ".")
#StartTarget("build")
#foreach($pp in $dc_public_parts)
<delete file="${dc_gen_variantDir}/public/${pp.getName()}/PublicPartFileList.xml"/>
#end
#EndTarget()
#EndProject()

there is a SAP note for SP 16 as well, sap note 991238

[https://websmp230.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=991238]

Let me try that.

Will update with the progress.

Ashish

Former Member
0 Kudos

Hi,

Don't set runtime dependencie to ExtLib DC in your WD DC. Runtime Dependency has to be set for your J2EE library DC (which contains the ExtLib DC).

Regards,

Daniel

ashish_shah
Contributor
0 Kudos

Hi Daniel,

This is what i have done:

1) In ExtLib DC added the jar file in Libraries folder.

2) Added "postbuild.vm" file in cfg folder of ExtLib DC.

3) Created two public parts , Assembly and compilation

4) In J2EE Server component Library DC Added Build time and Run time dependency on Assembly PP of ExtLib DC , with Strong reference.

5) While building J2EE lib DC , got build warning for

WARNING: Ignoring invalid runtime dependency on js/jar (sap.com), type External Library

6) Deployed sda file of J2EE lib DC.

7) In WD DC, added build time and Runtime dependency on Compilation PP of J2EE lib DC.

😎 Added the library reference in WD DC for J2EE lib DC as "sap.comjslib"

Now i got this deploy warning in WD DC

Finished with warnings: development component 'legalent'/'sap.com'/'local'/'20080710195624'/'0':Caught exception during application startup from SAP J2EE Engine's deploy service:java.rmi.RemoteException: Error occurred while starting application sap.com/legalent and wait. Reason: Clusterwide exception: server ID 84822150:com.sap.engine.services.deploy.container.DeploymentException: Clusterwide exception: Failed to prepare application sap.com/legalent for startup. Reason=Clusterwide exception: Failed to start dependent library ''sap.comjslib'' of application ''sap.com/legalent''. Status of dependent component: STATUS_MISSING. Hint: Is the component deployed correctly on the engine? at com.sap.engine.services.webdynpro.WebDynproContainer.prepareStart(WebDynproContainer.java:1494) at com.sap.engine.services.deploy.server.application.StartTransaction.prepareCommon(StartTransaction.java:223) at com.sap.engine.services.deploy.server.application.StartTransaction.prepare(StartTransaction.java:171) at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhasesOnOneServer(ApplicationTransaction.java:301) at com.sap.engine.services.deploy.server.application.ParallelAdapter.makeAllPhasesImpl(ParallelAdapter.java:342) at com.sap.engine.services.deploy.server.application.ParallelAdapter.runInTheSameThread(ParallelAdapter.java:126) at com.sap.engine.services.deploy.server.application.ParallelAdapter.makeAllPhasesAndWait(ParallelAdapter.java:245) at com.sap.engine.services.deploy.server.DeployServiceImpl.startApplicationAndWait(DeployServiceImpl.java:4707) at com.sap.engine.services.deploy.server.DeployServiceImpl.startApplicationAndWait(DeployServiceImpl.java:4612) at com.sap.engine.services.deploy.server.DeployServiceImpl.startApplicationAndWait(DeployServiceImpl.java:4585) at com.sap.engine.services.deploy.server.DeployServiceImplp4_Skel.dispatch(DeployServiceImplp4_Skel.java:1163) at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:319) at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:200) at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:136) at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33) at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:102) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172) (message ID: com.sap.sdm.serverext.servertype.inqmy.extern.EngineApplOnlineDeployerImpl.performAction(DeploymentActionTypes).REMEXC)

Seems i have messed up something.

can you please guide?

Ashish