I have a Web Dynpro DC in which I need to use an external jar (jxl.jar).
I have currently added the jar file to the Java Build Path and get no errors during design time.
I have followed the blog for adding external jar to Web Dynpro projects --> /people/bertram.ganz/blog/2008/11/24/how-to-use-external-jar-files-in-web-dynpro-development-components
But I face the following issues
1) When I build the DC, the jar file is not recognized and throws build errors.
2) When I run the DC(Deployed the Application -> Deploy new archive and run) - I get the ClassNotFoundException.
Is there any issue with the jar file uploaded or are there any more settings to be done for accessing an external jar file ?
Can you check that the ".jar" files are available in lib folder of that DC.
Right click on the Dc from WD explorer->get the path/workspace and find the lib folder.
If .jarr files are not found in that copy the same files and paste in that folder.
Go to navigator->add the lib folder files to DTR by rightclick on that folder+add to DTR.
Please have a look at below document for External Library DC.
then sync sources and sync used DC from main DC wher you are using External Library DC.
Hope it will helps
Go through below document.
Only to be sure did you check those two points :
Your JXL is deployed using a library DC prior to launch your application (odd but always need to check )
Did you add to your "web dynpro project references" in "library references" the name of your JXL (not the library DC)? (name should be something like <vendor.name>~<jxl>/<full>/<name>)
Hope this helps!
I thought you are aware of basics , please follow the given thead which have step bny step procedure also explain the difference of uses between 7.0 and CE 7.1.
I have followed the all the steps in the document.
Only step I want to confirm is
"Define a DC Run Time usage of the J2EE Server Component/Library development component in the DC metadata of the Web Dynpro client development component, where classes and interfaces of the external JAR file are invoked (5)."
For this I added the Library DC in the dependencies to the Web Dynpro Component. Is ther anything else I need to do ?
Surprisingly when I build the Web Dynpro DC it never recognizes the jar file.
Also another doubt I have is regarding the compatibility of the jar file with the CE server.
I have the following jar versions --> jxl-2.4.2.jar , jxl-2.5.7.jar, jxl-2.6.3.jar & jxl-2.6.jar and have tried all but none works at runtime
Has anyone successfully used a External jar in Web Dynpro for CE 7.1 ??
Thanks Saurabh for your prompt reply.
I checked the application-j2ee-engine.xml file and it contains the entry for the ear file which contains a dependency to the Library DC.
<reference-target target-type="application" provider-name="demo.sap.com">external_jar_ear</reference-target>
Also, I am using CE 7.1 and the options regarding the EAR file are different from your blog.
The solution using DC's is very simple.
As a first step, undo all the stuff you have done up to now in this thread, including removing any build-time references, and deleting anything you entered in the application-xml files. When you are back to a "clean" Web Dynpro DC, do the following:
Step 1: Create an External Library Development Component
1.1) Switch to Development Infrastructure perspective.
1.2) Create a new dc of type External Library (eg. mycompany.com/downloadexcel/lib)
1.3) Switch to the Resource perspective when prompted and copy your JAR's to the libraries folder of the project.
1.4) View the Component Properties (Window -> Show View -> Component Properties)
1.5) Click the tab "Public Parts".
1.6) Add two public parts, one for COMPILATION and one for ASSEMBLY. Give them names like export_excel_comp and export_excel_asbly
1.7) Right-click each public part, then click Manage Entities -> Archive and select all the JAR's presented for selection.
1.8) Click the Permissions tab, and check Entity Forwarding Allowed.
Step 2: Create an Enterprise Application Development Component
2.1) Switch to Development Infrastructure perspective.2.
2.2) Create a new dc of type J2EE -> Enterprise Application (eg. mycompany.com/downloadexcel/ear)
2.3) Switch to the JavaEE perspective when prompted.
2.4) View the Component Properties (Window -> Show View -> Component Properties)
2.5) Click the Dependencies tab, and add a dependency to the DC created in Step 1. Do not change any of the default options.
2.6) Click the Permissions tab, and check Entity Forwarding Allowed.
2.7) Click the Public Parts tab and create a new Public Part of type COMPILATION. Give it a name, eg. pp_export_excel
2.8) Right-click this public part, choose Reference Entities and select the COMPILATION public part defined in step 1.6 above.
2.9) Right-click this dc, and do Development Component -> Build.
Step 3: Using the External Library in Your Web Dynpro Application
3.1) Switch to Web Dynpro perspetive.
3.2) View the Component Properties (Window -> Show View -> Component Properties)
3.3) Highlight your Web Dypro dc, and then in the Component Properties window select the Dependencies tab.
3.4) Add a dependency to the dc created in Step 2. Accept all default options.
3.5) Build and deploy the Web Dynpro dc. If you have not changed any of the default options along the way, you will notice that the EAR of Step 2 also gets deployed.
Your Web Dypro dc should now compile correctly and also run on the server as expected.
Best regards, and good luck,
I have not added to your "web dynpro project references" in "library references" the name of your JXL (not the library DC)
Any details how this is to be done.
I have simply pasted the jar file into the labraries folder, what all should I specify for the vendor ?
Also in CE 7.1 the option to specify the exact name of the library DC has been deprecated. Instead I have added a dependency to the EAR file
Edited by: Brian Fernandes on Jul 2, 2010 11:28 AM