You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Filippo Balicchia <fb...@gmail.com> on 2011/04/10 08:55:41 UTC

Consume a message from Rmi

Hello,
I need to implement an example that Scheduled consumes messages from a
remote RMI Server and invoke a bean with the received message.

The server RMI in a simple hello world server that is exposed with spring
Remoting.

Could you suggest me, please, where some examples if are there or address
me, my camel route consume a message from rmi not exposed like the example
found in Camel package

Thanks for help.

--Filippo

Consume a message from Rmi

Posted by Filippo Balicchia <fb...@gmail.com>.
Hello,

I just tried what you suggest but it doesn't work

Please see the attach for example
In rmi-mock.zip there is rmi server exposed by spring remoting
and in camel-example-spring.zip a modify example and i add my rounteBuilder

from("timer://myTimer?period=30000").to("bean:helloServiceBean?method=hello");

But when i Run it stack trace say to me
that
no security manager: RMI class loader disabled)

I see that
Could you please tell where am I wrong


 Apache Camel 2.7.0 stopping
*************************************
Error occurred while running main from: org.apache.camel.spring.Main
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.camel.maven.RunMojo$1.run(RunMojo.java:415)
        at java.lang.Thread.run(Thread.java:662)
Caused by: org.springframework.beans.factory.BeanCreationException: Error
creati
ng bean with name 'helloServiceBean' defined in file
[D:\test\camel-example-spri
ng\target\classes\META-INF\spring\camel-context.xml]: Invocation of init
method
failed; nested exception is
org.springframework.remoting.RemoteLookupFailureExce
ption: Lookup of RMI stub failed; nested exception is
java.rmi.UnmarshalExceptio
n: error unmarshalling return; nested exception is:
        java.lang.ClassNotFoundException:
org.springframework.remoting.rmi.RmiIn
vocationWrapper_Stub (no security manager: RMI class loader disabled)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:291)
        at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
an(AbstractBeanFactory.java:288)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:190)
        at
org.springframework.beans.factory.support.DefaultListableBeanFactory.
preInstantiateSingletons(DefaultListableBeanFactory.java:563)
        at
org.springframework.context.support.AbstractApplicationContext.finish
BeanFactoryInitialization(AbstractApplicationContext.java:895)
        at
org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:425)
        at
org.springframework.context.support.ClassPathXmlApplicationContext.<i
nit>(ClassPathXmlApplicationContext.java:139)
        at
org.springframework.context.support.ClassPathXmlApplicationContext.<i
nit>(ClassPathXmlApplicationContext.java:93)
        at
org.apache.camel.spring.Main.createDefaultApplicationContext(Main.jav
a:185)
        at org.apache.camel.spring.Main.doStart(Main.java:139)
        at
org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
        at
org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
        at org.apache.camel.impl.MainSupport.run(MainSupport.java:136)
        at org.apache.camel.impl.MainSupport.run(MainSupport.java:322)
        at org.apache.camel.spring.Main.main(Main.java:72)
        ... 6 more
Caused by: org.springframework.remoting.RemoteLookupFailureException: Lookup
of
RMI stub failed; nested exception is java.rmi.UnmarshalException: error
unmarsha
lling return; nested exception is:
        java.lang.ClassNotFoundException:
org.springframework.remoting.rmi.RmiIn
vocationWrapper_Stub (no security manager: RMI class loader disabled)
        at
org.springframework.remoting.rmi.RmiClientInterceptor.lookupStub(RmiC
lientInterceptor.java:215)
        at
org.springframework.remoting.rmi.RmiClientInterceptor.prepare(RmiClie
ntInterceptor.java:147)
        at
org.springframework.remoting.rmi.RmiClientInterceptor.afterProperties
Set(RmiClientInterceptor.java:135)
        at
org.springframework.remoting.rmi.RmiProxyFactoryBean.afterPropertiesS
et(RmiProxyFactoryBean.java:68)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
        ... 24 more
Caused by: java.rmi.UnmarshalException: error unmarshalling return; nested
excep
tion is:
        java.lang.ClassNotFoundException:
org.springframework.remoting.rmi.RmiIn
vocationWrapper_Stub (no security manager: RMI class loader disabled)
        at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
        at java.rmi.Naming.lookup(Naming.java:84)
        at
