cancel
Showing results for 
Search instead for 
Did you mean: 

Adding External Jars in Module development

Former Member
0 Kudos

Dear Friends,

Actually i am adding an external Jar file in my EJB Module in NWDS.I am using this jar file for converting XML to flat file and i am calling this module from Receiver ommunication channel.For this process, i am importing dom4j.jar file in the EJB Module.I have created a jar file for that module,

Now i have created an external Library project for the cause that i have used the external jar file, and i have made following code in the provider.xml file

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE provider-descriptor SYSTEM "library.provider.dtd">

<provider-descriptor>

<display-name>

XML2EDI_Library

</display-name>

<component-name>

XML2EDI_Library

</component-name>

<major-version>6</major-version>

<minor-version>40</minor-version>

<micro-version>0</micro-version>

<provider-name>

dom4j.org

</provider-name>

<references>

<reference

provider-name="dom4j.org"

strength="weak"

type="library">org.dom4j.Document</reference>

<reference

provider-name="dom4j.org"

strength="weak"

type="library">org.dom4j.DocumentException</reference>

<reference

provider-name="dom4j.org"

strength="weak"

type="library">org.dom4j.Element</reference>

<reference

provider-name="dom4j.org"

strength="weak"

type="library">org.dom4j.io.SAXReader</reference>

</references>

<jars>

<jar-name>EDI_Module.jar</jar-name>

</jars>

</provider-descriptor>

I have included 4 references because i have imported following in my ejb module.

import org.dom4j.Document;

import org.dom4j.DocumentException;

import org.dom4j.Element;

import org.dom4j.io.SAXReader;

I am not sure of wht to include in reference target and provider name, I am getting the following exceptions in Message monitoring:

1. AO: Document Exception: org.dom4j.DocumentException: E:\usr\sap\BWS\DVEBMGS00\j2ee\cluster\server0\

2. Nested exception: E:\usr\sap\BWS\DVEBMGS00\j2ee\cluster\server0\

Help me in this issue..

Thanks in advance

N.Jayanth Kumar

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Jayanth,

You need to have your EJB name and JNDI name in your .jar file, then you need create an EAR file. For your Refference

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/02706f11-0d01-0010-e5ae-ac25e74c...

regards,

sri.

Answers (1)

Answers (1)

stefan_grube
Active Contributor
0 Kudos

You should not reference each class individually, but the JNDI name of your library project, where the classes are included.

Stefan

Former Member
0 Kudos

Dear Stefan,

We give the JNDI Name in the ejb-j2ee-engine.xml right?? I have the problem in my provider.xml in my Library project apart from my EAR and EJB Module.

Should i reference my JNDI name which is given in the ejb-j2ee-engine.xml in my provider.xml in my Library Project??

Thanks in Advance,

N.Jayanth Kumar

Former Member
0 Kudos

Hi Jayanth,

We give the JNDI Name in the ejb-j2ee-engine.xml right? - Yes

Should i reference my JNDI name which is given in the ejb-j2ee-engine.xml in my provider.xml in my Library Project? - In your ejb-j2ee-engine.xml give JNDI name the same name as your EJB module class name.

Regards,

Rajeev Gupta

stefan_grube
Active Contributor
0 Kudos

> Should i reference my JNDI name which is given in the ejb-j2ee-engine.xml in my provider.xml in my Library Project??

You have to choose the JNDI name of the libary, where the classes

org.dom4j.Document

org.dom4j.DocumentException

org.dom4j.Element

org.dom4j.io.SAXReader

are included. Unfortunately I do no know the JNDI name and cannot help you here.

Stefan

Former Member
0 Kudos

Dear Stefan,

I will explain my problem here..in brief

1. I have created an EJB Module and adding an external jar dom4j.jar

2. I have the my jndi name as XmltoText

3. In my application-j2ee-engine.xml in my EAR file...i have included :

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE application-j2ee-engine SYSTEM "application-j2ee-engine.dtd">

