You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by anton_dak <ku...@dakosy.de> on 2012/07/18 11:56:50 UTC

Can't use camel-servlet in ServiceMix 4..4.0

Hi all,

I have tried to bring the camel-servlet to run but I get the following
errors in my servicemix log:

springframework.osgi.extender - 1.2.1 | Timeout occurred before finding
service dependencies for
[OsgiBundleXmlApplicationContext(bundle=test-test-consumer-layer,
config=osgibundle:/META-INF/spring/*.xml)]
...
unsatisfied dependencies: Dependency on
[(objectClass=org.apache.camel.component.http.CamelServlet)] (from bean
[&servletref]


First of all, I have installed the camel-servlet feature.

My spring.xml conatins the following:

<bean id="camelServlet"
class="org.apache.camel.component.servlet.CamelHttpTransportServlet"/>
   
    <osgi:service ref="camelServlet">
        <osgi:interfaces>
            <value>javax.servlet.Servlet</value>
            <value>org.apache.camel.component.http.CamelServlet</value>
        </osgi:interfaces>
        <osgi:service-properties>
            <entry key="alias" value="/camel/services" />
            <entry key="matchOnUriPrefix" value="true" />
            <entry key="servlet-name" value="CamelServlet"/>
        </osgi:service-properties>
    </osgi:service>
    
    <osgi:reference id="servletref"
interface="org.apache.camel.component.http.CamelServlet">
          <osgi:listener bind-method="register" unbind-method="unregister">
             <ref bean="httpRegistry"/>
          </osgi:listener>
    </osgi:reference>
    
    <bean id="httpRegistry"
class="org.apache.camel.component.servlet.DefaultHttpRegistry"/>
        
    <bean id="servlet"
class="org.apache.camel.component.servlet.ServletComponent">
        <property name="httpRegistry" ref="httpRegistry" />
    </bean>

In my maven pom.xml I have added the following packages to the
"Import-Package" tag:
org.apache.camel.component.http,
org.apache.camel.component.servlet

Without the camel-servlet my application runs well in ServiceMix 4.4.0.

--
View this message in context: http://servicemix.396122.n5.nabble.com/Can-t-use-camel-servlet-in-ServiceMix-4-4-0-tp5713911.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Can't use camel-servlet in ServiceMix 4..4.0

Posted by anton_dak <ku...@dakosy.de>.
Hi,

if I see into the web console in features area the feature "camel-servlet"
is installed.
If I see into the bundles area the bundle "camel-servlet" is active. 

--
View this message in context: http://servicemix.396122.n5.nabble.com/Can-t-use-camel-servlet-in-ServiceMix-4-4-0-tp5713911p5713913.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Can't use camel-servlet in ServiceMix 4..4.0

Posted by "ajs6f@virginia.edu" <aj...@virginia.edu>.
This may be pretty basic, but have you checked to see that the
camel-servlet feature successfully installed and started?

---
A. Soroka
Online Library Environment
the University of Virginia Library

On Wed, Jul 18, 2012 at 5:56 AM, anton_dak <ku...@dakosy.de> wrote:
> Hi all,
>
> I have tried to bring the camel-servlet to run but I get the following
> errors in my servicemix log:
>
> springframework.osgi.extender - 1.2.1 | Timeout occurred before finding
> service dependencies for
> [OsgiBundleXmlApplicationContext(bundle=test-test-consumer-layer,
> config=osgibundle:/META-INF/spring/*.xml)]
> ...
> unsatisfied dependencies: Dependency on
> [(objectClass=org.apache.camel.component.http.CamelServlet)] (from bean
> [&servletref]
>
>
> First of all, I have installed the camel-servlet feature.
>
> My spring.xml conatins the following:
>
> <bean id="camelServlet"
> class="org.apache.camel.component.servlet.CamelHttpTransportServlet"/>
>
>     <osgi:service ref="camelServlet">
>         <osgi:interfaces>
>             <value>javax.servlet.Servlet</value>
>             <value>org.apache.camel.component.http.CamelServlet</value>
>         </osgi:interfaces>
>         <osgi:service-properties>
>             <entry key="alias" value="/camel/services" />
>             <entry key="matchOnUriPrefix" value="true" />
>             <entry key="servlet-name" value="CamelServlet"/>
>         </osgi:service-properties>
>     </osgi:service>
>
>     <osgi:reference id="servletref"
> interface="org.apache.camel.component.http.CamelServlet">
>           <osgi:listener bind-method="register" unbind-method="unregister">
>              <ref bean="httpRegistry"/>
>           </osgi:listener>
>     </osgi:reference>
>
>     <bean id="httpRegistry"
> class="org.apache.camel.component.servlet.DefaultHttpRegistry"/>
>
>     <bean id="servlet"
> class="org.apache.camel.component.servlet.ServletComponent">
>         <property name="httpRegistry" ref="httpRegistry" />
>     </bean>
>
> In my maven pom.xml I have added the following packages to the
> "Import-Package" tag:
> org.apache.camel.component.http,
> org.apache.camel.component.servlet
>
> Without the camel-servlet my application runs well in ServiceMix 4.4.0.
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/Can-t-use-camel-servlet-in-ServiceMix-4-4-0-tp5713911.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Can't use camel-servlet in ServiceMix 4..4.0

Posted by anton_dak <ku...@dakosy.de>.
Hi Freeman,

you are right. I have removed the needless configuration and now it works.

Everythin I hav configured is the following:

<bean id="camelServlet"
class="org.apache.camel.component.servlet.CamelHttpTransportServlet"/>
   
    <osgi:service ref="camelServlet">
        <osgi:interfaces>
            <value>javax.servlet.Servlet</value>
            <value>org.apache.camel.component.http.CamelServlet</value>
        </osgi:interfaces>
        <osgi:service-properties>
            <entry key="alias" value="/camel/services" />
            <entry key="matchOnUriPrefix" value="true" />
            <entry key="servlet-name" value="CamelServlet"/>
        </osgi:service-properties>
    </osgi:service>

<route id="startServletTestRoute">
			<from uri="servlet:///startServletTest" />
			<to uri="activemq:queue:startServletTest" />
...
		</route>

thank you and best regards

--
View this message in context: http://servicemix.396122.n5.nabble.com/Can-t-use-camel-servlet-in-ServiceMix-4-4-0-tp5713911p5713925.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Can't use camel-servlet in ServiceMix 4..4.0

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

I think you misread that doc, the example there told that you can expose camelServlet in one bundle and reference it in another bundle.
So basically you need use
<osgi:service ref="camelServlet">
       <osgi:interfaces>
           <value>javax.servlet.Servlet</value>
           <value>org.apache.camel.component.http.CamelServlet</value>
       </osgi:interfaces>
       <osgi:service-properties>
           <entry key="alias" value="/camel/services" />
           <entry key="matchOnUriPrefix" value="true" />
           <entry key="servlet-name" value="CamelServlet"/>
       </osgi:service-properties>
   </osgi:service>

and

   <osgi:reference id="servletref"
interface="org.apache.camel.component.http.CamelServlet">
         <osgi:listener bind-method="register" unbind-method="unregister">
            <ref bean="httpRegistry"/>
         </osgi:listener>
   </osgi:reference>

In different bundles.

-------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042

On 2012-7-19, at 下午1:58, anton_dak wrote:

> Hi Freeman,
> 
> I have used the example from FuseSource:
> http://fusesource.com/docs/esb/4.4.1/camel_component_ref/_IDU_SERVLET.html
> 
> Have you any idea what is wrong with my code snipptes or do you have a
> working example?
> 
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/Can-t-use-camel-servlet-in-ServiceMix-4-4-0-tp5713911p5713922.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Can't use camel-servlet in ServiceMix 4..4.0

Posted by anton_dak <ku...@dakosy.de>.
Hi Freeman,

I have used the example from FuseSource:
http://fusesource.com/docs/esb/4.4.1/camel_component_ref/_IDU_SERVLET.html

Have you any idea what is wrong with my code snipptes or do you have a
working example?

--
View this message in context: http://servicemix.396122.n5.nabble.com/Can-t-use-camel-servlet-in-ServiceMix-4-4-0-tp5713911p5713922.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Can't use camel-servlet in ServiceMix 4..4.0

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

I can't understand why you expose and reference same OSGi service in same bundle like
<osgi:service ref="camelServlet">
       <osgi:interfaces>
           <value>javax.servlet.Servlet</value>
           <value>org.apache.camel.component.http.CamelServlet</value>
       </osgi:interfaces>
       <osgi:service-properties>
           <entry key="alias" value="/camel/services" />
           <entry key="matchOnUriPrefix" value="true" />
           <entry key="servlet-name" value="CamelServlet"/>
       </osgi:service-properties>
   </osgi:service>

   <osgi:reference id="servletref"
interface="org.apache.camel.component.http.CamelServlet">
         <osgi:listener bind-method="register" unbind-method="unregister">
            <ref bean="httpRegistry"/>
         </osgi:listener>
   </osgi:reference>
-------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042

On 2012-7-18, at 下午5:56, anton_dak wrote:

> Hi all,
> 
> I have tried to bring the camel-servlet to run but I get the following
> errors in my servicemix log:
> 
> springframework.osgi.extender - 1.2.1 | Timeout occurred before finding
> service dependencies for
> [OsgiBundleXmlApplicationContext(bundle=test-test-consumer-layer,
> config=osgibundle:/META-INF/spring/*.xml)]
> ...
> unsatisfied dependencies: Dependency on
> [(objectClass=org.apache.camel.component.http.CamelServlet)] (from bean
> [&servletref]
> 
> 
> First of all, I have installed the camel-servlet feature.
> 
> My spring.xml conatins the following:
> 
> <bean id="camelServlet"
> class="org.apache.camel.component.servlet.CamelHttpTransportServlet"/>
> 
>    <osgi:service ref="camelServlet">
>        <osgi:interfaces>
>            <value>javax.servlet.Servlet</value>
>            <value>org.apache.camel.component.http.CamelServlet</value>
>        </osgi:interfaces>
>        <osgi:service-properties>
>            <entry key="alias" value="/camel/services" />
>            <entry key="matchOnUriPrefix" value="true" />
>            <entry key="servlet-name" value="CamelServlet"/>
>        </osgi:service-properties>
>    </osgi:service>
> 
>    <osgi:reference id="servletref"
> interface="org.apache.camel.component.http.CamelServlet">
>          <osgi:listener bind-method="register" unbind-method="unregister">
>             <ref bean="httpRegistry"/>
>          </osgi:listener>
>    </osgi:reference>
> 
>    <bean id="httpRegistry"
> class="org.apache.camel.component.servlet.DefaultHttpRegistry"/>
> 
>    <bean id="servlet"
> class="org.apache.camel.component.servlet.ServletComponent">
>        <property name="httpRegistry" ref="httpRegistry" />
>    </bean>
> 
> In my maven pom.xml I have added the following packages to the
> "Import-Package" tag:
> org.apache.camel.component.http,
> org.apache.camel.component.servlet
> 
> Without the camel-servlet my application runs well in ServiceMix 4.4.0.
> 
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/Can-t-use-camel-servlet-in-ServiceMix-4-4-0-tp5713911.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.