Skip to Content
author's profile photo Former Member
Former Member

Using external JARs in Web Dynpro Dev.Component

Hi,

I wonder how to use external JARu00B4s (e.g. the <b>commons-lang.jar</b> of the jakarta commons project) in a Web Dynpro Development Component.

I copied the JAR file into the lib directory of my Dev.component project, added it to the build path and built the project.

At runtime I get a "<b>java.lang.NoClassDefFoundError: org/apache/commons/lang/WordUtils</b>"

When inspecting the generated EAR resp. WDA file I can see that the JAR file is located in /PORTAL-INF/classes directory of the WDA file. It is also extracted to the folder

\usr\sap\...\server0\apps\<vendor>\<compname>\webdynpro\public\classes

This folder is displayed as classes directory in the classloader service of Visual Administrator.

So, why is the class not found at runtime?

Additionally I recognized another curious effect. When using the "development component - build" command from context menu of my dev. component the JAR file is deleted from the build path of my project whereas rebuilding the project works fine.

This is no problem as long as I donu00B4t define public parts for my dev. component. But when defining them they will only be generated and packed into the EAR file if I choose "development component - build" and this is not possible because the external JAR file is not found anymore at the build path.

Thx in advance

Helmut

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 21, 2004 at 09:59 PM

    You can't really use the lib directory since it is intended for local projects.

    I described our workaround here

    addition-of-new-external-jar-to-webdynpro

    You have 2 options:

    1. Add that jar to a library project. Deploy separatedly.

    2. Create a DC component-like structure for the new jar by unzipping the jar file and creating an 'Assembly' public part that includes the folder tree of this jar.

    Option 1 works best if you have many jars that you want to deploy. But you lose integration into the DTR.

    Option 2 archieves the same effect as the lib directory, as you only need to compile your jar once and it gets added into the generated wda correctly.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      You can import the jar files into your file system in the Navigator perspective. IIRC, the library approach only worked if you create it as a local project, not a DTR DC project.

      I personally prefer the second approach as the whole idea of JAR files goes away, I just look at a jar file as another DC project.

  • author's profile photo Former Member
    Former Member
    Posted on Dec 19, 2004 at 09:03 AM

    Hi Helmut,

    did you find out a workaround ? I have the same problem with external JARs.

    Regards,

    Claus

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.