org.springframework.remoting.rmi.RmiClientInterceptor.lookupStub(RmiC
lientInterceptor.java:200)
        ... 29 more
Caused by: java.lang.ClassNotFoundException:
org.springframework.remoting.rmi.Rm
iInvocationWrapper_Stub (no security manager: RMI class loader disabled)
        at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:375)
        at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
        at
java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
        at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
        at
sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.jav
a:197)
        at
java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:157
4)
        at
java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1495)
        at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
731)
        at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
        ... 32 more


2011/4/11 Claus Ibsen <cl...@gmail.com>

> Hi
>
> If you use spring to expose a bean then its even easier. Just invoke
> it as a bean in the Camel route
>
>  from(timer)
>   .to("bean:helloServiceBean?method=hello")
>  // and continue routing if you need to
>
>
>
> On Mon, Apr 11, 2011 at 6:20 PM, Filippo Balicchia <fb...@gmail.com>
> wrote:
> > Hello thanks for help,
> > but I don't understand how i Can call my RMI Server. from a route
> > configuration.
> > My RMI Server is expose with spring remoting.
> >
> > What i'd like to do is
> > from(timer)
> >  .to(Spring remoting client)
> >  .to(bean)
> >
> > What I don't understand is how i can define my spring remote client in th
> > route
> >
> > When i lunch my client as a stanalone clone i use the following code
> >
> > ApplicationContext ctx = new ClassPathXmlApplicationContext(
> > "rmi-client-context.xml");
> > HelloService deliveryService = (HelloService) ctx
> > .getBean("helloServiceBean");
> > System.out.println(deliveryService.hello("Hello"));
> > System.out.println(deliveryService.hello());
> >
> > and spring conf is
> >
> > <bean id="helloServiceBean"
> > class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
> >        <property name="serviceUrl"
> > value="rmi://localhost:1234/helloServiceBean"/>
> >        <property name="serviceInterface"
> > value="com.mylab.mock.commons.HelloService"/>
> >    </bean>
> >
> > Could you please tell me how i can reproduce the same Behaviour ?
> >
> > Thanks for help
> >
> > --Filippo
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > 2011/4/11 Claus Ibsen <cl...@gmail.com>
> >
> >> Hi
> >>
> >> See the rmi example in the Apache Camel 2.7 release.
> >>
> >>
> https://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-osgi-rmi/
> >>
> >>
> >> On Sun, Apr 10, 2011 at 4:02 PM, Filippo Balicchia <
> fbalicchia@gmail.com>
> >> wrote:
> >> > Hello,
> >> > thanks for response but I don't understand how i can call my remote
> >> method.
> >> >
> >> > Explanation:
> >> >
> >> > 1: Camel rounting information looks like this
> >> >
> from("timer://myTimer?period=30000").to("bean:helloServiceBean").bean(new
> >> > SomeBean());
> >> > 2: helloServiceBean is defined in a file xml called camel-context.xml
> >> that
> >> > look like this
> >> >
> >> > <beans xmlns="http://www.springframework.org/schema/beans"
> >> >       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> >       xsi:schemaLocation="
> >> >       http://www.springframework.org/schema/beans
> >> > http://www.springframework.org/schema/beans/spring-beans.xsd
> >> >       http://camel.apache.org/schema/spring
> >> > http://camel.apache.org/schema/spring/camel-spring.xsd">
> >> >
> >> >  <camelContext id="camelRmiTest"
> >> >                xmlns="http://camel.apache.org/schema/spring">
> >> >    <package>org.apache.camel.example.spring</package>
> >> >    <jmxAgent id="agent" createConnector="true"/>
> >> >  </camelContext>
> >> >
> >> >  <bean id="helloServiceBean"
> >> > class="org.apache.camel.spring.remoting.CamelProxyFactoryBean">
> >> >        <property name="serviceUrl"
> >> > value="rmi://localhost:1234/helloServiceBean"/>
> >> >        <property name="serviceInterface"
> >> > value="com.mylab.mock.commons.HelloService"/>
> >> >   </bean>
> >> > </beans>
> >> >
> >> > 3: On the server side i have
> >> > <beans>
> >> >    <bean id="helloServiceBean"
> >> > class="com.mylab.mock.server.HelloServiceImpl">
> >> >    </bean>
> >> >
> >> >    <bean class="org.springframework.remoting.rmi.RmiServiceExporter">
> >> >        <property name="serviceName" value="helloServiceBean"/>
> >> >        <property name="service" ref="helloServiceBean"/>
> >> >        <property name="serviceInterface"
> >> > value="com.mylab.mock.commons.HelloService"/>
> >> >        <property name="registryPort" value="1234"/>
> >> >    </bean>
> >> > </beans>
> >> >
> >> >
> >> > It seam is ok but when i run the package i receive the following error
> >> >
> >> > Failed delivery for exchangeId: ID-fbalicchia-4354-1302443726203-0-2.
> >> > Exhausted
> >> >  after delivery attempt: 1 caught:
> >> org.apache.camel.RuntimeCamelException:
> >> > java.
> >> > rmi.UnmarshalException: error unmarshalling return; nested exception
> is:
> >> > java.lang.ClassNotFoundException:
> org.springframework.remoting.rmi.RmiIn
> >> > vocationWrapper_Stub (no security manager: RMI class loader disabled)
> >> > org.apache.camel.RuntimeCamelException: java.rmi.UnmarshalException:
> >> error
> >> > unmar
> >> > shalling return; nested exception is:
> >> >        java.lang.ClassNotFoundException:
> >> > org.springframework.remoting.rmi.RmiIn
> >> > vocationWrapper_Stub (no security manager: RMI class loader disabled)
> >> >
> >> > How can I enable secuirty manager ?
> >> > than here i can call my remote method and how.
> >> > In new someBean at the end of rounting information is ok ?
> >> >
> >> > Thanks
> >> >
> >> > --Filippo
> >> >
> >> >
> >> >
> >> >
> >> > 2011/4/10 Claus Ibsen <cl...@gmail.com>
> >> >
> >> >> You can use the timer or quartz endpoint to trigger the scheduling.
> >> >> And then invoke the rmi service, and then after that the bean.
> >> >>
> >> >> Something like:
> >> >>
> >> >> from(timer)
> >> >>   .to(rmi)
> >> >>   .to(bean)
> >> >>
> >> >>
> >> >> On Sun, Apr 10, 2011 at 8:55 AM, Filippo Balicchia <
> >> fbalicchia@gmail.com>
> >> >> wrote:
> >> >> > Hello,
> >> >> > I need to implement an example that Scheduled consumes messages
> from a
> >> >> > remote RMI Server and invoke a bean with the received message.
> >> >> >
> >> >> > The server RMI in a simple hello world server that is exposed with
> >> spring
> >> >> > Remoting.
> >> >> >
> >> >> > Could you suggest me, please, where some examples if are there or
> >> address
> >> >> > me, my camel route consume a message from rmi not exposed like the
> >> >> example
> >> >> > found in Camel package
> >> >> >
> >> >> > Thanks for help.
> >> >> >
> >> >> > --Filippo
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> Claus Ibsen
> >> >> -----------------
> >> >> FuseSource
> >> >> Email: cibsen@fusesource.com
> >> >> Web: http://fusesource.com
> >> >> CamelOne 2011: http://fusesource.com/camelone2011/
> >> >> Twitter: davsclaus
> >> >> Blog: http://davsclaus.blogspot.com/
> >> >> Author of Camel in Action: http://www.manning.com/ibsen/
> >> >>
> >> >
> >>
> >>
> >>
> >> --
> >> Claus Ibsen
> >> -----------------
> >> FuseSource
> >> Email: cibsen@fusesource.com
> >> Web: http://fusesource.com
> >> CamelOne 2011: http://fusesource.com/camelone2011/
> >> Twitter: davsclaus
> >> Blog: http://davsclaus.blogspot.com/
> >> Author of Camel in Action: http://www.manning.com/ibsen/
> >>
> >
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> CamelOne 2011: http://fusesource.com/camelone2011/
> Twitter: davsclaus
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>

