-
Apr 1st, 2009, 12:06 PM
#1
MTOM Example does not compile
Hi,
I tried following your instructions and running the ant build command for the JAXWS MTOM client example and finally gave up after a day of retrying and resolving dependencies that Maven failed to download. The worst part is that it does not report all unresolved dependencies at once and you have to run through the build process over and over until you no longer get missing dependencies errors and each build process, on a fast network takes about 8 minutes. I finally resolved all the missing dependencies manually and now the project still does not build and complains about a class that it should find since I manually installed jaxws-api.jar and verified the class is inside the jar.
Here are the packages I had to manually download and install:
call mvn install:install-file -DgroupId=com.sun.xml.stream -DartifactId=sjsxp -Dversion=1.0 -Dpackaging=jar -Dfile=C:/devtools/tools/java-tools/exe/spring-ws/jars/sjsxp.jar
call mvn install:install-file -DgroupId=com.sun.xml.ws -DartifactId=jaxws-tools -Dversion=EA3 -Dpackaging=jar -Dfile=C:/devtools/tools/java-tools/exe/spring-ws/jars/jaxws-tools.jar
call mvn install:install-file -DgroupId=com.sun.xml.stream.buffer -DartifactId=streambuffer -Dversion=0.3 -Dpackaging=jar -Dfile=C:/devtools/tools/java-tools/exe/spring-ws/jars/streambuffer.jar
call mvn install:install-file -DgroupId=com.sun.xml.bind -DartifactId=jaxb-xjc -Dversion=2.1-EA2 -Dpackaging=jar -Dfile=C:/devtools/tools/java-tools/exe/spring-ws/jars/jaxb-xjc.jar
call mvn install:install-file -DgroupId=org.jvnet.staxex -DartifactId=stax-ex -Dversion=1.0 -Dpackaging=jar -Dfile=C:/devtools/tools/java-tools/exe/spring-ws/jars/stax-ex.jar
call mvn install:install-file -DgroupId=javax.activation -DartifactId=activation -Dversion=1.0.2 -Dpackaging=jar -Dfile=C:/devtools/tools/java-tools/exe/spring-ws/jars/activation.jar
call mvn install:install-file -DgroupId=javax.xml.ws -DartifactId=jaxws-api -Dversion=2.1-SNAPSHOT -Dpackaging=jar -Dfile=C:/devtools/tools/java-tools/exe/spring-ws/jars/jaxws-api.jar
call mvn install:install-file -DgroupId=org.springframework -DartifactId=spring-core -Dversion=2.0.5 -Dpackaging=jar -Dfile=C:/devtools/tools/java-tools/exe/spring-ws/jars/spring-core.jar
call mvn install:install-file -DgroupId=com.sun.xml.ws -DartifactId=jaxws-rt -Dversion=EA3 -Dpackaging=jar -Dfile=C:/devtools/tools/java-tools/exe/spring-ws/jars/jaxws-rt.jar
call mvn install:install-file -DgroupId=com.sun.xml.bind -DartifactId=jaxb-impl -Dversion=2.1-EA2 -Dpackaging=jar -Dfile=C:/devtools/tools/java-tools/exe/spring-ws/jars/jaxb-impl.jar
And here is the final error:
C:\devtools\tools\java-tools\exe\spring-ws\spring-ws-1.5.6\samples\mtom\client\jaxws>ant build
Buildfile: build.xml
init:
[artifact:dependencies] Downloading: com/sun/xml/ws/jaxws-tools/EA3/jaxws-tools-EA3.pom
[artifact:dependencies] Downloading: com.sun.xml.ws/poms/jaxws-tools-EA3.pom
[artifact:dependencies] Downloading: com/sun/xml/bind/jaxb-xjc/2.1-EA2/jaxb-xjc-2.1-EA2.pom
[artifact:dependencies] Downloading: com.sun.xml.bind/poms/jaxb-xjc-2.1-EA2.pom
[artifact:dependencies] Downloading: com/sun/xml/stream/buffer/streambuffer/0.3/streambuffer-0.3.pom
[artifact:dependencies] Downloading: com.sun.xml.stream.buffer/poms/streambuffer-0.3.pom
[artifact:dependencies] Downloading: com/sun/xml/stream/sjsxp/1.0/sjsxp-1.0.pom
[artifact:dependencies] Downloading: com.sun.xml.stream/poms/sjsxp-1.0.pom
[artifact:dependencies] Downloading: org/jvnet/staxex/stax-ex/1.0/stax-ex-1.0.pom
[artifact:dependencies] Downloading: org.jvnet.staxex/poms/stax-ex-1.0.pom
[artifact:dependencies] Downloading: javax/activation/activation/1.0.2/activation-1.0.2.pom
[artifact:dependencies] Downloading: javax.activation/poms/activation-1.0.2.pom
[artifact:dependencies] Downloading: javax/xml/ws/jaxws-api/2.1-SNAPSHOT/jaxws-api-2.1-SNAPSHOT.pom
[artifact:dependencies] Downloading: javax.xml.ws/poms/jaxws-api-2.1-SNAPSHOT.pom
[artifact:dependencies] Downloading: org/springframework/spring-core/2.0.5/spring-core-2.0.5.pom
[artifact:dependencies] Downloading: org.springframework/poms/spring-core-2.0.5.pom
[artifact:dependencies] Downloading: com/sun/xml/ws/jaxws-rt/EA3/jaxws-rt-EA3.pom
[artifact:dependencies] Downloading: com.sun.xml.ws/poms/jaxws-rt-EA3.pom
[artifact:dependencies] Downloading: com/sun/xml/bind/jaxb-impl/2.1-EA2/jaxb-impl-2.1-EA2.pom
[artifact:dependencies] Downloading: com.sun.xml.bind/poms/jaxb-impl-2.1-EA2.pom
generate:
BUILD FAILED
C:\devtools\tools\java-tools\exe\spring-ws\spring-ws-1.5.6\samples\mtom\client\jaxws\build.xml:56: java.lang.NoClassDefFoundError: javax/xml/ws/Service
Total time: 7 minutes 1 second
-
May 18th, 2009, 04:27 PM
#2
Here is How to do it with MTOM
First, I would like to mention that most of the problems I had were due to the fact that I was too green to Spring-WS and Maven. I finally figured out how to use the MTOM example and create my own. Here is how I did it:
1 - POM.xml (I used the JAXB2 implementation from EclipseLink but you can comment that section out and use Sun's implementation if you like):
<?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>
<groupId>com.oracle.mtom</groupId>
<artifactId>mtomService2</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>mtomService2 Spring-WS Application</name>
<url>http://www.springframework.org/spring-ws</url>
<build>
<finalName>mtomService2</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<generatePackage>com.oracle.mtom.schema</generatePackage>
<schemaDirectory>src/main/webapp/WEB-INF</schemaDirectory>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<!-- here the phase you need -->
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/mtomService2/cache</outputDirectory>
<resources>
<resource>
<directory>src/main/webapp/cache</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Maven 2 Repository</name>
<url>http://download.java.net/maven/2</url>
</repository>
<repository>
<id>maven-repository.dev.java.net</id>
<name>Java.net Maven 1 Repository (legacy)</name>
<url>http://download.java.net/maven/1</url>
<layout>legacy</layout>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Maven 2 Repository</name>
<url>http://download.java.net/maven/2</url>
</pluginRepository>
<pluginRepository>
<id>maven-repository.dev.java.net</id>
<name>Java.net Maven 1 Repository (legacy)</name>
<url>http://download.java.net/maven/1</url>
<layout>legacy</layout>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core-tiger</artifactId>
<version>1.5.6</version>
<exclusions>
<exclusion>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-oxm-tiger</artifactId>
<version>1.5.6</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1</version>
</dependency>
<!--
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.1</version>
<exclusions>
<exclusion>
<groupId>javax.xml.stream</groupId>
<artifactId>stax-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.1.5</version>
</dependency>
-->
<!-- EclipseLink JAXB2 interface -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>javax.xml.bind</artifactId>
<version>2.0.0.v20080604-1500</version>
</dependency>
<!-- EclipseLink JAXB2 implementation -->
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.0</version>
</dependency>
<!--
<dependency>
<groupId>com.oracle.jaxb</groupId>
<artifactId>oracle-jaxb-package</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
-->
<!-- SAAJ -->
<!-- Sun's public API -->
<dependency>
<groupId>javax.xml.soap</groupId>
<artifactId>saaj-api</artifactId>
<version>1.3</version>
</dependency>
<!--Sun's SAAJ implementation. -->
<dependency>
<groupId>com.sun.xml.messaging.saaj</groupId>
<artifactId>saaj-impl</artifactId>
<version>1.3</version>
</dependency>
<!-- Oracle's SAAJ implementation -->
<!--
<dependency>
<groupId>oracle.j2ee.ws.saaj</groupId>
<artifactId>orasaaj</artifactId>
<version>11.1.1.0.0</version>
</dependency>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>xmlparserv2</artifactId>
<version>11.1.0.6.0_production</version>
</dependency>
-->
<!-- STAX -->
<dependency>
<groupId>javax.xml.stream</groupId>
<artifactId>stax-api</artifactId>
<version>1.0-2</version>
</dependency>
<dependency>
<groupId>javanet.staxutils</groupId>
<artifactId>stax-utils</artifactId>
<version>1.0.1</version>
</dependency>
continues on next thread....
Last edited by joe_roberts_z; May 18th, 2009 at 04:33 PM.
-
May 18th, 2009, 04:28 PM
#3
Here is How to do it with MTOM (part 2)
<!-- Woodstox STAX -->
<dependency>
<groupId>woodstox-core-asl</groupId>
<artifactId>woodstox-core-asl</artifactId>
<version>4.0.3</version>
</dependency>
<dependency>
<groupId>stax2-api</groupId>
<artifactId>stax2-api</artifactId>
<version>3.0.1</version>
</dependency>
<!-- Oracle dependencies for WSDL4J -->
<dependency>
<groupId>oracle</groupId>
<artifactId>orawsdl</artifactId>
<version>11.1.1</version>
</dependency>
<dependency>
<groupId>oracle</groupId>
<artifactId>oracle_http_client_</artifactId>
<version>11.1.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>system</scope>
<systemPath>c:/java/tomcat/common/lib/servlet-api.jar</systemPath>
</dependency>
<!-- JMS Jars Dependencies -->
<dependency>
<groupId>org.springframework.jms</groupId>
<artifactId>spring-jms</artifactId>
<version>2.0.6</version>
</dependency>
<dependency>
<groupId>org.springframework.dao</groupId>
<artifactId>spring-dao</artifactId>
<version>2.0.6</version>
</dependency>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>com.oracle.transport</groupId>
<artifactId>oracle-jms-package</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<!-- IBM Jars for JMS -->
<dependency>
<groupId>com.ibm.mq</groupId>
<artifactId>com.ibm.mq</artifactId>
<version>6.0</version>
</dependency>
<dependency>
<groupId>javax.resource.cci</groupId>
<artifactId>connector</artifactId>
<version>6.0</version>
</dependency>
<dependency>
<groupId>com.ibm.mq.jms</groupId>
<artifactId>com.ibm.mqjms</artifactId>
<version>6.0</version>
</dependency>
<dependency>
<groupId>com.ibm.disthub2</groupId>
<artifactId>dhbcore</artifactId>
<version>6.0</version>
</dependency>
<dependency>
<groupId>javax.transaction.xa</groupId>
<artifactId>jta</artifactId>
<version>6.0</version>
</dependency>
<!-- ActiveMQ Jars for JMS -->
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>apache-activemq-all</artifactId>
<version>5.1.0</version>
</dependency>
<!-- Dependencies for mail sender Follow -->
<dependency>
<groupId>org.springframework.ws.transport</groupId>
<artifactId>spring-ws-support</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>org.apache.commons.httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons.codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
<exclusions>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
continues on next thread....
-
May 18th, 2009, 04:31 PM
#4
Here is How to do it with MTOM (part 3)
2 - Schema for the web service (will be the same for the client side):
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://oracle.com/mtom"
xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
targetNamespace="http://oracle.com/mtom"
elementFormDefault="qualified">
<complexType name="Attachment">
<sequence>
<element name="name" type="string"/>
<element name="content" type="base64Binary" xmime:expectedContentTypes="*/*"/>
</sequence>
</complexType>
<complexType name="Package">
<sequence>
<element name="PackageTitle" type="xsd:string"/>
<element name="Recipient1" type="xsd:string"/>
<element name="Recipient2" type="xsd:string"/>
<element name="Recipient3" type="xsd:string"/>
<element name="StartDate" type="xsd:date" minOccurs="0" maxOccurs="1"/>
<element name="EndDate" type="xsd:date" minOccurs="0" maxOccurs="1"/>
<element name="Attachment" type="tns:Attachment" minOccurs="0" maxOccurs="unbounded"/>
<element name="Optional1" type="xsd:string" minOccurs="0" maxOccurs="1"/>
</sequence>
</complexType>
<element name="TestRequest" type="tns:Package"/>
<complexType name="PackageResponse">
<sequence>
<element name="Results" type="string"/>
<element name="ArchiveDate" type="xsd:date" minOccurs="0" maxOccurs="1"/>
</sequence>
</complexType>
<element name="TestResponse" type="tns:PackageResponse"/>
</schema>
continues on next thread....
-
May 18th, 2009, 04:32 PM
#5
Here is how to do it with MTOM (part 4)
3 - Spring Web service config. file:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="testRepository" class="com.oracle.mtom.service.StubTestRepository"/>
<bean class="com.oracle.mtom.ws.TestRepositoryEndpoint">
<constructor-arg ref="testRepository"/>
</bean>
<!-- Uses annotations -->
<bean class="org.springframework.ws.server.endpoint.mapp ing.PayloadRootAnnotationMethodEndpointMapping">
<property name="interceptors">
<list>
<!-- Logs messages -->
<ref bean="loggingInterceptor"/>
<ref bean="validatingInterceptor"/>
</list>
</property>
</bean>
<bean class="org.springframework.ws.server.endpoint.adap ter.GenericMarshallingMethodEndpointAdapter">
<constructor-arg ref="marshaller"/>
</bean>
<bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshalle r">
<!--A list of colon : separated package names that contain schema derived classes -->
<property name="contextPath" value="com.oracle.mtom.schema"/>
<!--Enables / disables MTOM -->
<property name="mtomEnabled" value="true"/>
<!--Used for validation. Cannot validate when MTOM is enabled. -->
<!-- <property name="schema" value="/WEB-INF/schema.xsd"/> -->
</bean>
<bean id="mtom" class="org.springframework.ws.wsdl.wsdl11.DefaultW sdl11Definition">
<property name="schema" ref="schema"/>
<property name="portTypeName" value="TestRepository"/>
<property name="locationUri" value="http://localhost:8080/mtomService2/"/>
</bean>
<bean id="schema" class="org.springframework.xml.xsd.SimpleXsdSchema ">
<property name="xsd" value="/WEB-INF/schema.xsd"/>
</bean>
<!-- Logs the messages to stdout -->
<bean id="loggingInterceptor" class="org.springframework.ws.soap.server.endpoint .interceptor.SoapEnvelopeLoggingInterceptor">
<property name="logRequest" value="true"/>
<property name="logResponse" value="true"/>
</bean>
<bean id="validatingInterceptor" class="org.springframework.ws.soap.server.endpoint .interceptor.PayloadValidatingInterceptor">
<property name="schema" value="/WEB-INF/schema.xsd"/>
<property name="validateRequest" value="true"/>
<property name="validateResponse" value="true"/>
<property name="errorHandler" value="com.oracle.validation.handler.ValidationErr orHandler"/>
<property name="skipElements" value="content"/>
</bean>
</beans>
continues on next thread....
-
May 18th, 2009, 04:35 PM
#6
Here is How to do it with MTOM (part 5)
4 - Classes Generated by the Maven and JAXB2
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-792
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2009.05.18 at 04:56:56 PM EDT
//
package com.oracle.mtom.schema;
import javax.activation.DataHandler;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlMimeType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for Attachment complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="Attachment">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="content" type="{http://www.w3.org/2001/XMLSchema}base64Binary"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Attachment", propOrder = {
"name",
"content"
})
public class Attachment {
@XmlElement(required = true)
protected String name;
@XmlElement(required = true)
@XmlMimeType("*/*")
protected DataHandler content;
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
/**
* Gets the value of the content property.
*
* @return
* possible object is
* {@link DataHandler }
*
*/
public DataHandler getContent() {
return content;
}
/**
* Sets the value of the content property.
*
* @param value
* allowed object is
* {@link DataHandler }
*
*/
public void setContent(DataHandler value) {
this.content = value;
}
}
continues on next thread....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules