tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Re: how to get local/remote ejb stored in spring from a servlet - openejb spring integration
Date Wed, 06 Jul 2011 08:22:41 GMT
maybe what you want if really simpler, did you try the spring jee
integration?

i think openejb spring integration is more oriented for people wanting to
run oepnejb from spring.

here some clues:

appctx:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jee="http://www.springframework.org/schema/jee"
       xsi:schemaLocation="
     http://www.springframework.org/schema/beans
     http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
     http://camel.apache.org/schema/spring
     http://camel.apache.org/schema/spring/camel-spring.xsd
     http://www.springframework.org/schema/jee
     http://www.springframework.org/schema/jee/spring-jee-2.0.xsd">

  <context:property-placeholder location="classpath:config.properties" />

  <jee:jndi-lookup id="manager" jndi-name="SpringIntegration/Foo">

<jee:environment>java.naming.factory.initial=${initialContext}</jee:environment>
  </jee:jndi-lookup>
</beans>

config.properties:
# java.naming.factory.initial
initialContext=org.apache.openejb.client.LocalInitialContextFactory

The other solution is to simply lookup it from where you want creating an
initial context.

- Romain

2011/7/6 lamle <lamle@wapice.com>

> Hi Romain, thank you for your suggestion.
> I tried, here is the error log i got:
> (I have this in my tomcat/conf/system.properties file:
> openejb.deploymentId.format={moduleId}/{ejbName}  )
>
>
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean
> with name 'classPathApplication': Invocation of init method failed; nested
> exception is org.apache.openejb.OpenEJBException: Cannot bind resource
> adapter with id TransactionManager:
> ParsedName{path=openejb/Resource/TransactionManager,
> component=TransactionManager}
>
>
> org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:133)
>
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:394)
>
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1413)
>
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
>
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
>
>
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
>
>
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
>
>
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
>
>
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
>
>
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
>
>
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:896)
>
>
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
>
>
> org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
>
>
> org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:84)
>        com.wapice.test.TestServlet.doGet(TestServlet.java:45)
>        javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
>        javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
>
>
> root cause
>
> org.apache.openejb.OpenEJBException: Cannot bind resource adapter with id
> TransactionManager: ParsedName{path=openejb/Resource/TransactionManager,
> component=TransactionManager}
>
>
> org.apache.openejb.assembler.classic.Assembler.createResource(Assembler.java:1195)
>        org.apache.openejb.spring.OpenEJB.start(OpenEJB.java:308)
>
>
> org.apache.openejb.spring.AbstractApplication.start(AbstractApplication.java:92)
>         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         java.lang.reflect.Method.invoke(Method.java:597)
>
>
> org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:341)
>
>
> org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:293)
>
>
> org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:130)
>
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:395)
>
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1413)
>
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
>
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
>
>
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
>
>
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
>
>
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
>
>
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
>
>
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
>
>
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:896)
>
>
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
>
>
> org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
>
>
> org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:84)
>        com.wapice.test.TestServlet.doGet(TestServlet.java:45)
>        javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
>        javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
>
>
> root cause
>
> javax.naming.NameAlreadyBoundException:
> ParsedName{path=openejb/Resource/TransactionManager,
> component=TransactionManager}
>        org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:96)
>        org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:111)
>        org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:111)
>        org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:90)
>        org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:111)
>        org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:111)
>        org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:105)
>        org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:90)
>        org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:105)
>
>  org.apache.openejb.core.ivm.naming.IvmContext.bind(IvmContext.java:295)
>
>
> org.apache.openejb.assembler.classic.Assembler.createResource(Assembler.java:1193)
>        org.apache.openejb.spring.OpenEJB.start(OpenEJB.java:308)
>
>
> org.apache.openejb.spring.AbstractApplication.start(AbstractApplication.java:92)
>         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         java.lang.reflect.Method.invoke(Method.java:597)
>
>
> org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:341)
>
>
> org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:293)
>
>
> org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:130)
>
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:395)
>
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1413)
>
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
>
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
>
>
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
>
>
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
>
>
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
>
>
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
>
>
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
>
>
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:896)
>
>
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
>
>
> org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
>
>
> org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:84)
>        com.wapice.test.TestServlet.doGet(TestServlet.java:45)
>        javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
>        javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/how-to-get-local-remote-ejb-stored-in-spring-from-a-servlet-openejb-spring-integration-tp3647869p3648000.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message