Re: Consume a message from Rmi

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

If you use spring to expose a bean then its even easier. Just invoke
it as a bean in the Camel route

 from(timer)
  .to("bean:helloServiceBean?method=hello")
  // and continue routing if you need to



On Mon, Apr 11, 2011 at 6:20 PM, Filippo Balicchia <fb...@gmail.com> wrote:
> Hello thanks for help,
> but I don't understand how i Can call my RMI Server. from a route
> configuration.
> My RMI Server is expose with spring remoting.
>
> What i'd like to do is
> from(timer)
>  .to(Spring remoting client)
>  .to(bean)
>
> What I don't understand is how i can define my spring remote client in th
> route
>
> When i lunch my client as a stanalone clone i use the following code
>
> ApplicationContext ctx = new ClassPathXmlApplicationContext(
> "rmi-client-context.xml");
> HelloService deliveryService = (HelloService) ctx
> .getBean("helloServiceBean");
> System.out.println(deliveryService.hello("Hello"));
> System.out.println(deliveryService.hello());
>
> and spring conf is
>
> <bean id="helloServiceBean"
> class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
>        <property name="serviceUrl"
> value="rmi://localhost:1234/helloServiceBean"/>
>        <property name="serviceInterface"
> value="com.mylab.mock.commons.HelloService"/>
>    </bean>
>
> Could you please tell me how i can reproduce the same Behaviour ?
>
> Thanks for help
>
> --Filippo
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> 2011/4/11 Claus Ibsen <cl...@gmail.com>
>
>> Hi
>>
>> See the rmi example in the Apache Camel 2.7 release.
>>
>> https://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-osgi-rmi/
>>
>>
>> On Sun, Apr 10, 2011 at 4:02 PM, Filippo Balicchia <fb...@gmail.com>
>> wrote:
>> > Hello,
>> > thanks for response but I don't understand how i can call my remote
>> method.
>> >
>> > Explanation:
>> >
>> > 1: Camel rounting information looks like this
>> > from("timer://myTimer?period=30000").to("bean:helloServiceBean").bean(new
>> > SomeBean());
>> > 2: helloServiceBean is defined in a file xml called camel-context.xml
>> that
>> > look like this
>> >
>> > <beans xmlns="http://www.springframework.org/schema/beans"
>> >       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> >       xsi:schemaLocation="
>> >       http://www.springframework.org/schema/beans
>> > http://www.springframework.org/schema/beans/spring-beans.xsd
>> >       http://camel.apache.org/schema/spring
>> > http://camel.apache.org/schema/spring/camel-spring.xsd">
>> >
>> >  <camelContext id="camelRmiTest"
>> >                xmlns="http://camel.apache.org/schema/spring">
>> >    <package>org.apache.camel.example.spring</package>
>> >    <jmxAgent id="agent" createConnector="true"/>
>> >  </camelContext>
>> >
>> >  <bean id="helloServiceBean"
>> > class="org.apache.camel.spring.remoting.CamelProxyFactoryBean">
>> >        <property name="serviceUrl"
>> > value="rmi://localhost:1234/helloServiceBean"/>
>> >        <property name="serviceInterface"
>> > value="com.mylab.mock.commons.HelloService"/>
>> >   </bean>
>> > </beans>
>> >
>> > 3: On the server side i have
>> > <beans>
>> >    <bean id="helloServiceBean"
>> > class="com.mylab.mock.server.HelloServiceImpl">
>> >    </bean>
>> >
>> >    <bean class="org.springframework.remoting.rmi.RmiServiceExporter">
>> >        <property name="serviceName" value="helloServiceBean"/>
>> >        <property name="service" ref="helloServiceBean"/>
>> >        <property name="serviceInterface"
>> > value="com.mylab.mock.commons.HelloService"/>
>> >        <property name="registryPort" value="1234"/>
>> >    </bean>
>> > </beans>
>> >
>> >
>> > It seam is ok but when i run the package i receive the following error
>> >
>> > Failed delivery for exchangeId: ID-fbalicchia-4354-1302443726203-0-2.
>> > Exhausted
>> >  after delivery attempt: 1 caught:
>> org.apache.camel.RuntimeCamelException:
>> > java.
>> > rmi.UnmarshalException: error unmarshalling return; nested exception is:
>> > java.lang.ClassNotFoundException: org.springframework.remoting.rmi.RmiIn
>> > vocationWrapper_Stub (no security manager: RMI class loader disabled)
>> > org.apache.camel.RuntimeCamelException: java.rmi.UnmarshalException:
>> error
>> > unmar
>> > shalling return; nested exception is:
>> >        java.lang.ClassNotFoundException:
>> > org.springframework.remoting.rmi.RmiIn
>> > vocationWrapper_Stub (no security manager: RMI class loader disabled)
>> >
>> > How can I enable secuirty manager ?
>> > than here i can call my remote method and how.
>> > In new someBean at the end of rounting information is ok ?
>> >
>> > Thanks
>> >
>> > --Filippo
>> >
>> >
>> >
>> >
>> > 2011/4/10 Claus Ibsen <cl...@gmail.com>
>> >
>> >> You can use the timer or quartz endpoint to trigger the scheduling.
>> >> And then invoke the rmi service, and then after that the bean.
>> >>
>> >> Something like:
>> >>
>> >> from(timer)
>> >>   .to(rmi)
>> >>   .to(bean)
>> >>
>> >>
>> >> On Sun, Apr 10, 2011 at 8:55 AM, Filippo Balicchia <
>> fbalicchia@gmail.com>
>> >> wrote:
>> >> > Hello,
>> >> > I need to implement an example that Scheduled consumes messages from a
>> >> > remote RMI Server and invoke a bean with the received message.
>> >> >
>> >> > The server RMI in a simple hello world server that is exposed with
>> spring
>> >> > Remoting.
>> >> >
>> >> > Could you suggest me, please, where some examples if are there or
>> address
>> >> > me, my camel route consume a message from rmi not exposed like the
>> >> example
>> >> > found in Camel package
>> >> >
>> >> > Thanks for help.
>> >> >
>> >> > --Filippo
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Claus Ibsen
>> >> -----------------
>> >> FuseSource
>> >> Email: cibsen@fusesource.com
>> >> Web: http://fusesource.com
>> >> CamelOne 2011: http://fusesource.com/camelone2011/
>> >> Twitter: davsclaus
>> >> Blog: http://davsclaus.blogspot.com/
>> >> Author of Camel in Action: http://www.manning.com/ibsen/
>> >>
>> >
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> FuseSource
>> Email: cibsen@fusesource.com
>> Web: http://fusesource.com
>> CamelOne 2011: http://fusesource.com/camelone2011/
>> Twitter: davsclaus
>> Blog: http://davsclaus.blogspot.com/
>> Author of Camel in Action: http://www.manning.com/ibsen/
>>
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Consume a message from Rmi

