Hello the list,

I'm currently stuck on an I can't manage to solve. Don't know if it is
a Servicemix or a Tomcat related issue.
First my environment :
- Tomcat 5.5.26
- Servicemix 3.2.1 deployed as a war inside Tomcat
- Java 1.5

I've configured a service-assembly where there is a file-sender
service-unit that I would like to configure through parameters coming
from the Tomcat JNDI tree (the target dir). I'm hoping that by doing
this way, I can avoid to rely on the deployment layout.

The servicemix.xml of the webapp contains (it's only a snip)  :
  <sm:container id="jbi"
                rootDir="${jbi.root}/data"
                MBeanServer="#server"
                monitorInstallationDirectory="true"
                installationDirPath="${jbi.root}/deploy"
                monitorDeploymentDirectory="true"
                deploymentDirPath="${jbi.root}/deploy">

I've added in my file service unit this xbean.xml :
    <file:sender service="b:File" endpoint="endpoint">
        <property name="directory">
            <bean class="org.springframework.jndi.JndiObjectFactoryBean">
                <property name="jndiName">
                    <value>java:comp/env/Inbox</value>
                </property>
            </bean>
        </property>
    </file:sender>

In my Tomcat server.xml I've got :
<Context docBase="/Users/benoitclouet/apache-servicemix-web-3.2.1"
path="/apache-servicemix-web"
                    reloadable="true" useNaming="true">
                    <Environment name="Inbox" type="java.lang.String"
value="/Users/benoitclouet/Documents/temp/inbox" />
</Context>

I customized a bit the servicemix webapp so my web.xml contains :
    <resource-env-ref>
        <description>My dir</description>
        <resource-env-ref-name>Inbox</resource-env-ref-name>
        <resource-env-ref-type>java.lang.String</resource-env-ref-type>
    </resource-env-ref>

I also added in the webapp a META-INF/context.xml containing :
<ResourceLink name="Inbox global="Inbox" type="java.lang.String" />

But I doesn't work as expected (the file sender is expected to write
his files in the dir /Users/benoitclouet/Documents/temp/inbox).

In fact, I even get an error at service-archive deployment :
org.apache.xbean.kernel.ServiceRegistrationException:
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'org.apache.servicemix.file.FileSenderEndpoint' defined in file
[/Users/benoitclouet/Documents/temp/data/service-assemblies/inbound-sa/version_2/sus/servicemix-file/inbound-su-file/xbean.xml]:
Cannot create inner bean
'org.springframework.jndi.JndiObjectFactoryBean#1b289f' of type
[org.springframework.jndi.JndiObjectFactoryBean] while setting bean
property 'directory'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'org.springframework.jndi.JndiObjectFactoryBean#1b289f' defined in
file 
[/Users/benoitclouet/Documents/temp/data/service-assemblies/inbound-sa/version_2/sus/servicemix-file/inbound-su-file/xbean.xml]:
Invocation of init method failed; nested exception is
javax.naming.NameNotFoundException: Name java:comp is not bound in
this Context
    at 
org.apache.xbean.kernel.standard.ServiceManagerRegistry.registerService(ServiceManagerRegistry.java:424)
    at 
org.apache.xbean.kernel.standard.StandardKernel.registerService(StandardKernel.java:220)
    at 
org.apache.xbean.server.spring.loader.SpringLoader.load(SpringLoader.java:152)
    at 
org.apache.servicemix.common.xbean.AbstractXBeanDeployer.deploy(AbstractXBeanDeployer.java:83)
    at 
org.apache.servicemix.common.BaseServiceUnitManager.doDeploy(BaseServiceUnitManager.java:88)
    at 
org.apache.servicemix.common.BaseServiceUnitManager.deploy(BaseServiceUnitManager.java:69)
    at 
org.apache.servicemix.jbi.framework.DeploymentService.deployServiceAssembly(DeploymentService.java:508)
    at 
org.apache.servicemix.jbi.framework.AutoDeploymentService.updateServiceAssembly(AutoDeploymentService.java:350)
    at 
org.apache.servicemix.jbi.framework.AutoDeploymentService.updateArchive(AutoDeploymentService.java:253)
    at 
org.apache.servicemix.jbi.framework.AutoDeploymentService.monitorDirectory(AutoDeploymentService.java:647)
    at 
org.apache.servicemix.jbi.framework.AutoDeploymentService.access$2(AutoDeploymentService.java:623)
    at 
org.apache.servicemix.jbi.framework.AutoDeploymentService$1.run(AutoDeploymentService.java:614)
    at java.util.TimerThread.mainLoop(Timer.java:512)
    at java.util.TimerThread.run(Timer.java:462)

After spending some time crawling, and debugging the deployment
process to find a way forward, I must confess, I'm completely stuck.
The only post I found wasn't answered :
http://www.nabble.com/JNDI-issue-running-under-Tomcat-tp8930143p8930143.html
By reading this post I'm prety sure samg was trying to do the same as
me, maybe he has found a solution he could provide ?

Any help welcome.

Benoît

Reply via email to