Skip to main content

Adding external jars

16 replies [Last post]
cojones_grandes
Offline
Joined: 2007-06-11
Points: 0

Hi Guys,

I've got a little problem with adding an external jar to my SLEE-Project.
I have included an external jar in the usual way over the project properties.
Using some classes my project could not be built, because those classes could not be found. After adding the following lines in my build.xml, build was succesfull:
___________________________________________________________________________
...

...
___________________________________________________________________________

Now my my service can be builded and deployed. But at the point where one of the classes is used I recieve an exeption, saying that the source is unknown.

Are there any more settings to do?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
baranowb
Offline
Joined: 2006-01-09
Points: 0

Ha. Add directory to You jar "library" - see how RAs are packaged with dependencies - either in ra.jar or in DU there is library dir with all additional jars. Jars that are mentioned in deployable-unit.xml must be valid SLEE jars, jars that are not mentioned and xml file and are present in root path or subpaths (not /lirbrary) are ignored. Those that are mentioned in xml file and are not SLEE components cause errors.

cojones_grandes
Offline
Joined: 2007-06-11
Points: 0

Ok, what i did now was:
I have created a new folder "ext-lib" under MyProject/lib/DU. rightclicked on th folder and imported the two external jars "tar.jar" and "activation jar". After that there were 3 new dirs in ext-lib. Two dirs with dependencies to the external classes and a META-INF dir.
I also have copied the two jars manually in "ext-lib", created a folder named "library" in MyProject/lib/DU/ext-lib/ and copied the two jars into the "library" dir.

After that i have added the following two lines in my build.xml under

...

and referenced them by adding the following to my build-target in the classpath-tag:

these steps are neccessary, otherwise the sbb can't be builded.

And of course I have added these two external jars to my java build path by right clicking on MyProject->properties->Java Build Path->add jars.

Finally I have added the following line to my MANIFEST.MF:

Class-Path: library/tar.jar library/activation.jar

