You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by topicfun <zo...@freemail.hu> on 2012/04/02 11:47:29 UTC

Camel-ejb, JBoss

Hi!

I have two ear deployed under JBoss5 one for business logic and one for
communication protocol via Camel.
I try to call a EJB (ear2) from a camel context (ear1) which is located in
different classloader repository. In this way the bean can't be looked up. I
have checked the bean under jmx-console and the bean is there and can be
called from other EJB!

I have tried using the same classloader repo and in this case everything
works well!

that is my jboss-spring.xml:

    
    <bean id="jbossResolver"
class="org.apache.camel.jboss.JBossPackageScanClassResolver"/>

    
    <bean id="diadPurseRouteBuilder"
class="com.iflow.diad.route.purse.path.DiadPurseRoute"/>
	
	  <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
	    <property name="connectionFactory">
	      <bean class="org.apache.activemq.ActiveMQConnectionFactory">
	        <property name="brokerURL" value="tcp://localhost:61616" />
	      </bean>
	    </property>
	  </bean>
	  
	
	<bean id="ejb" class="org.apache.camel.component.ejb.EjbComponent">
	    <property name="properties" ref="jndiProperties"/>
	</bean>
	
	
	<p:properties id="jndiProperties">
	    <prop
key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</prop>
	    <prop
key="java.naming.factory.url.pkgs">org.jboss.naming:org.jnp.interfaces</prop>
	    <prop key="java.naming.provider.url">jnp://localhost:1399</prop>
	</p:properties>	  

    
    <camelContext xmlns="http://camel.apache.org/schema/spring">
        <routeBuilder ref="diadPurseRouteBuilder"/>
    </camelContext>


and the jboss-app.xml for both ear:
ear1:

<jboss-app>
	<module-order>strict</module-order>     
*    <loader-repository>com.iflow.diad.purse:loader=DiadPurseRouteEJP.ear    
*        
<loader-repository-config>java2ParentDelegation=true</loader-repository-config>
    </loader-repository> 
    <library-directory>APP-INF/lib</library-directory>
</jboss-app>

ear2:
	<module-order>strict</module-order>     
*    <loader-repository>com.iflow.diad.purse:loader=DiadPurseEJP.ear
*        
<loader-repository-config>java2ParentDelegation=true</loader-repository-config>
    </loader-repository> 


How can I access to ejb from different classloader repo?  (Now I have done a
workaround adding one ejb in ear1 to delegate the request to ear2 ejb)

Thanks!
topicfun


--
View this message in context: http://camel.465427.n5.nabble.com/Camel-ejb-JBoss-tp5611964p5611964.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel-ejb, JBoss

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

I think its the same problem how to do this with JBoss when you have 2
EAR applications deployed, and want to invoke an EJB from the other
EAR.
I would ask at JBoss how to do that. You may have  to setup deployment
descriptors and whatnot to have it all wired up and exposed in the
JNDI context.



On Mon, Apr 2, 2012 at 11:47 AM, topicfun <zo...@freemail.hu> wrote:
> Hi!
>
> I have two ear deployed under JBoss5 one for business logic and one for
> communication protocol via Camel.
> I try to call a EJB (ear2) from a camel context (ear1) which is located in
> different classloader repository. In this way the bean can't be looked up. I
> have checked the bean under jmx-console and the bean is there and can be
> called from other EJB!
>
> I have tried using the same classloader repo and in this case everything
> works well!
>
> that is my jboss-spring.xml:
>
>
>    <bean id="jbossResolver"
> class="org.apache.camel.jboss.JBossPackageScanClassResolver"/>
>
>
>    <bean id="diadPurseRouteBuilder"
> class="com.iflow.diad.route.purse.path.DiadPurseRoute"/>
>
>          <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
>            <property name="connectionFactory">
>              <bean class="org.apache.activemq.ActiveMQConnectionFactory">
>                <property name="brokerURL" value="tcp://localhost:61616" />
>              </bean>
>            </property>
>          </bean>
>
>
>        <bean id="ejb" class="org.apache.camel.component.ejb.EjbComponent">
>            <property name="properties" ref="jndiProperties"/>
>        </bean>
>
>
>        <p:properties id="jndiProperties">
>            <prop
> key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</prop>
>            <prop
> key="java.naming.factory.url.pkgs">org.jboss.naming:org.jnp.interfaces</prop>
>            <prop key="java.naming.provider.url">jnp://localhost:1399</prop>
>        </p:properties>
>
>
>    <camelContext xmlns="http://camel.apache.org/schema/spring">
>        <routeBuilder ref="diadPurseRouteBuilder"/>
>    </camelContext>
>
>
> and the jboss-app.xml for both ear:
> ear1:
>
> <jboss-app>
>        <module-order>strict</module-order>
> *    <loader-repository>com.iflow.diad.purse:loader=DiadPurseRouteEJP.ear
> *
> <loader-repository-config>java2ParentDelegation=true</loader-repository-config>
>    </loader-repository>
>    <library-directory>APP-INF/lib</library-directory>
> </jboss-app>
>
> ear2:
>        <module-order>strict</module-order>
> *    <loader-repository>com.iflow.diad.purse:loader=DiadPurseEJP.ear
> *
> <loader-repository-config>java2ParentDelegation=true</loader-repository-config>
>    </loader-repository>
>
>
> How can I access to ejb from different classloader repo?  (Now I have done a
> workaround adding one ejb in ear1 to delegate the request to ear2 ejb)
>
> Thanks!
> topicfun
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-ejb-JBoss-tp5611964p5611964.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/