Ok, I finally figured this out. For SU's you place classpath entries into
xbean.xml rather than jbi.xml. Suppose for instance I have referenced a
third-party jar called MyJar.jar in a jsr 181 SU. The xbean needs to have
an entry such as
<classpath>
<location>lib/MyJar.jar</location>
</classpath>
Then, if you look in the zip file created by an mvn install, your lib dir
should have that jar in it. It places it in there, because you specified a
dependency on it in the pom.xml such as:
<dependency>
<groupId>com.mycompany</groupId>
<artifactId>Myjar</artifactId>
<version>1.0</version>
</dependency>
The xbean takes the path relative of the SU, so lib is the only part of the
path you need to specify in the xbean classpath entry.
Benamin wrote:
>
> Since it doesn't seem like classpath can be changed for an SU, would it
> make sense to try to change the classpath within the code for the jsr181
> SU I am deploying?
>
>
> Benamin wrote:
>>
>> I put the 1.4 in the dependency section, so I guess it automatically adds
>> that to the file name when it creates the lib directory.
>>
>> At the moment I am looking at Sun's website for adding classpath to
>> jbi.xml. It has examples for adding classpath for jbi components but not
>> for SU's.
>>
>> http://java.sun.com/integration/pa1/docs/dev_guide/appendix_a.html
>>
>>
>>
>> Gert Vanthienen wrote:
>>>
>>> L.S.,
>>>
>>>
>>> Which version of jaxrpc did you specify as a dependency in the pom.xml
>>> file? Where do you see this jaxrpc.jar (without the version number)?
>>>
>>>
>>> Gert
>>>
>>>
>>> Benamin wrote:
>>>> Yes, the jar is there. I do notice the name is slightly different. It
>>>> includes the version of the jar within the name like jaxrpc.jar has
>>>> become
>>>> jaxrpc-1.4.jar.
>>>>
>>>>
>>>>
>>>> Gert Vanthienen wrote:
>>>>> Benamin,
>>>>>
>>>>>
>>>>> Can you check if the resulting SU archive contains a lib directory
>>>>> with
>>>>> the required JAR in there? Normally, if you add a dependency to a SU
>>>>> pom.xml file, it is copied to the target/xxx-...-installer/lib
>>>>> directory
>>>>> to be packaged with the SU.
>>>>>
>>>>>
>>>>> Gert
>>>>>
>>>>> Benamin wrote:
>>>>>> I'm building both a JBI component and a Service Unit. I have now
>>>>>> figured
>>>>>> out
>>>>>> how to get ServiceMix to recognize the jars in the JBI component (for
>>>>>> others
>>>>>> that are having this problem, see my next post for solution), but I
>>>>>> am
>>>>>> still
>>>>>> having problems with the Service Unit.
>>>>>>
>>>>>> I am building a Service Unit based on a JSR 181 component. The third
>>>>>> party
>>>>>> jar I am adding is for Web Service support. I added jaxrpc.jar to
>>>>>> the
>>>>>> dependency section of the pom, so that it would build correctly, but
>>>>>> at
>>>>>> runtime I get the no class def found error for one of the classes in
>>>>>> jaxrpc.jar. The version of ServiceMix is 3.1. Thanks.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Gert Vanthienen wrote:
>>>>>>> L.S.,
>>>>>>>
>>>>>>> Some additional questions...
>>>>>>> - Are you building a service unit or a JBI component?
>>>>>>> - What version of ServiceMix are you using?
>>>>>>> - Can you give an example of a third party jar that causes you the
>>>>>>> problem?
>>>>>>>
>>>>>>> Gert
>>>>>>>
>>>>>>> Benamin wrote:
>>>>>>>> I can build ServiceMix components with third party jars, but I get
>>>>>>>> errors
>>>>>>>> at
>>>>>>>> runtime, such as no class found errors. It appears the jars do get
>>>>>>>> packaged
>>>>>>>> within the zip file that ServiceMix creates in the target
>>>>>>>> directory. If
>>>>>>>> I
>>>>>>>> put the jars into the $SERVICEMIX_HOME/lib dir manually, it works,
>>>>>>>> I
>>>>>>>> don't
>>>>>>>> get the NO class found errors.
>>>>>>>>
>>>>>>>> Why does SMIX seem to ignore the jars it packages in the .zip file?
>>>>>>>>
>>>>>
>>>>
>>>
>>>
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/runtime-error-when-referencing-third-party-jars-tf4098572s12049.html#a11676319
Sent from the ServiceMix - User mailing list archive at Nabble.com.