<application-j2ee-engine>

<reference

reference-type="weak">

<reference-target

provider-name="dom4j.org"

target-type="application">TEST_LIBRARY

</reference- target>

</reference>

<fail-over-enable mode="disable"/>

</application-j2ee-engine>

TEXT_LIBRARY is name of my Library Project.Please tell me corrections in the above code...i have doubt regarding provider name.

4. As i have added external jar file in my ejb module..._i have created a Library project and in that project in provider.xml_ file i have included the following code...

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE provider-descriptor SYSTEM "library.provider.dtd">

<provider-descriptor>

<display-name>TEXT_LIBRARY</display-name>

<component-name>TEXT_LIBRARY</component-name>

<major-version>6</major-version>

<minor-version>40</minor-version>

<micro-version>0</micro-version>

<provider-name>****</provider-name>

<references>

<reference

provider-name="****"

strength="weak"

type="library">****</reference>

</references>

<jars>

<jar-name>EJBModule.jar</jar-name> (This is my EJB Module jar file)

</jars>

</provider-descriptor>

Now what should i include in the places of **** in the references above??

Thanks and Regards,

N.Jayanth Kumar

stefan_grube
Active Contributor
0 Kudos

I see. The dom4j.jar is part of the library.

In that case you need not a reference in the provider.xml.

Just add the dom4j.jar in the jars section.

I do not understand, what EJBModule.jar is. Is this the EJB which uses the library? In that case it does not make sense to include this jar here.

Regards

Stefan

Former Member
0 Kudos

Dear Stefan,

EJBModule.jar is the one i got when i did Build EJB Archive.....Should i include my dom4j.jar file as

<jars>

<jar-name>dom4j.jar</jar-name>

</jars>

Is the creation of Library Project necessary if i use external jar file here? in this context?? Did i do any mistake in creating the Library project?? Give me a brief description about the steps if i use an external jar file in my EJB Module...Please help me out in this issue....

Thanks,

N.Jayanth Kumar

stefan_grube
Active Contributor
0 Kudos

Yes, if you use an external jar, you need a library project.

But if it is just one, you can also store this in the aii_af_jmsproviderlib.sda.

The reference in that case would be com.sap.aii.af.jmsproviderlib

On the other side you might use use functionality from sapxmltoolkit.jar instead of dom4j.jar.

Regards

Stefan

Edited by: Stefan Grube on Apr 9, 2008 11:15 AM

Former Member
0 Kudos

Dear Stefan,

Thanks a lot....for your help..I will try it out with the jmsproviderlib..and contact you if i have any doubts. Please help me if i ask any doubts regarding this..

Regards,

N.Jayanth Kumar

Former Member
0 Kudos

Dear Stefan,

Please give me a brief description of how to add external jar files by creating Library Project....We need this process..Help me out..

Thanks in advance,

N.Jayanth Kumar

stefan_grube
Active Contributor
0 Kudos

You can do it like in this blog:

/people/community.user/blog/2006/10/24/applications-and-shared-libraries

But you do not write code, instead you upload the external jar to the source folder of the Java project.

So you always need two projects for creating a library SDA.

Regards

Stefan

Former Member
0 Kudos

Dear Stefan,

As mentioned in the weblog, as per the comments mentioned in it..

"with lower versions 04 & 04s it is also possible.

Create a new Project (I'm using NW DS 2.0.xx). In the upcomming Dialog select "J2EE Server Component" and then "Library". Add you jars to the provider.xml.

In the J2EE Perspective you can build the sda and deploy it to the server. Applications using the library have to set a library refernce in their application-j2ee-engine.xml. "

I have created a Library Project....and which JAR File i have to add to provider.xml(Is it the external jar) and the what are the references that i have to create??

Thanks and regards,

N.Jayanth Kumar

stefan_grube
Active Contributor
0 Kudos

First create a plain Java project and upload the library to the source folder.

Then you create a library project and refer to the Java project.

Regards

Stefan