Posted by Filippo Balicchia <fb...@gmail.com>.
Hello thanks for help,
but I don't understand how i Can call my RMI Server. from a route
configuration.
My RMI Server is expose with spring remoting.

What i'd like to do is
from(timer)
  .to(Spring remoting client)
  .to(bean)

What I don't understand is how i can define my spring remote client in th
route

When i lunch my client as a stanalone clone i use the following code

ApplicationContext ctx = new ClassPathXmlApplicationContext(
"rmi-client-context.xml");
HelloService deliveryService = (HelloService) ctx
.getBean("helloServiceBean");
System.out.println(deliveryService.hello("Hello"));
System.out.println(deliveryService.hello());

and spring conf is

<bean id="helloServiceBean"
class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
        <property name="serviceUrl"
value="rmi://localhost:1234/helloServiceBean"/>
        <property name="serviceInterface"
value="com.mylab.mock.commons.HelloService"/>
    </bean>

Could you please tell me how i can reproduce the same Behaviour ?

Thanks for help

--Filippo


























2011/4/11 Claus Ibsen <cl...@gmail.com>

> Hi
>
> See the rmi example in the Apache Camel 2.7 release.
>
> https://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-osgi-rmi/
>
>
> On Sun, Apr 10, 2011 at 4:02 PM, Filippo Balicchia <fb...@gmail.com>
> wrote:
> > Hello,
> > thanks for response but I don't understand how i can call my remote
> method.
> >
> > Explanation:
> >
> > 1: Camel rounting information looks like this
> > from("timer://myTimer?period=30000").to("bean:helloServiceBean").bean(new
> > SomeBean());
> > 2: helloServiceBean is defined in a file xml called camel-context.xml
> that
> > look like this
> >
> > <beans xmlns="http://www.springframework.org/schema/beans"
> >       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >       xsi:schemaLocation="
> >       http://www.springframework.org/schema/beans
> > http://www.springframework.org/schema/beans/spring-beans.xsd
> >       http://camel.apache.org/schema/spring
> > http://camel.apache.org/schema/spring/camel-spring.xsd">
> >
> >  <camelContext id="camelRmiTest"
> >                xmlns="http://camel.apache.org/schema/spring">
> >    <package>org.apache.camel.example.spring</package>
> >    <jmxAgent id="agent" createConnector="true"/>
> >  </camelContext>
> >
> >  <bean id="helloServiceBean"
> > class="org.apache.camel.spring.remoting.CamelProxyFactoryBean">
> >        <property name="serviceUrl"
> > value="rmi://localhost:1234/helloServiceBean"/>
> >        <property name="serviceInterface"
> > value="com.mylab.mock.commons.HelloService"/>
> >   </bean>
> > </beans>
> >
> > 3: On the server side i have
> > <beans>
> >    <bean id="helloServiceBean"
> > class="com.mylab.mock.server.HelloServiceImpl">
> >    </bean>
> >
> >    <bean class="org.springframework.remoting.rmi.RmiServiceExporter">
> >        <property name="serviceName" value="helloServiceBean"/>
> >        <property name="service" ref="helloServiceBean"/>
> >        <property name="serviceInterface"
> > value="com.mylab.mock.commons.HelloService"/>
> >        <property name="registryPort" value="1234"/>
> >    </bean>
> > </beans>
> >
> >
> > It seam is ok but when i run the package i receive the following error
> >
> > Failed delivery for exchangeId: ID-fbalicchia-4354-1302443726203-0-2.
> > Exhausted
> >  after delivery attempt: 1 caught:
> org.apache.camel.RuntimeCamelException:
> > java.
> > rmi.UnmarshalException: error unmarshalling return; nested exception is:
> > java.lang.ClassNotFoundException: org.springframework.remoting.rmi.RmiIn
> > vocationWrapper_Stub (no security manager: RMI class loader disabled)
> > org.apache.camel.RuntimeCamelException: java.rmi.UnmarshalException:
> error
> > unmar
> > shalling return; nested exception is:
> >        java.lang.ClassNotFoundException:
> > org.springframework.remoting.rmi.RmiIn
> > vocationWrapper_Stub (no security manager: RMI class loader disabled)
> >
> > How can I enable secuirty manager ?
> > than here i can call my remote method and how.
> > In new someBean at the end of rounting information is ok ?
> >
> > Thanks
> >
> > --Filippo
> >
> >
> >
> >
> > 2011/4/10 Claus Ibsen <cl...@gmail.com>
> >
> >> You can use the timer or quartz endpoint to trigger the scheduling.
> >> And then invoke the rmi service, and then after that the bean.
> >>
> >> Something like:
> >>
> >> from(timer)
> >>   .to(rmi)
> >>   .to(bean)
> >>
> >>
> >> On Sun, Apr 10, 2011 at 8:55 AM, Filippo Balicchia <
> fbalicchia@gmail.com>
> >> wrote:
> >> > Hello,
> >> > I need to implement an example that Scheduled consumes messages from a
> >> > remote RMI Server and invoke a bean with the received message.
> >> >
> >> > The server RMI in a simple hello world server that is exposed with
> spring
> >> > Remoting.
> >> >
> >> > Could you suggest me, please, where some examples if are there or
> address
> >> > me, my camel route consume a message from rmi not exposed like the
> >> example
> >> > found in Camel package
> >> >
> >> > Thanks for help.
> >> >
> >> > --Filippo
> >> >
> >>
> >>
> >>
> >> --
> >> Claus Ibsen
> >> -----------------
> >> FuseSource
> >> Email: cibsen@fusesource.com
> >> Web: http://fusesource.com
> >> CamelOne 2011: http://fusesource.com/camelone2011/
> >> Twitter: davsclaus
> >> Blog: http://davsclaus.blogspot.com/
> >> Author of Camel in Action: http://www.manning.com/ibsen/
> >>
> >
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> CamelOne 2011: http://fusesource.com/camelone2011/
> Twitter: davsclaus
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>

