I've been getting the same exception.  To work around it, I've instantiated
the DefaultServiceMixClient outside of spring.  Obviously, this is less than
ideal.

-Matthew

-----Original Message-----
From: Matthew Clark [mailto:[EMAIL PROTECTED] 
Sent: Sunday, September 04, 2005 10:43 AM
To: [email protected]
Subject: [servicemix-user] Problem instantiating DefaultServiceMixClient
using Spring / Tomcat

Hi there, (this is attempt 2 - first attempt was blank?)

I am embedding ServiceMix (1.0.1 release) in a web application (Tomcat
5.0.x).  We already have the Spring framework up and running and I have
attempted to use the "pure Spring" method to configure ServiceMix (I used
Pure Spring as I understand that the extended stuff may require a
development version of Spring?)

I have used the following configuration to attempt to instantiate a "client"
bean for use with the ServiceMix client within the web application... but I
get the exception included below.  I should note that all libraries
including spring, ServiceMix and it's dependencies are in the
tomcat/common/lib directory so I shouldn't be having any class loading
issues..  Spring is embedded using the webapp Listener as you can see in the
exception...

Any help would be appreciated.


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd";>
<beans>

  <bean id="jbi" class="org.servicemix.jbi.container.SpringJBIContainer">
    <property name="componentNames">
      <list>
        <value>receiver</value>
      </list>
    </property>
  </bean>

  <bean id="receiver"
class="test.servicemix.components.pojo.TrackingReceiver"/>

  <bean id="receiverServiceName" class="javax.xml.namespace.QName">
    <constructor-arg value="http://testorg.com/test/"/>
    <constructor-arg value="receiver"/>
  </bean>

  <bean id="client" class="org.servicemix.client.DefaultServiceMixClient">
    <constructor-arg ref="jbi" />
  </bean>

</beans>

-------Exception ---------------

2005-09-04 17:44:16,708 [main] INFO 
org.springframework.beans.factory.support.DefaultListableBeanFactory -
Destroying singletons in factory
{org.springframework.beans.factory.support.DefaultListableBeanFactory
defining beans [jbi,receiver,receiverServiceName,client]; root of
BeanFactory hierarchy}
2005-09-04 17:44:16,711 [main] ERROR
org.springframework.web.context.ContextLoader - Context initialization
failed
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'client' defined in ServletContext resource
[/WEB-INF/applicationContext.xml]: Instantiation of bean failed; nested
exception is org.springframework.beans.FatalBeanException: Could not
instantiate class [org.servicemix.client.DefaultServiceMixClient];
constructor threw exception; nested exception is
java.lang.NullPointerException: null
org.springframework.beans.FatalBeanException: Could not instantiate class
[org.servicemix.client.DefaultServiceMixClient]; constructor threw
exception; nested exception is java.lang.NullPointerException: null
java.lang.NullPointerException
        at
org.servicemix.jbi.management.ManagementContext.getRelativeName(ManagementCo
ntext.java:408)
        at
org.servicemix.jbi.management.ManagementContext.createObjectName(ManagementC
ontext.java:388)
        at
org.servicemix.jbi.container.JBIContainer.activateComponent(JBIContainer.jav
a:875)
        at
org.servicemix.jbi.container.JBIContainer.activateComponent(JBIContainer.jav
a:838)
        at
org.servicemix.jbi.container.JBIContainer.activateComponent(JBIContainer.jav
a:800)
        at
org.servicemix.jbi.container.JBIContainer.activateComponent(JBIContainer.jav
a:748)
        at
org.servicemix.client.DefaultServiceMixClient.<init>(DefaultServiceMixClient
.java:69)
        at
org.servicemix.client.DefaultServiceMixClient.<init>(DefaultServiceMixClient
.java:59)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
        at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAcces
sorImpl.java:39)
        at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstruc
torAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
        at
org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:100)
        at
org.springframework.beans.factory.support.SimpleInstantiationStrategy.instan
tiate(SimpleInstantiationStrategy.java:75)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.autowireConstructor(AbstractAutowireCapableBeanFactory.java:669)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.createBean(AbstractAutowireCapableBeanFactory.java:329)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Abstra
ctBeanFactory.java:226)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Abstra
ctBeanFactory.java:147)
        at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInst
antiateSingletons(DefaultListableBeanFactory.java:275)
        at
org.springframework.context.support.AbstractApplicationContext.refresh(Abstr
actApplicationContext.java:318)
        at
org.springframework.web.context.support.AbstractRefreshableWebApplicationCon
text.refresh(AbstractRefreshableWebApplicationContext.java:134)
        at
org.springframework.web.context.ContextLoader.createWebApplicationContext(Co
ntextLoader.java:230)
        at
org.springframework.web.context.ContextLoader.initWebApplicationContext(Cont
extLoader.java:156)
        at
org.springframework.web.context.ContextLoaderListener.contextInitialized(Con
textLoaderListener.java:48)
        at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:
3827)
        at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4343)
        at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:8
23)
        at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
        at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
        at
org.apache.catalina.core.StandardHostDeployer.addChild(StandardHostDeployer.
java:903)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:216)
        at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:256)
        at org.apache.commons.digester.Rule.end(Rule.java:276)
        at
... chopped



This message has been scanned for viruses.

Reply via email to