Hi,
Please try with import javax.ejb*;version="3.0"
And could you please append the MENIFEST file of your bundle jar if it
still doesn't work?
Freeman
Jean-Baptiste Onofré wrote:
Hi all,
using ServiceMix 4.0-M1 (with the SMX Kernel 1.0-M2 embedded), I
have created a CXF NMR OSGi bundle.
In my bundle beans.xml, I have :
<?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:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans [1]
http://www.springframework.org/schema/beans/spring-beans.xsd [2]
http://cxf.apache.org/jaxws [3]
http://cxf.apache.org/schemas/jaxws.xsd [4]">
<import resource="classpath:META-INF/cxf/cxf.xml"/>
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
<import
resource="classpath:META-INF/cxf/transport/nmr/cxf-transport-nmr.xml"/>
<bean id="jndiTemplate"
class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">
org.jnp.interfaces.NamingContextFactory
</prop>
<prop key="java.naming.provider.url">
jnp://srvfms-24.fimasys.fr:1299
</prop>
</props>
</property>
</bean>
<bean id="ejbProxy"
class="org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean">
<property name="jndiName"
value="ejb/profinance/back-office/AutomaticSimulationService"/>
<property name="businessInterface"
value="com.fimasys.finance.profinance.components.simulation.common.ejb.AutomaticSimulationSession"/>
<property name="homeInterface"
value="com.fimasys.finance.profinance.components.simulation.common.ejb.AutomaticSimulationSessionHome"/>
<property name="jndiTemplate" ref="jndiTemplate"/>
</bean>
<bean id="automaticSimulation"
class="com.fimasys.fsb.services.AutomaticSimulationService">
<property name="proxy" ref="ejbProxy"/>
</bean>
<jaxws:endpoint id="AutomaticSimulation"
implementor="#automaticSimulation"
address="nmr:fsb/AutomaticSimulation/AutomaticSimulationBean"/>
</beans>
As I use EJB proxy, I need the EJB (2.1 or 3.0) Geronimo specs. So
first of all, I have added Geronimo EJB spec in my bundle pom.xml :
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd [5]">
<modelVersion>4.0.0</modelVersion>
<groupId>com.fimasys.fsb</groupId>
<artifactId>automatic-simulation-osgi-service</artifactId>
<packaging>bundle</packaging>
<version>4.0</version>
<name>FSB :: Services :: OSGi :: Automatic Simulation</name>
<url>http://fsb.fimasys.com</url>
<dependencies>
<dependency>
<groupId>com.fimasys.profinance</groupId>
<artifactId>pf-bos-commons-ejb-client</artifactId>
<version>2008.r2.2.38.01</version>
</dependency>
<dependency>
<groupId>com.fimasys.services</groupId>
<artifactId>fms-java-services-commons</artifactId>
<version>1.11.03</version>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jbossall-client</artifactId>
<version>4.2.2.GA</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-ejb_3.0_spec</artifactId>
<version>1.0.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
<Import-Package>
javax.jws,
META-INF.cxf,
META-INF.cxf.transport.nmr,
javax.ejb,
javax.xml
</Import-Package>
<Private-Package>com.fimasys.fsb.services</Private-Package>
<Require-Bundle>org.apache.servicemix.bundles.woodstox-3.2.3</Require-Bundle>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
And, using SMX Kernel shell, I have added the Geronimo EJB Spec
bundle :
osgi install -s
mvn:org.apache.geronimo.specs/geronimo-ejb_3.0_spec/1.0.1
I can see the bundle installed and started :
osgi list
[...]
[ 83] [Active ] [ 50] geronimo-ejb_3.0_spec (1.0.1)
I have checked in the data/servicemix.log, there is not error at
bundle startup.
Now, I install my bundle :
osgi install
file:/home/jb/workspace/fsb4/services/automatic-simulation-osgi-service/target/automatic-simulation-osgi-service-4.0.jar
There is not error during installation but when I start my bundle :
[EMAIL PROTECTED]:/> Exception in thread
"SpringOsgiExtenderThread-24"
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'ejbProxy' defined in URL
[bundle://86.0:0/META-INF/spring/beans.xml]: Initialization of bean
failed; nested exception is java.lang.NoClassDefFoundError:
javax/ejb/EJBObject
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:445)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:383)
at java.security.AccessController.doPrivileged(Native Method)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:353)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:169)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:394)
at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:736)
at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:248)
at
org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:136)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.NoClassDefFoundError: javax/ejb/EJBObject
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2395)
at java.lang.Class.getDeclaredMethods(Class.java:1763)
at java.beans.Introspector$1.run(Introspector.java:1265)
at java.security.AccessController.doPrivileged(Native Method)
at
java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1263)
at
java.beans.Introspector.getTargetMethodInfo(Introspector.java:1129)
at java.beans.Introspector.getBeanInfo(Introspector.java:387)
at java.beans.Introspector.getBeanInfo(Introspector.java:159)
at java.beans.Introspector.getBeanInfo(Introspector.java:220)
at java.beans.Introspector.<init>(Introspector.java:368)
at java.beans.Introspector.getBeanInfo(Introspector.java:159)
at java.beans.Introspector.getBeanInfo(Introspector.java:220)
at java.beans.Introspector.<init>(Introspector.java:368)
at java.beans.Introspector.getBeanInfo(Introspector.java:159)
at
org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:242)
at
org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:141)
at
org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:247)
at
org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:375)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1211)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1183)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:940)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:437)
I can understand because :
1/ the geronimo bundle is installed and started in SMX Kernel
2/ my bundle <Import-Package/> contains javax.ejb
I guess that I have a classloading issue but I can't see where for
now.
Someone has an idea ?
Thanks in advance,
Regards
JB
--
Jean-Baptiste Onofré
[EMAIL PROTECTED]
BuildProcess/AutoDeploy Project Leader
http://buildprocess.sourceforge.net
Links:
------
[1] http://www.springframework.org/schema/beans
[2] http://www.springframework.org/schema/beans/spring-beans.xsd
[3] http://cxf.apache.org/jaxws
[4] http://cxf.apache.org/schemas/jaxws.xsd
[5] http://maven.apache.org/maven-v4_0_0.xsd