« Return to Thread: [SMX4] Error exposing a HTTP Provider SU through OSGi

[SMX4] Error exposing a HTTP Provider SU through OSGi

by TheWinch :: Rate this Message:

Reply to Author | View in Thread

Hello all,

I followed the excellent tutorial from here. I managed to run the tutorial to end, which means that I can deploy ServiceMix::File and ServiceMix::Bean service units using OSGi.

I used the same process to expose a ServiceMix::HTTP provider SU (find code below).
When I deploy my bundle, I get the following error:

Unable to create application context for [eu.diva.tis.messaging.organizations.soap-connector], unsatisfied dependencies: none
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to load type: org.apache.servicemix.http.endpoints.HttpProviderEndpoint. Reason: java.lang.ClassNotFoundException: org.apache.servicemix.http.endpoints.HttpProviderEndpoint; nested exception is java.lang.ClassNotFoundException: org.apache.servicemix.http.endpoints.HttpProviderEndpoint
I thought this was because my pom.xml only specified org.apache.servicemix.http in the Import-Package section, so I added ...http.endpoints. But then I get this exception :

org.osgi.framework.BundleException: Unresolved constraint in bundle 165: package; (package=org.apache.servicemix.http.endpoint)
I guess the solution is either to embed servicemix-http in the bundle, or try a way to get the ....http.ednpoint package imported. But I can't find how. Does someone have a solution ?

POM.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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>eu.diva.tis.messaging.organizations</groupId>
  <artifactId>soap-connector</artifactId>
  <packaging>bundle</packaging>
  <name>DiVA :: Messaging :: Organizations SOAP Connector</name>
  <version>0.0.1-SNAPSHOT</version>
  <dependencies>
    <dependency>
    <groupId>org.apache.servicemix</groupId>
    <artifactId>servicemix-http</artifactId>
    <version>2009.01</version>
    </dependency>
  </dependencies>
  <build>
  <resources>
      <resource>
        <directory>src/main/resources</directory>
        <includes>
          <include>**/*</include>
        </includes>
      </resource>    
    </resources>
    <plugins>
      <!-- configure the bundle plugin with some additional imports -->
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>2.0.0</version>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <Import-Package>org.apache.servicemix.http,org.apache.servicemix.http.endpoint,org.apache.servicemix.bean,org.apache.servicemix.common.osgi,*</Import-Package>
          </instructions>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <properties>
  <servicemix-version>4.0.0</servicemix-version>
        </properties>
</project>

META-INF/spring/beans.xml :

<?xml version="1.0" encoding="utf-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:http="http://servicemix.apache.org/http/1.0"
       xmlns:msg="http://tis.diva.eu/messaging"
       xsi:schemaLocation="
         http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans.xsd
         http://servicemix.apache.org/http/1.0 
           http://servicemix.apache.org/schema/servicemix-http-2009.01.xsd" >
         
    <!-- use this special class to register the endpoints with the NMR -->
    <bean class="org.apache.servicemix.common.osgi.EndpointExporter" />

    <http:provider service="msg:organizations"
                   endpoint="soap"
                   locationURI="http://localhost:9003/OrganizationService" />            
   
</beans>

 « Return to Thread: [SMX4] Error exposing a HTTP Provider SU through OSGi