Hi,
I just tried a sample by including a jar in my-sl and in myendpoint checking
whether i can access it or not.
I am getting this error,
inside http component : below is from shared lib class
response : i am in shared lib by constanttest
ERROR - SedaQueue -
org.apache.servicemix.jbi.nmr.flow.seda
[EMAIL PROTECTED] got error processing InOut[
id: ID:172.16.5.11-1183aa41d4e-21:0
status: Active
role: provider
service: {http://test.http}http
endpoint: httpendpoint
in: null
]
java.lang.NoClassDefFoundError: com/test/util/Constanttest
at com.test.http.MyEndpoint.handleParameters(MyEndpoint.java:1
72)
at com.test.http.MyEndpoint.process(MyEndpoint.java:122)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLi
feCycle.java:538)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(Async
BaseLifeCycle.java:490)
at
org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLife
Cycle.java:46)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBoun
d(DeliveryChannelImpl.java:610)
at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlo
w.java:170)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.j
ava:167)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.jav
a:134)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
utor.java:885)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:907)
at java.lang.Thread.run(Thread.java:619)
FYR
The class inside shared-lib
package comm.teis1.util1;
public class Constanttest
{
public static final String RESPONSE = "i am in shared lib by
constanttest";
private String name = "i am contanttest";
static
{
System.out.println("hi ,i am static");
}
public Constanttest()
{
System.out.println("hi , i am constructor of constanttest");
}
public String getName()
{
System.out.println("hi , inside getName method in
constanttest");
return this.name;
}
}
method inside myendpoint
private NormalizedMessage handleParameters(NormalizedMessage in) throws
Exception
{
System.out.println("inside http component : below is from shared lib
class");
System.out.println("response : "+Constanttest.RESPONSE);
Constanttest test = new Constanttest();
System.out.println("name : "+test.getName());
System.out.println("inside http component : above is from shared lib
class");
}
MyEndpoint class : Line No 171 : Constanttest test = new Constanttest();
MyEndpoint class : Line No 122 : I called
handleParameters(NormalizedMessage) method from process method.
1 . i am unable to instantiate class which is located inside shared lib ,
why?
2 . static { } is not invoked , why?
Barath.
gnodet wrote:
>
> First, check that the shared library references the jar in its jbi.xml.
> Only jars referenced in this file will be included in the classpath.
> Do you have the full stack trace of your exception ? it may help.
>
> On Wed, Feb 20, 2008 at 3:33 PM, Barath <[EMAIL PROTECTED]> wrote:
>>
>> Hi,
>>
>> That issue is solved by giving the name that in jbi.xml. (ie my-sl)
>>
>> Now,
>>
>> My component on loading uses one of the class in my jar file which is
>> inside
>> shared lib.
>> But i am getting class not found exception.(but that class is present
>> inside
>> the jar file)
>>
>> How to find that classes or jar in the shared lib is loaded ?
>>
>> Barath.
>>
>>
>>
>>
>> Barath wrote:
>> >
>> > Hi ,
>> > Thank you.
>> >
>> > I created a shared lib my-sl and gave dependency for myjarfile.jar.
>> > my-sl-1.0-SNAPSHOT.zip contains myjarfile.jar file in lib folder.
>> >
>> > In my component's xbean i included this xml tag
>> >
>> > <classpath>
>> > <library>my-sl-1.0-SNAPSHOT</library>
>> > </classpath>
>> >
>> > 1 . I copied the my-sl-1.0-SNAPSHOT.zip to hot deploy.
>> > 2 . But when i deploy the SA in smx 3.2 its giving the following error
>> ,
>> >
>> >
>> > <loc-message>org.springframework.beans.f
>> > actory.BeanDefinitionStoreException: Unexpected exception parsing XML
>> > document f
>> > rom file
>> > [C:\apache-servicemix-3.2\data\smx\service-assemblies\my-sa\version_1
>> > \sus\my-comp\my-comp-su\xbean.xml]; nested exception is
>> > java.lang.IllegalSta
>> > teException: No such shared library: my-sl-1.0-SNAPSHOT</loc-message
>> >>
>> >
>> > Query :
>> >
>> > 1 . What i should include in <library> tag.(shared lib name or my jar
>> file
>> > name. i tried both even with the file extension too). ?
>> > 2 . Can i use this in smx 3.1.2 ?
>> >
>> > Barath.
>> >
>> >
>> >
>> >
>> > gnodet wrote:
>> >>
>> >> In the last sentence I meant "to reference the SL (shared library)
>> >> from the SUs".
>> >>
>> >> On Wed, Feb 20, 2008 at 11:36 AM, Guillaume Nodet <[EMAIL PROTECTED]>
>> >> wrote:
>> >>> Not really, this is unfortunately a limitation of the JBI
>> specification.
>> >>> The easiest solution is to embed your jar into your 3 SUs.
>> >>> However, ServiceMix can allow to work around the problem if you
>> create
>> >>> a shared library (which is a JBI artifact embedding a collection of
>> >>> jars) and if
>> >>> you add the needed entries in the SU xbean.xml (see bottom of
>> >>> http://servicemix.apache.org/classloaders.html) to reference the SA
>> >>> from the SUs.
>> >>>
>> >>>
>> >>>
>> >>> On Wed, Feb 20, 2008 at 10:35 AM, Barath <[EMAIL PROTECTED]>
>> wrote:
>> >>> >
>> >>> > Hi,
>> >>> > I have a Service Assembly with 3 Service - Units.
>> >>> >
>> >>> > All 3 SUs require a set of common classes and I would like to
>> keep
>> >>> the SA
>> >>> > self-contained.
>> >>> >
>> >>> > Is there any way I can jar the common classes and add them to
>> the
>> >>> SA,
>> >>> > something like a dependency.
>> >>> > I am assuming the structure to be something like
>> >>> >
>> >>> > Service Assembly
>> >>> > - SU1
>> >>> > - SU2
>> >>> > - SU3
>> >>> > - common.jar
>> >>> >
>> >>> > Is this possible?
>> >>> >
>> >>> > Thanks for the reply,
>> >>> > Barath
>> >>> > --
>> >>> > View this message in context:
>> >>>
>> http://www.nabble.com/Common-jars-for-a-Service---Assembly-tp15585373s12049p15585373.html
>> >>> > Sent from the ServiceMix - User mailing list archive at
>> Nabble.com.
>> >>> >
>> >>> >
>> >>>
>> >>>
>> >>>
>> >>> --
>> >>> Cheers,
>> >>> Guillaume Nodet
>> >>> ------------------------
>> >>> Blog: http://gnodet.blogspot.com/
>> >>>
>> >>
>> >>
>> >>
>> >> --
>> >> Cheers,
>> >> Guillaume Nodet
>> >> ------------------------
>> >> Blog: http://gnodet.blogspot.com/
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Common-jars-for-a-Service---Assembly-tp15585373s12049p15590247.html
>>
>>
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
>
>
--
View this message in context:
http://www.nabble.com/Common-jars-for-a-Service---Assembly-tp15585373s12049p15605739.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.