...And I still have the same problem... :(

eduardomartins
Offline
Joined: 2005-10-10
Points: 0

Put the lib jars in a folder named "library" inside the DU.

cojones_grandes
Offline
Joined: 2007-06-11
Points: 0

No, it doesn't help

eduardomartins
Offline
Joined: 2005-10-10
Points: 0

It should, pls post the ant script xml.

cojones_grandes
Offline
Joined: 2007-06-11
Points: 0

do you mean the build.xml?

eduardomartins
Offline
Joined: 2005-10-10
Points: 0

yes

cojones_grandes
Offline
Joined: 2007-06-11
Points: 0

Here it comes:


classpath="lib\slee-tasks.jar" name="sbbjar"/>
classpath="lib\slee-tasks.jar" name="eventjar"/>
classpath="lib\slee-tasks.jar" name="profilespecjar"/>
classpath="lib\slee-tasks.jar" name="deployablejar"/>
classname="org.mobicents.eclipslee.ant.ResourceAdaptorTypeJar"
classpath="lib\slee-tasks.jar" name="resourceadaptortypejar"/>
classname="org.mobicents.eclipslee.ant.ResourceAdaptorJar"
classpath="lib\slee-tasks.jar" name="resourceadaptorjar"/>















includes="beil/fokus/external/TarClientSbb.java,beil/fokus/external/TarClientSbbLocalObject.java" srcdir="src">



destfile="jars/TarClient-sbb.jar" sbbjarxml="src/beil/fokus/external/TarClient-sbb-jar.xml"/>








includes="beil/fokus/external/ExternalSbb.java" srcdir="src">



destfile="jars/External-sbb.jar" sbbjarxml="src/beil/fokus/external/External-sbb-jar.xml"/>







file="src/beil/fokus/external/External-deployable-unit.xml" tofile="classes/External-DU/deployable-unit.xml"/>





















eduardomartins
Offline
Joined: 2005-10-10
Points: 0

Change target build-External-DU to:















cojones_grandes
Offline
Joined: 2007-06-11
Points: 0

EDUARDO, YOU'RE GREAT

baranowb
Offline
Joined: 2006-01-09
Points: 0

> Hi Guys,
>
> I've got a little problem with adding an external jar
> to my SLEE-Project.
> I have included an external jar in the usual way over
> the project properties.
> Using some classes my project could not be built,
> because those classes could not be found. After
> adding the following lines in my build.xml, build was
> succesfull:
> ______________________________________________________
> _____________________
> ...
>
>
>
> ement
> location="lib\tar.jar\com.ice.tar.TarEntry.class"/>
>
> ement
> location="lib\tar.jar\com.ice.tar.TarInputStream.class
> "/>
> ...
> ______________
That doesnt seem right
________________________________________
> _________
>
> Now my my service can be builded and deployed. But at
> the point where one of the classes is used I recieve
> an exeption, saying that the source is unknown.
>

Stack trace? Possibly classes were compiled with different version of library YOu are using?

> Are there any more settings to do?

cojones_grandes
Offline
Joined: 2007-06-11
Points: 0

OK, here's the Stack trace. Maybe you can see something in there :)

2007-06-27 14:49:59,575 13730183 ERROR [org.mobicents.slee.runtime.EventRouterImpl] (7b1f27d7115c79f8:-4cc3efa0:1136c69c017:-7f2b,EventTypeID[javax.sip.message.Request.INVITE#javax.sip#1.1], #13:) Failure while routing event; second phase. Event Posting [eventTypeId:EventTypeID[javax.sip.message.Request.INVITE#javax.sip#1.1], #13, event:org.mobicents.slee.resource.sip.wrappers.RequestEventWrapper[source=org.mobicents.slee.resource.sip.SipProviderProxy@1261f7f], activity:z9hG4bK-d87543-6902ce2cca602f01-1--d87543-_INVITE, address:SIP: "ivelin" ]
javax.slee.TransactionRolledbackLocalException: Invocation resulted in exception !
at org.mobicents.slee.container.deployment.interceptors.SbbLocalObjectInterceptor.invokeAndReturnObject(SbbLocalObjectInterceptor.java:76)
at org.mobicents.slee.container.deployment.interceptors.SbbLocalObjectInterceptor.invokeAndReturnvoid(SbbLocalObjectInterceptor.java:101)
at beil.fokus.sipepg.EpgClientSbbLocalObjectImpl.dosth(EpgClientSbbLocalObjectImpl.java)
at beil.fokus.sipepg.SipEpgSbb.onRequestEvent(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.mobicents.slee.runtime.SbbEntity.invokeEventHandler(SbbEntity.java:1377)
at org.mobicents.slee.runtime.EventRouterImpl.routeQueuedEvent(EventRouterImpl.java:1085)
at org.mobicents.slee.runtime.EventRouterImpl.access$100(EventRouterImpl.java:71)
at org.mobicents.slee.runtime.EventRouterImpl$EventExecutor.run(EventRouterImpl.java:165)
at EDU.oswego.cs.dl.util.concurrent.QueuedExecutor$RunLoop.run(QueuedExecutor.java:89)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NoClassDefFoundError: com/ice/tar/TarInputStream
at beil.fokus.sipepg.EpgClientSbb.dosth(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.mobicents.slee.container.deployment.interceptors.SbbLocalObjectInterceptor.invokeAndReturnObject(SbbLocalObjectInterceptor.java:72)
... 13 more
2007-06-27 14:49:59,642 13730250 ERROR [org.mobicents.slee.runtime.EventRouterImpl] (7b1f27d7115c79f8:-4cc3efa0:1136c69c017:-7f2b,EventTypeID[javax.sip.message.Request.INVITE#javax.sip#1.1], #13:) Caught RuntimeException in invoking SLEE originated invocation
javax.slee.TransactionRolledbackLocalException: Invocation resulted in exception !
at org.mobicents.slee.container.deployment.interceptors.SbbLocalObjectInterceptor.invokeAndReturnObject(SbbLocalObjectInterceptor.java:76)
at org.mobicents.slee.container.deployment.interceptors.SbbLocalObjectInterceptor.invokeAndReturnvoid(SbbLocalObjectInterceptor.java:101)
at beil.fokus.sipepg.EpgClientSbbLocalObjectImpl.dosth(EpgClientSbbLocalObjectImpl.java)
at beil.fokus.sipepg.SipEpgSbb.onRequestEvent(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.mobicents.slee.runtime.SbbEntity.invokeEventHandler(SbbEntity.java:1377)
at org.mobicents.slee.runtime.EventRouterImpl.routeQueuedEvent(EventRouterImpl.java:1085)
at org.mobicents.slee.runtime.EventRouterImpl.access$100(EventRouterImpl.java:71)
at org.mobicents.slee.runtime.EventRouterImpl$EventExecutor.run(EventRouterImpl.java:165)
at EDU.oswego.cs.dl.util.concurrent.QueuedExecutor$RunLoop.run(QueuedExecutor.java:89)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NoClassDefFoundError: com/ice/tar/TarInputStream
at beil.fokus.sipepg.EpgClientSbb.dosth(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.mobicents.slee.container.deployment.interceptors.SbbLocalObjectInterceptor.invokeAndReturnObject(SbbLocalObjectInterceptor.java:72)
... 13 more

alexandrem
Offline
Joined: 2005-10-19
Points: 0

The class is not found... are you including the jar in the Deployable Unit ?

Alexandre Mendonça

cojones_grandes
Offline
Joined: 2007-06-11
Points: 0

Yes, I tried.

I have added the following lines to my d-u.xml...

jars/tar.jar
jars/activation.jar

But then the service can not be deployed....Error extracting jar file :(

Is it normal that I have to add external jars to my DU? Because trying to modify my DU automatically, the external jar files were not found by eclipse and I had to add those lines manually

lucaf
Offline
Joined: 2007-02-07
Points: 0

try adding an extra directory in your DU-jar (for example "ext-lib"), copy your two jars in it, and then add the following line in the META-INF/MANIFEST.MF:

Class-Path: ext-lib/tar.jar ext-lib/activation.jar

and undo the changes you did in your deployable-unit.xml

I hope it works
bye
luca

cojones_grandes
Offline
Joined: 2007-06-11
Points: 0

Hi lucaf, thanks for helping :)

But what do you mean with DU-jar? And where do I find the META-INF/MANIFEST.MF, do I have to create a new one?

Never thought it could be so complicated to add external resource to a SLEE project. In the EclipSLEE-guide is just mentioned to copy external jars in the lib-folder.