Hi,

Thank you.
The static variable in the class(class resides inside the jar of shared lib)
got printed when i call it from the components MyEndpoint.java , so i
thought it got included.

FYR

my-sl  shared library's

POM

<project xmlns="http://maven.apache.org/POM/4.0.0";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd";>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mycompany</groupId>
  <artifactId>my-sl</artifactId>
  <packaging>jbi-shared-library</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>A custom project</name>
  <url>http://www.myorganization.org</url>
  <pluginRepositories>
    <pluginRepository>
      <id>apache.incubating</id>
      <name>Apache Incubating Repository</name>
      <url>http://people.apache.org/repo/m2-incubating-repository</url>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <releases>
        <enabled>true</enabled>
      </releases>
        </pluginRepository>
        <pluginRepository>
          <id>apache.snapshots</id>
          <name>Apache Snapshots Repository</name>
          <url>http://people.apache.org/repo/m2-snapshot-repository</url>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
          <releases>
            <enabled>false</enabled>
          </releases>
        </pluginRepository>
  </pluginRepositories>
  <repositories>
    <repository>
      <id>apache.incubating</id>
      <name>Apache Incubating Repository</name>
      <url>http://people.apache.org/repo/m2-incubating-repository</url>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <releases>
        <enabled>true</enabled>
      </releases>
    </repository>
    <repository>
      <id>apache.snapshots</id>
      <name>Apache Snapshots Repository</name>
      <url>http://people.apache.org/repo/m2-snapshot-repository</url>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
      <releases>
        <enabled>false</enabled>
      </releases>
    </repository>
  </repositories>
  <properties>
    <servicemix-version>3.2</servicemix-version>
  </properties>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>

        <dependency>
         <groupId>com.test.util</groupId>
         <artifactId>testing</artifactId>
         <version>1.0-SNAPSHOT</version>        
        </dependency>   

  </dependencies>
  <build>
        <resources>
      <resource>
        <directory>src/main/resources</directory>
        <includes>
          <include>**/*</include>
        </includes>
      </resource>    
    </resources>
    <plugins>
      <plugin>
        <groupId>org.apache.servicemix.tooling</groupId>
        <artifactId>jbi-maven-plugin</artifactId>
        <version>${servicemix-version}</version>      
        <extensions>true</extensions>     
      </plugin>     
    </plugins>
  </build>
</project>


jbi.xml

<?xml version="1.0" encoding="UTF-8"?>
<jbi xmlns="http://java.sun.com/xml/ns/jbi"; version="1.0">
  <shared-library class-loader-delegation="parent-first"
version="1.0-SNAPSHOT">
    <identification>
      <name>my-sl</name>
      <description>A custom project</description>
    </identification>
    <shared-library-class-path>
      <path-element>lib/my-sl-1.0-SNAPSHOT.jar</path-element>
      <path-element>lib/testing-1.0-SNAPSHOT.jar</path-element>
    </shared-library-class-path>
  </shared-library>
</jbi>

SU's xbean.xml

<beans xmlns:http="http://com.test.http/1.0"; 
       xmlns:ht="http://test.http";>
  <http:endpoint service="ht:http" endpoint="httpendpoint" />
  <classpath>
        <library>my-sl</library>  
  </classpath>  
</beans>


Barath.


gnodet wrote:
> 
> I suspect your shared library to not be correct.
> Can you post the its pom ?
> Did you make sure it includes the needed jar and that the jar are
> referenced
> in the generated jbi.xml inside the SL ?
> 
> On Thu, Feb 21, 2008 at 7:53 AM, Barath <[EMAIL PROTECTED]> wrote:
>>
>>  BTW,
>>  package of Constanttest.class is com.test.util only.
>>
>>  Barath.
>>
>>
>>
>>
>>  Barath wrote:
>>  >
>>  > 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-tp15585373s12049p15605798.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-tp15585373s12049p15610023.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to