tuscany-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ant elder <ant.el...@gmail.com>
Subject Re: RE : binding.jms work at standalone but not in tomcat webapp
Date Mon, 21 Nov 2011 15:45:38 GMT
On Mon, Nov 21, 2011 at 1:38 PM, Ruault Gaetan <gruault@sopragroup.com> wrote:
>
> ________________________________________
> De : Simon Laws [simonslaws@googlemail.com]
> Date d'envoi : vendredi 18 novembre 2011 14:33
> À : user@tuscany.apache.org
> Objet : Re: binding.jms work at standalone but not in tomcat webapp
>
> On Thu, Nov 17, 2011 at 8:32 AM, Ruault Gaetan <gruault@sopragroup.com> wrote:
>>
>> Hi,
>>
>>
>> I have a problem with binding.jms  in "webapp mode"
>>
>> i have a composite like this :
>>
>> <service name="GestionAdherentAm"
>> promote="GestionAdherentComponent/GestionAdherentAm">
>> <interface.wsdl wsdlLocation="wsdl/GestionAdherentAm.wsdl"
>> interface="http://gestionAdherentAm.masteri_operationne.com/#wsdl.interface(GestionAdherentAm)"/>
>>  <binding.jms
>> initialContextFactory="com.socle.hornetq.client.jndi.HornetQClientInitialContextFactory"
>>                              jndiURL="jnp://localhost:1099">
>>                     <destination name="/queue/DefaultQueue" create="never"/>
>>                    <ts:wireFormat.jmsTextXML/>
>>                 </binding.jms>
>> </service>
>>
>>
>> if i launch my project with  a main class  and          SCADomain scaDomain
>> = SCADomain.newInstance("AdherentAm.composite");
>>
>>
>> The service is OK  and it work fine.
>>
>>
>> but when i start the project in tomcat webapp(the composite is deployed in
>> Webapp with sca-contribution.xml)
>>
>> i have this error :
>>
>> GRAVE: Exception au démarrage du filtre tuscany
>> org.osoa.sca.ServiceRuntimeException:
>> java.lang.reflect.InvocationTargetException
>>     at
>> org.apache.tuscany.sca.host.embedded.SCADomain.createNewInstance(SCADomain.java:220)
>>     at
>> org.apache.tuscany.sca.host.embedded.SCADomain.newInstance(SCADomain.java:76)
>>     at
>> org.apache.tuscany.sca.host.webapp.WebAppServletHost.init(WebAppServletHost.java:238)
>>     at
>> org.apache.tuscany.sca.host.webapp.TuscanyServletFilter.init(TuscanyServletFilter.java:52)
>>     at
>> org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
>>     at
>> org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
>>     at
>> org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
>>     at
>> org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4001)
>>     at
>> org.apache.catalina.core.StandardContext.start(StandardContext.java:4651)
>>     at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
>>     at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
>>     at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
>>     at
>> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
>>     at
>> org.apache.catalina.core.StandardService.start(StandardService.java:519)
>>     at
>> org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
>>     at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
>>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>>     at java.lang.reflect.Method.invoke(Unknown Source)
>>     at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
>>     at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
>> Caused by: java.lang.reflect.InvocationTargetException
>>     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>>     at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
>>     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
>> Source)
>>     at java.lang.reflect.Constructor.newInstance(Unknown Source)
>>     at
>> org.apache.tuscany.sca.host.embedded.SCADomain.createNewInstance(SCADomain.java:199)
>>     ... 21 more
>> Caused by: org.apache.tuscany.sca.binding.jms.impl.JMSBindingException:
>> Error starting JMSServiceBinding
>>     at
>> org.apache.tuscany.sca.binding.jms.provider.JMSBindingServiceBindingProvider.start(JMSBindingServiceBindingProvider.java:152)
>>     at
>> org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl$3.run(CompositeActivatorImpl.java:630)
>>     at java.security.AccessController.doPrivileged(Native Method)
>>     at
>> org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl.start(CompositeActivatorImpl.java:628)
>>     at
>> org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl.start(CompositeActivatorImpl.java:560)
>>     at org.apache.tuscany.sca.node.impl.NodeImpl.start(NodeImpl.java:728)
>>     at
>> org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain.init(DefaultSCADomain.java:187)
>>     at
>> org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain.<init>(DefaultSCADomain.java:100)
>>     at
>> org.apache.tuscany.sca.host.webapp.WebSCADomain.<init>(WebSCADomain.java:41)
>>     ... 26 more
>> Caused by: org.apache.tuscany.sca.binding.jms.impl.JMSBindingException:
>> Error starting JMSServiceBinding
>>     at
>> org.apache.tuscany.sca.host.jms.asf.ASFListener.start(ASFListener.java:78)
>>     at
>> org.apache.tuscany.sca.binding.jms.provider.JMSBindingServiceBindingProvider.start(JMSBindingServiceBindingProvider.java:149)
>>     ... 34 more
>> Caused by: org.apache.tuscany.sca.binding.jms.impl.JMSBindingException:
>> connection factory not found: ConnectionFactory
>>     at
>> org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactoryImpl.createConnection(JMSResourceFactoryImpl.java:133)
>>     at
>> org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactoryImpl.getConnection(JMSResourceFactoryImpl.java:75)
>>     at
>> org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactoryImpl.createSession(JMSResourceFactoryImpl.java:86)
>>     at
>> org.apache.tuscany.sca.host.jms.asf.ASFListener.registerListerner(ASFListener.java:100)
>>     at
>> org.apache.tuscany.sca.host.jms.asf.ASFListener.start(ASFListener.java:76)
>>     ... 35 more
>>
>>
>>
>> i don't understand where is my mistake because,  it the same projet  then
>> the same library classpath. All libraries  are checked in  JEE dependencies,
>> etc...etc...
>> could you help me ?
>>
>>
>> thanks
>>
>> gaetan
>>
>>
>>
>>
>>
>
> Hi Ruault
>
> It looks like you're using Tuscany 1.x?
>
> The line it's failing on is doing a jndi lookup on the connection
> factory name and for some reason it can't find it in this environment.
> Here's the code from JMSResourceFactoryImpl [1]
>
>
>    protected void createConnection() throws NamingException, JMSException {
>        ConnectionFactory connectionFactory =
> (ConnectionFactory)jndiLookUp(connectionFactoryName);
>        if (connectionFactory == null) {
>            throw new JMSBindingException("connection factory not
> found: " + connectionFactoryName);
>        }
>        connection = connectionFactory.createConnection();
>    }
>
> ...
>
>    protected Object jndiLookUp(String name) {
>        Object o = null;
>        try {
>            o = getInitialContext().lookup("java:comp/env/" + name);
>        } catch (Exception ex) {
>            // ignore
>        }
>        if (o == null) {
>            try {
>                o = getInitialContext().lookup(name);
>            } catch (NamingException ex) {
>                // ignore
>            }
>        }
>        return o;
>    }
>
> ...
>
>    protected synchronized Context getInitialContext() throws NamingException {
>        if (context == null) {
>            Properties props = new Properties();
>
>            if (initialContextFactoryName != null) {
>                props.setProperty(Context.INITIAL_CONTEXT_FACTORY,
> initialContextFactoryName);
>            }
>            if (jndiURL != null) {
>                props.setProperty(Context.PROVIDER_URL, jndiURL);
>            }
>
>            initJREEnvironment(props);
>
>            context = new InitialContext(props);
>        }
>        return context;
>    }
>
> The error reports that it can't find the connection factory called
> "ConnectionFactory" which is the hardcoded default. Is the JMS
> provider in your Tomcat environment providing something different?
>
> [1] http://svn.apache.org/repos/asf/tuscany/sca-java-1.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java
>
> Simon
>
> --
> Apache Tuscany committer: tuscany.apache.org
> Co-author of a book about Tuscany and SCA: tuscanyinaction.com
>
>
>
>
>
>
> Hi thanks for your answer,
>
> but is the same JMS provider(is a standalone hornetq server) when i launch project as
tomcat webapp and when i launch it as standalone.
>
> I don't understand where is my problem.  In two case, is the same java code, tuscany
conf and hornetq Server...
>
>

Are there the necessary hornetq client jars included in your webapp's
web-inf/lib folder? I've not used hornetq so i don't know what jars
are required but you will need something so that the JMS
ConnectionFactory implementation is the hornetq one which knows how to
talk to its broker.

   ...ant

Mime
View raw message