Re: Consume a message from Rmi

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

See the rmi example in the Apache Camel 2.7 release.
https://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-osgi-rmi/


On Sun, Apr 10, 2011 at 4:02 PM, Filippo Balicchia <fb...@gmail.com> wrote:
> Hello,
> thanks for response but I don't understand how i can call my remote method.
>
> Explanation:
>
> 1: Camel rounting information looks like this
> from("timer://myTimer?period=30000").to("bean:helloServiceBean").bean(new
> SomeBean());
> 2: helloServiceBean is defined in a file xml called camel-context.xml that
> look like this
>
> <beans xmlns="http://www.springframework.org/schema/beans"
>       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>       xsi:schemaLocation="
>       http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
>       http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd">
>
>  <camelContext id="camelRmiTest"
>                xmlns="http://camel.apache.org/schema/spring">
>    <package>org.apache.camel.example.spring</package>
>    <jmxAgent id="agent" createConnector="true"/>
>  </camelContext>
>
>  <bean id="helloServiceBean"
> class="org.apache.camel.spring.remoting.CamelProxyFactoryBean">
>        <property name="serviceUrl"
> value="rmi://localhost:1234/helloServiceBean"/>
>        <property name="serviceInterface"
> value="com.mylab.mock.commons.HelloService"/>
>   </bean>
> </beans>
>
> 3: On the server side i have
> <beans>
>    <bean id="helloServiceBean"
> class="com.mylab.mock.server.HelloServiceImpl">
>    </bean>
>
>    <bean class="org.springframework.remoting.rmi.RmiServiceExporter">
>        <property name="serviceName" value="helloServiceBean"/>
>        <property name="service" ref="helloServiceBean"/>
>        <property name="serviceInterface"
> value="com.mylab.mock.commons.HelloService"/>
>        <property name="registryPort" value="1234"/>
>    </bean>
> </beans>
>
>
> It seam is ok but when i run the package i receive the following error
>
> Failed delivery for exchangeId: ID-fbalicchia-4354-1302443726203-0-2.
> Exhausted
>  after delivery attempt: 1 caught: org.apache.camel.RuntimeCamelException:
> java.
> rmi.UnmarshalException: error unmarshalling return; nested exception is:
> java.lang.ClassNotFoundException: org.springframework.remoting.rmi.RmiIn
> vocationWrapper_Stub (no security manager: RMI class loader disabled)
> org.apache.camel.RuntimeCamelException: java.rmi.UnmarshalException: error
> unmar
> shalling return; nested exception is:
>        java.lang.ClassNotFoundException:
> org.springframework.remoting.rmi.RmiIn
> vocationWrapper_Stub (no security manager: RMI class loader disabled)
>
> How can I enable secuirty manager ?
> than here i can call my remote method and how.
> In new someBean at the end of rounting information is ok ?
>
> Thanks
>
> --Filippo
>
>
>
>
> 2011/4/10 Claus Ibsen <cl...@gmail.com>
>
>> You can use the timer or quartz endpoint to trigger the scheduling.
>> And then invoke the rmi service, and then after that the bean.
>>
>> Something like:
>>
>> from(timer)
>>   .to(rmi)
>>   .to(bean)
>>
>>
>> On Sun, Apr 10, 2011 at 8:55 AM, Filippo Balicchia <fb...@gmail.com>
>> wrote:
>> > Hello,
>> > I need to implement an example that Scheduled consumes messages from a
>> > remote RMI Server and invoke a bean with the received message.
>> >
>> > The server RMI in a simple hello world server that is exposed with spring
>> > Remoting.
>> >
>> > Could you suggest me, please, where some examples if are there or address
>> > me, my camel route consume a message from rmi not exposed like the
>> example
>> > found in Camel package
>> >
>> > Thanks for help.
>> >
>> > --Filippo
>> >
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> FuseSource
>> Email: cibsen@fusesource.com
>> Web: http://fusesource.com
>> CamelOne 2011: http://fusesource.com/camelone2011/
>> Twitter: davsclaus
>> Blog: http://davsclaus.blogspot.com/
>> Author of Camel in Action: http://www.manning.com/ibsen/
>>
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Consume a message from Rmi

