sfohart 7 de jan. de 2011
Gente… Desculpa o flood, mas vejam o meu pom.xml (completo, dessa vez):
<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/xsd/maven-4.0.0.xsd" >
<modelVersion> 4.0.0</modelVersion>
<groupId> webservicetest</groupId>
<artifactId> WebServiceTest</artifactId>
<version> 0.0.1-SNAPSHOT</version>
<packaging> war</packaging>
<dependencies>
<!-- Hibernate -->
<dependency>
<groupId> org.hibernate</groupId>
<artifactId> hibernate-validator</artifactId>
<version> 4.1.0.Final</version>
</dependency>
<dependency>
<groupId> org.hibernate</groupId>
<artifactId> hibernate-entitymanager</artifactId>
<version> ${ hibernate . version } </version>
</dependency>
<!-- PostgreSQL -->
<dependency>
<groupId> postgresql</groupId>
<artifactId> postgresql</artifactId>
<version> 8.4-702.jdbc4</version>
</dependency>
<!-- SLF4J -->
<dependency>
<groupId> org.slf4j</groupId>
<artifactId> slf4j-api</artifactId>
<version> ${ slf4j . version } </version>
<type> jar</type>
<scope> compile</scope>
</dependency>
<dependency>
<groupId> org.slf4j</groupId>
<artifactId> jcl-over-slf4j</artifactId>
<version> ${ slf4j . version } </version>
<type> jar</type>
<scope> compile</scope>
</dependency>
<dependency>
<groupId> org.slf4j</groupId>
<artifactId> slf4j-log4j12</artifactId>
<version> ${ slf4j . version } </version>
<type> jar</type>
<scope> compile</scope>
</dependency>
<!-- SPRING -->
<dependency>
<groupId> org.springframework</groupId>
<artifactId> spring-context</artifactId>
<version> ${ springframework . version } </version>
</dependency>
<dependency>
<groupId> org.springframework</groupId>
<artifactId> spring-context-support</artifactId>
<version> ${ springframework . version } </version>
</dependency>
<dependency>
<groupId> org.springframework</groupId>
<artifactId> spring-core</artifactId>
<version> ${ springframework . version } </version>
</dependency>
<dependency>
<groupId> org.springframework</groupId>
<artifactId> spring-web</artifactId>
<version> ${ springframework . version } </version>
</dependency>
<dependency>
<groupId> org.springframework</groupId>
<artifactId> spring-webmvc</artifactId>
<version> ${ springframework . version } </version>
</dependency>
<dependency>
<groupId> org.springframework</groupId>
<artifactId> spring-beans</artifactId>
<version> ${ springframework . version } </version>
</dependency>
<dependency>
<groupId> org.springframework</groupId>
<artifactId> spring-oxm</artifactId>
<version> ${ springframework . version } </version>
</dependency>
<dependency>
<groupId> org.springframework</groupId>
<artifactId> spring-orm</artifactId>
<version> ${ springframework . version } </version>
<type> jar</type>
<scope> compile</scope>
</dependency>
<dependency>
<groupId> org.springframework</groupId>
<artifactId> spring-tx</artifactId>
<version> ${ springframework . version } </version>
</dependency>
<dependency>
<groupId> org.springframework</groupId>
<artifactId> spring-jdbc</artifactId>
<version> ${ springframework . version } </version>
</dependency>
<dependency>
<groupId> org.springframework</groupId>
<artifactId> spring-jms</artifactId>
<version> ${ springframework . version } </version>
</dependency>
<dependency>
<groupId> org.springframework</groupId>
<artifactId> spring-instrument</artifactId>
<version> ${ springframework . version } </version>
<type> jar</type>
<scope> compile</scope>
</dependency>
<dependency>
<groupId> org.springframework</groupId>
<artifactId> spring-aop</artifactId>
<version> ${ springframework . version } </version>
<type> jar</type>
<scope> compile</scope>
</dependency>
<dependency>
<groupId> org.springframework</groupId>
<artifactId> spring-aspects</artifactId>
<version> ${ springframework . version } </version>
<type> jar</type>
<scope> compile</scope>
</dependency>
<!-- JAX-WS -->
<dependency>
<groupId> com.sun.xml.ws</groupId>
<artifactId> jaxws-rt</artifactId>
<version> 2.2</version>
</dependency>
<dependency>
<groupId> com.sun.xml.bind</groupId>
<artifactId> jaxb-impl</artifactId>
<version> 2.2.2</version>
</dependency>
<dependency>
<groupId> org.jvnet.jax-ws-commons.spring</groupId>
<artifactId> jaxws-spring</artifactId>
<version> 1.8</version>
</dependency>
<!-- Apache Commons -->
<dependency>
<groupId> commons-logging</groupId>
<artifactId> commons-logging</artifactId>
<version> 1.1.1</version>
<type> jar</type>
<scope> compile</scope>
</dependency>
<dependency>
<groupId> commons-collections</groupId>
<artifactId> commons-collections</artifactId>
<version> 3.2.1</version>
<type> jar</type>
<scope> compile</scope>
</dependency>
<dependency>
<groupId> commons-lang</groupId>
<artifactId> commons-lang</artifactId>
<version> 2.5</version>
<type> jar</type>
<scope> compile</scope>
</dependency>
<dependency>
<groupId> commons-codec</groupId>
<artifactId> commons-codec</artifactId>
<version> 1.4</version>
<type> jar</type>
<scope> compile</scope>
</dependency>
<dependency>
<groupId> commons-beanutils</groupId>
<artifactId> commons-beanutils</artifactId>
<version> 1.8.3</version>
<type> jar</type>
<scope> compile</scope>
</dependency>
<dependency>
<groupId> commons-beanutils</groupId>
<artifactId> commons-beanutils-bean-collections</artifactId>
<version> 1.8.3</version>
<type> jar</type>
<scope> compile</scope>
</dependency>
<dependency>
<groupId> commons-digester</groupId>
<artifactId> commons-digester</artifactId>
<version> 2.0</version>
<type> jar</type>
<scope> compile</scope>
</dependency>
<dependency>
<groupId> commons-el</groupId>
<artifactId> commons-el</artifactId>
<version> 1.0</version>
</dependency>
<dependency>
<groupId> commons-fileupload</groupId>
<artifactId> commons-fileupload</artifactId>
<version> 1.2.2</version>
</dependency>
<dependency>
<groupId> commons-io</groupId>
<artifactId> commons-io</artifactId>
<version> 1.4</version>
</dependency>
<dependency>
<groupId> commons-validator</groupId>
<artifactId> commons-validator</artifactId>
<version> 1.3.1</version>
</dependency>
<!-- AspectJ -->
<dependency>
<groupId> aspectj</groupId>
<artifactId> aspectjweaver</artifactId>
<version> ${ aspectj . version } </version>
</dependency>
<dependency>
<groupId> aspectj</groupId>
<artifactId> aspectjrt</artifactId>
<version> ${ aspectj . version } </version>
</dependency>
</dependencies>
<repositories>
<repository>
<id> com.springsource.repository.maven.release</id>
<url> http://maven.springframework.org/release/</url>
</repository>
<repository>
<id> com.springsource.repository.bundles.release</id>
<name> EBR Spring Release Repository</name>
<url> http://repository.springsource.com/maven/bundles/release</url>
</repository>
<repository>
<id> com.springsource.repository.bundles.external</id>
<name> EBR External Release Repository</name>
<url> http://repository.springsource.com/maven/bundles/external</url>
</repository>
<repository>
<id> com.springsource.repository.bundles.milestone</id>
<name> EBR Spring Milestone Repository</name>
<url> http://repository.springsource.com/maven/bundles/milestone</url>
</repository>
<repository>
<id> org.springframework.maven.milestone</id>
<name> Maven Central Compatible Spring Milestone Repository</name>
<url> http://maven.springframework.org/milestone</url>
</repository>
<repository>
<id> maven</id>
<name> The maven repo</name>
<url> http://repo2.maven.org/maven2</url>
</repository>
<repository>
<id> java.net.m2</id>
<url> http://download.java.net/maven/2</url>
</repository>
<repository>
<id> java.net.m1</id>
<url> http://download.java.net/maven/1</url>
</repository>
<repository>
<id> jboss-public-repository-group</id>
<name> JBoss Public Maven Repository Group</name>
<url> https://repository.jboss.org/nexus/content/groups/public-jboss/
</url>
</repository>
<repository>
<id> public-repository-group</id>
<name> Public Maven Repository Group</name>
<url> https://repository.jboss.org/nexus/content/groups/public/</url>
</repository>
<repository>
<id> java.net.glassfish.m2</id>
<url> http://download.java.net/maven/glassfish</url>
</repository>
<repository>
<id> prime-repo</id>
<name> Prime Technology Maven Repository</name>
<url> http://repository.prime.com.tr</url>
<layout> default</layout>
</repository>
<repository>
<id> guice-maven</id>
<name> guice maven</name>
<url> http://guice-maven.googlecode.com/svn/trunk</url>
</repository>
<repository>
<id> ibiblio.repo</id>
<name> ibiblio repository</name>
<url> http://www.ibiblio.org/maven</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId> org.apache.maven.plugins</groupId>
<artifactId> maven-compiler-plugin</artifactId>
<version> 2.1</version>
<configuration>
<source> 1.6</source>
<target> 1.6</target>
</configuration>
</plugin>
<plugin>
<groupId> org.apache.maven.plugins</groupId>
<artifactId> maven-shade-plugin</artifactId>
<version> 1.4</version>
<executions>
<execution>
<phase> package</phase>
<goals>
<goal> shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation= "org.apache.maven.plugins.shade.resource.AppendingTransformer" >
<resource> META-INF/spring.handlers</resource>
</transformer>
<transformer implementation= "org.apache.maven.plugins.shade.resource.AppendingTransformer" >
<resource> META-INF/spring.schemas</resource>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId> org.apache.maven.plugins</groupId>
<artifactId> maven-ejb-plugin</artifactId>
<version> 2.3</version>
<configuration>
<ejbVersion> 3.0</ejbVersion>
</configuration>
</plugin>
<plugin>
<groupId> org.codehaus.mojo</groupId>
<artifactId> jaxws-maven-plugin</artifactId>
<version> 1.9</version>
<executions>
<execution>
<goals>
<goal> wsgen</goal>
</goals>
<configuration>
<sei> br.com.edza.metropolisnfe.webservice.endpoints.EnvioLoteRpsServiceEndpoint
</sei>
<genWsdl> true</genWsdl>
<keep> true</keep>
<verbose> true</verbose>
<resourceDestDir> ${ project . build . directory } /jaxws/wsgen/wsdl
</resourceDestDir>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId> org.apache.maven.plugins</groupId>
<artifactId> maven-clean-plugin</artifactId>
<version> 2.4.1</version>
<executions>
<execution>
<id> auto-clean</id>
<phase> initialize</phase>
<goals>
<goal> clean</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId> org.codehaus.mojo</groupId>
<artifactId> aspectj-maven-plugin</artifactId>
<version> 1.3</version>
<executions>
<execution>
<goals>
<goal> compile</goal>
<goal> test-compile</goal>
</goals>
</execution>
</executions>
<configuration>
<source> 1.5</source>
<target> 1.5</target>
<encoding> iso-8859-1</encoding>
<verbose> true</verbose>
<outxml> false</outxml>
<showWeaveInfo> true</showWeaveInfo>
<proceedOnError> true</proceedOnError>
<weaveDependencies>
<weaveDependency>
<groupId> org.springframework</groupId>
<artifactId> spring-aspects</artifactId>
</weaveDependency>
</weaveDependencies>
<aspectLibrarys>
<aspectLibrary>
<groupId> org.springframework</groupId>
<artifactId> spring-aspects</artifactId>
</aspectLibrary>
</aspectLibrarys>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<springframework.version> 3.0.5.RELEASE</springframework.version>
<hibernate.version> 3.6.0.Final</hibernate.version>
<slf4j.version> 1.6.1</slf4j.version>
<aspectj.version> 1.5.3</aspectj.version>
</properties>
</project>
Todo o problema começou com uma demanda (urgente) para se criar um webservice. Como a estrutura do projeto que eu trabalho se baseava em EJB 2.1, eu tentei e não consegui aproveitar nada desse projeto. Sugeriram que eu criasse um outro projeto, apenas com o webservice, mas usando a mesma base. Por isso tentei integrar Spring 3.0.5, Hibernate 3.6.0.FINAL e JAX-WS. Só que eu não sei criar o webservice, e nas minhas tentativas, eu inclui estas 3 dependências:
<!-- JAX-WS -->
<dependency>
<groupId> com.sun.xml.ws</groupId>
<artifactId> jaxws-rt</artifactId>
<version> 2.2</version>
</dependency>
<dependency>
<groupId> com.sun.xml.bind</groupId>
<artifactId> jaxb-impl</artifactId>
<version> 2.2.2</version>
</dependency>
<dependency>
<groupId> org.jvnet.jax-ws-commons.spring</groupId>
<artifactId> jaxws-spring</artifactId>
<version> 1.8</version>
</dependency>
Removendo estas dependências (ou pelo menos só a ultima acima listada) o servidor levanta sem erros… Mas e agora? Como eu resolvo essa minha demanda de integrar Spring 3.0.5, Hibernate 3.6 e JAX-WS?
lsjunior 7 de jan. de 2011
Segue abaixo trecho do meu applicationContext.xml.
< ? 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 : context = "http://www.springframework.org/schema/context"
xsi : schemaLocation = "http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http : // www . springframework . org / schema / context http : // www . springframework . org / schema / context / spring - context - 3.0 . xsd ">
< context : annotation - config />
< context : component - scan base - package = "br.gov.xxx.core" />
< context : component - scan base - package = "br.gov.xxx.yyyy" />
< import resource = "classpath:applicationContext-business.xml" />
< import resource = "classpath:applicationContext-hibernate.xml" />
< import resource = "classpath:applicationContext-others.xml" />
< import resource = "classpath:applicationContext-repository.xml" />
< import resource = "classpath:applicationContext-resource.xml" />
< import resource = "classpath:applicationContext-service.xml" />
< import resource = "classpath:applicationContext-ws.xml" />
</ beans >
E parte do meu pom onde incluo o Spring.
<dependency>
<groupId> org.springframework</groupId>
<artifactId> spring-aop</artifactId>
<version> 3.0.3.RELEASE</version>
<scope> compile</scope>
</dependency>
<dependency>
<groupId> org.springframework</groupId>
<artifactId> spring-beans</artifactId>
<version> 3.0.3.RELEASE</version>
<scope> compile</scope>
</dependency>
<dependency>
<groupId> org.springframework</groupId>
<artifactId> spring-context</artifactId>
<version> 3.0.3.RELEASE</version>
<scope> compile</scope>
</dependency>
<dependency>
<groupId> org.springframework</groupId>
<artifactId> spring-context-support</artifactId>
<version> 3.0.3.RELEASE</version>
<scope> compile</scope>
</dependency>
<dependency>
<groupId> org.springframework</groupId>
<artifactId> spring-core</artifactId>
<version> 3.0.3.RELEASE</version>
<scope> compile</scope>
</dependency>
<dependency>
<groupId> org.springframework</groupId>
<artifactId> spring-jdbc</artifactId>
<version> 3.0.3.RELEASE</version>
<scope> compile</scope>
</dependency>
<dependency>
<groupId> org.springframework</groupId>
<artifactId> spring-orm</artifactId>
<version> 3.0.3.RELEASE</version>
<scope> compile</scope>
</dependency>
<dependency>
<groupId> org.springframework</groupId>
<artifactId> spring-tx</artifactId>
<version> 3.0.3.RELEASE</version>
<scope> compile</scope>
</dependency>
<dependency>
<groupId> org.springframework</groupId>
<artifactId> spring-web</artifactId>
<version> 3.0.3.RELEASE</version>
<scope> compile</scope>
</dependency>
sfohart 11 de jan. de 2011
Pessoal, acabei eu mesmo achando a solução…
Postei aqui: http://sfohart.blogspot.com/2011/01/jax-ws-spring-maven-e-tomcat-7.html
(Perdão por colocar o link para meu blog, mas to com preguiça de formatar o texto aqui)