Thursday 15 September 2011

Autowiring of Spring Data Repo fails with Maven Skinny war option -



Autowiring of Spring Data Repo fails with Maven Skinny war option -

my question similar this 1 posted while ago autowiring of spring info repos fail when external libraries in ear's lib folder.

the wiring works fine when jars included in web-inf/lib. tried setting 'skinnywar' false duplicating jars in both ear , war.

the application uses spring batch admin 1.2.2 , spring info 1.1 spring 3.2.2 based. maven version used 3.3. runtime websphere 7.x

i have application works fine skinnywar set true - uses spring-ws, spring-data 4.0.x version.

the war pom

<?xml version="1.0" encoding="utf-8"?> <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"> <modelversion>4.0.0</modelversion> <artifactid>batchadmin-web</artifactid> <parent> <groupid>com.xyz.interfaces</groupid> <artifactid>batch-parent</artifactid> <version>1.0.build-snapshot</version> <relativepath>../batch-parent/pom.xml</relativepath> </parent> <packaging>war</packaging> <name>batch admin interface web</name> <dependencies> <!-- application specific jars/modules not included brevity--> </dependencies> <build> <finalname>springbatch-admin</finalname> <outputdirectory>${project.basedir}\src\main\webapp\web-inf\classes</outputdirectory> <testoutputdirectory>${project.basedir}\src\main\webapp\web-inf\classes</testoutputdirectory> <plugins> <plugin> <artifactid>maven-war-plugin</artifactid> <version>2.4</version> <configuration> <archive> <manifest> <addclasspath>true</addclasspath> <classpathprefix>lib/</classpathprefix> </manifest> </archive> <packagingexcludes>web-inf/lib/spring-beans*.jar</packagingexcludes> </configuration> </plugin> </plugins> </build> </project>

the ear pom content:

<?xml version="1.0" encoding="utf-8"?> <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"> <modelversion>4.0.0</modelversion> <artifactid>batchadmin-ear</artifactid> <parent> <groupid>com.xyz.interfaces</groupid> <artifactid>batch-parent</artifactid> <version>1.0.build-snapshot</version> <relativepath>../batch-parent/pom.xml</relativepath> </parent> <packaging>ear</packaging> <name>batch admin interface</name> <dependencies> <dependency> <groupid>com.xyz.interfaces</groupid> <artifactid>batchadmin-web</artifactid> <type>war</type> <version>${project.version}</version> </dependency> </dependencies> <build> <finalname>springbatchear</finalname> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-ear-plugin</artifactid> <version>2.9.1</version> <configuration> <skinnywars>true</skinnywars> <defaultlibbundledir>lib/</defaultlibbundledir> <modules> <webmodule> <groupid>com.xyz.interfaces</groupid> <artifactid>batchadmin-web</artifactid> <contextroot>/springbatch-admin</contextroot> <bundlefilename>springbatch-admin.war</bundlefilename> </webmodule> </modules> </configuration> </plugin> </plugins> </build>

update: since ear has 1 web module, used 'single class loader application' 'war class loader policy' in websphere. way, able create work.

i know how create work without changing classloader alternative might not preferred when multiple web modules present.

spring maven spring-data spring-batch-admin

No comments:

Post a Comment