How to deploy a .spring file right after a JAR
roysarango Dec 20, 2012 9:22 AMHello everyone,
I was wondering if anyone can help me out with the following issue:
I'm migrating an application from Jboss 4.2 to 5.1 EAP. The application was built with EJB 2 and Spring 1.2. I've found some similar problems and tried all the possible alternative solutions without any luck.
My project has the following structure:
+ myApp.ear
+ META-INF
- application.xml
- jboss-app.xml
- MANIFEST.MF
+ myApp.jar
+ <package-structure> // classes go here.
+ META-INF
- ejb-jar.xml
- jboss.xml
- jbosscmp-jdbc-xml
- MANIFEST.MF
+ myApp-spring.spring
+ META-INF
- MANIFEST.MF
- myApp-spring.xml
+ myApp.war
When deploying, I get this error message:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name '<class-name>' defined in class path resource [applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [<package-name>.<class-name>Delegate]: Constructor threw exception; nested exception is javax.ejb.EJBException: Could not instantiate bean.
The weird thing here is that when deploying 1st. myApp.jar, 2nd myApp-spring.spring (getting the file out of the JAR) and 3rd myApp.war... putting these files (one by one) in <JBOSS_HOME>/jboss-as/server/<my-instance>/deploy, it works. But, putting the entire EAR project or the other 3 artifacts (one by one) in any other order then the specified, jboss server gives me the error pointed out above.
This is my myApp-spring.xml file:
<code>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!-- ============== DataSource ============== -->
<bean id="juiciosDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>java:/myAppDS</value>
</property>
</bean>
<!-- ============== DAO Layer (Persistence) ============== -->
<bean id="tipoIdentificacionDAODelegate"
class="<bussiness-delegate-package>.<DAO-delegate-class>" />
</beans>
</code>
Any help will be appreciated!!!!!