Posted by Filippo Balicchia <fb...@gmail.com>.
Hello,
thanks for response but I don't understand how i can call my remote method.

Explanation:

1: Camel rounting information looks like this
from("timer://myTimer?period=30000").to("bean:helloServiceBean").bean(new
SomeBean());
2: helloServiceBean is defined in a file xml called camel-context.xml that
look like this

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
       http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">

  <camelContext id="camelRmiTest"
                xmlns="http://camel.apache.org/schema/spring">
    <package>org.apache.camel.example.spring</package>
    <jmxAgent id="agent" createConnector="true"/>
  </camelContext>

  <bean id="helloServiceBean"
class="org.apache.camel.spring.remoting.CamelProxyFactoryBean">
        <property name="serviceUrl"
value="rmi://localhost:1234/helloServiceBean"/>
        <property name="serviceInterface"
value="com.mylab.mock.commons.HelloService"/>
   </bean>
</beans>

3: On the server side i have
<beans>
    <bean id="helloServiceBean"
class="com.mylab.mock.server.HelloServiceImpl">
    </bean>

    <bean class="org.springframework.remoting.rmi.RmiServiceExporter">
        <property name="serviceName" value="helloServiceBean"/>
        <property name="service" ref="helloServiceBean"/>
        <property name="serviceInterface"
value="com.mylab.mock.commons.HelloService"/>
        <property name="registryPort" value="1234"/>
    </bean>
</beans>


It seam is ok but when i run the package i receive the following error

Failed delivery for exchangeId: ID-fbalicchia-4354-1302443726203-0-2.
Exhausted
 after delivery attempt: 1 caught: org.apache.camel.RuntimeCamelException:
java.
rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: org.springframework.remoting.rmi.RmiIn
vocationWrapper_Stub (no security manager: RMI class loader disabled)
org.apache.camel.RuntimeCamelException: java.rmi.UnmarshalException: error
unmar
shalling return; nested exception is:
        java.lang.ClassNotFoundException:
org.springframework.remoting.rmi.RmiIn
vocationWrapper_Stub (no security manager: RMI class loader disabled)

How can I enable secuirty manager ?
than here i can call my remote method and how.
In new someBean at the end of rounting information is ok ?

Thanks

--Filippo




2011/4/10 Claus Ibsen <cl...@gmail.com>

> You can use the timer or quartz endpoint to trigger the scheduling.
> And then invoke the rmi service, and then after that the bean.
>
> Something like:
>
> from(timer)
>   .to(rmi)
>   .to(bean)
>
>
> On Sun, Apr 10, 2011 at 8:55 AM, Filippo Balicchia <fb...@gmail.com>
> wrote:
> > Hello,
> > I need to implement an example that Scheduled consumes messages from a
> > remote RMI Server and invoke a bean with the received message.
> >
> > The server RMI in a simple hello world server that is exposed with spring
> > Remoting.
> >
> > Could you suggest me, please, where some examples if are there or address
> > me, my camel route consume a message from rmi not exposed like the
> example
> > found in Camel package
> >
> > Thanks for help.
> >
> > --Filippo
> >
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> CamelOne 2011: http://fusesource.com/camelone2011/
> Twitter: davsclaus
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>

Re: Consume a message from Rmi

Posted by Claus Ibsen <cl...@gmail.com>.
You can use the timer or quartz endpoint to trigger the scheduling.
And then invoke the rmi service, and then after that the bean.

Something like:

from(timer)
   .to(rmi)
   .to(bean)


On Sun, Apr 10, 2011 at 8:55 AM, Filippo Balicchia <fb...@gmail.com> wrote:
> Hello,
> I need to implement an example that Scheduled consumes messages from a
> remote RMI Server and invoke a bean with the received message.
>
> The server RMI in a simple hello world server that is exposed with spring
> Remoting.
>
> Could you suggest me, please, where some examples if are there or address
> me, my camel route consume a message from rmi not exposed like the example
> found in Camel package
>
> Thanks for help.
>
> --Filippo
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/