28 Feb 2013

org.springframework.jdbc.UncategorizedSQLException: Error setting null parameter.

Problem: org.springframework.jdbc.UncategorizedSQLException: Error setting null parameter. Most JDBC drivers require that the JdbcType must be specified for all nullable parameters.

Cause: The JdbcType property is not set in the XML mapper.

Solution: Specify jdbcType of the parameter in the mapper.

<select id="selectByYear" parameterType="map" resultMap="BaseResultMap"> SELECT * FROM tbl_calendar WHERE year=#{year,jdbcType=DECIMAL} </select>

22 Feb 2013

java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for

Problem: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for

Cause: The same namespace is used in 2 different mappers.

Solution: Change the namespace in one of the mappers.

<?mapper namespace="com.blogspot.adaprognotebook.dao.mybatis.CompanyMapper" >

Exception getting JDBC Driver

Problem: When generating the iMbatis mapping files in Eclipse, "Fail to generate mapper files: Exception getting JDBC Driver" error is encountered.

Figure 1: Exception getting JDBC Driver

Cause: Eclipse cannot find the JDBC library file.

Solution: Add <classPathEntry> to the "generatorConfig.xml" to define the class path of the library file.

generatorConfig.xml

<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd" > <generatorConfiguration> <classPathEntry location="/Users/adaprognotebook/lib/ojdbc6.jar"/> <context id="system" > <plugin type="org.mybatis.generator.plugins.CaseInsensitiveLikePlugin" /> <jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver" connectionURL="jdbc:oracle:thin:@//127.0.0.1:1521/books" userId="ada" password="pass123" /> <javaModelGenerator targetPackage="com.blogspot.adaprognotebook.model" targetProject="books" /> <sqlMapGenerator targetPackage="com.blogspot.adaprognotebook.dao.mybatis.mapper" targetProject="books/src/conf" /> <javaClientGenerator targetPackage="com.blogspot.adaprognotebook.dao.mybatis" targetProject="books" type="XMLMAPPER" /> <table schema="books" tableName="AUTHROS" /> </context> </generatorConfiguration>

20 Feb 2013

How to run Maven with switch

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.7.1:test (default-test) on project lucky-number-ws: There are test failures. [ERROR] [ERROR] Please refer to D:\workspaces\SpringTest\lucky-number-ws\target\surefire-reports for the individual test results. [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging.

Solution: Add the switches after the goal, e.g. test -e -X.

Figure 1: Run Configuration with switch

19 Feb 2013

Unable to access binding information for class. Make sure the binding has been compiled

Problem: Unable to access binding information for class. Make sure the binding has been compiled.

HTTP ERROR 500 Problem accessing /lucky-number-ws/LuckyRequest.wsdl. Reason: Error creating bean with name 'payloadMapping' defined in ServletContext resource [/WEB-INF/spring/applicationContext.xml]: Cannot resolve reference to bean 'luckyServiceEndpoint' while setting bean property 'endpointMap' with key [TypedStringValue: value [{http://localhost:8080/luckyservice/services/}/LuckyRequest], target type [null]]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'luckyServiceEndpoint' defined in ServletContext resource [/WEB-INF/spring/applicationContext.xml]: Cannot resolve reference to bean 'marshaller' while setting bean property 'marshaller'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'marshaller' defined in ServletContext resource [/WEB-INF/spring/applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.oxm.jibx.JibxSystemException: Unable to access binding information for class com.blogspot.adaprognotebook.message.LuckyResponse Make sure the binding has been compiled; nested exception is org.jibx.runtime.JiBXException: Unable to access binding information for class com.blogspot.adaprognotebook.message.LuckyResponse Make sure the binding has been compiled

Solution: Run "jibx:bind" goal to compile the binding.

[INFO] Scanning for projects... [INFO] [INFO] ---------------------------------------------------------------- [INFO] Building Lucky Number Web Service 0.0.1-SNAPSHOT [INFO] ---------------------------------------------------------------- [INFO] [INFO] --- jibx-maven-plugin:1.2.4.5:bind (default-cli) @ lucky-number-ws --- [INFO] Running JiBX binding compiler (single-module mode) on 1 binding file(s) [INFO] ---------------------------------------------------------------- [INFO] BUILD SUCCESS [INFO] ---------------------------------------------------------------- [INFO] Total time: 1.772s [INFO] Finished at: Tue Feb 19 18:01:43 CST 2013 [INFO] Final Memory: 11M/24M [INFO] ----------------------------------------------------------------

Plugin or one of its dependencies could not be resolved: Failed to read artifact descriptor: Could not find artifact

Problem: Plugin {plugin name} or one of its dependencies could not be resolved: Failed to read artifact descriptor for {plugin name}: Could not find artifact {plugin name}

[INFO] ----------------------------------------------------------- [INFO] BUILD FAILURE [INFO] ----------------------------------------------------------- [INFO] Total time: 0.079s [INFO] Finished at: Tue Feb 05 12:14:23 CST 2013 [INFO] Final Memory: 5M/8M [INFO] ----------------------------------------------------------- [ERROR] Plugin org.jibx:maven-jibx-plugin:1.2.4-SNAPSHOT or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.jibx:maven-jibx-plugin:jar:1.2.4-SNAPSHOT: Could not find artifact org.jibx:maven-jibx-plugin:pom:1.2.4-SNAPSHOT -> [Help 1]

Cause: The repository does not contain the plugin.

Solution: Add the <pluginRepositories> sections in the pom.xml file.

pom.xml

<pluginRepositories> <pluginRepository> <id>sonatype-nexus-snapshots</id> <name>Sonatype Nexus Snapshots</name> <url>https://repository.sonatype.org/content/groups/public/</url> <snapshots> <enabled>true</enabled> </snapshots> </pluginRepository> </pluginRepositories> <repositories> <repository> <id>sonatype-nexus-snapshots</id> <name>Sonatype Nexus Snapshots</name> <url>https://oss.sonatype.org/content/repositories/snapshots</url> <releases> <enabled>false</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories>

Error assembling WAR: webxml attribute is required.

Problem: Error assembling WAR: webxml attribute is required.

[INFO] ----------------------------------------------------------- [INFO] BUILD FAILURE [INFO] ----------------------------------------------------------- [INFO] Total time: 1.694s [INFO] Finished at: Tue Feb 05 15:21:46 CST 2013 [INFO] Final Memory: 10M/21M [INFO] ----------------------------------------------------------- [ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-war) on project {project name}: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -> [Help 1]

Cause: The maven-war-plugin plugin is not configured.

Solution:Add the following section in the pom.xml.

pom.xml

<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.1.1</version> <configuration> <failOnMissingWebXml>false</failOnMissingWebXml> </configuration> </plugin>

class org.jibx.runtime.JodaConvert not found in classpath.

Problem: class org.jibx.runtime.JodaConvert not found in classpath.

[INFO] --- jibx-maven-plugin:1.2.4.5:bind (default-cli) @ memberservice --- [INFO] Running JiBX binding compiler (single-module mode) on 1 binding file(s) Running binding compiler version jibx_1_2_5-SNAPSHOT [INFO] ----------------------------------------------------------- [INFO] BUILD FAILURE [INFO] ----------------------------------------------------------- [INFO] Total time: 0.640s [INFO] Finished at: Tue Feb 05 16:53:07 CST 2013 [INFO] Final Memory: 5M/14M [INFO] ----------------------------------------------------------- [ERROR] Failed to execute goal org.jibx:jibx-maven-plugin:1.2.4.5:bind (default-cli) on project memberservice: Internal error - class org.jibx.runtime.JodaConvert not found in classpath -> [Help 1]

Cause: Wrong version of JiBX is used.

Solution:Update the version of JiBX dependencies in the pom.xml.

pom.xml

<dependency> <groupId>org.jibx</groupId> <artifactId>jibx-run</artifactId> <version>1.2.4.5</version> </dependency> <dependency> <groupId>org.jibx</groupId> <artifactId>jibx-extras</artifactId> <version>1.2.4.5</version> </dependency>

'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing.

Problem: 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing.

[WARNING] Some problems were encountered while building the effective model for {project name}:war:1.0-SNAPSHOT [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 83, column 15 [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects.

Cause: Version number is not set for the maven-compiler-plugin plugin.

Solution:Set the version number under the <artifactId>

pom.xml

<plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.0</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin>

File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!

Problem: File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!

[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent

Cause: Encoding of the source files is not set.

Solution: Set the encoding of the source files.

pom.xml

<project> ... <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> ... </project>

The project uses or overrides a deprecated API.

Problem: The project uses or overrides a deprecated API.

[WARNING] Note: D:\workspaces\Test\LuckyNumberWebService\src\test\java\com\blogspot\adaprognotebook\client\TestLuckyServiceClient.java uses or overrides a deprecated API. [WARNING] Note: Recompile with -Xlint:deprecation for details.

Cause: The project uses or overrides a deprecated API.

Solution: Set "-Xlint:deprecation" as compiler argument during compilation.

pom.xml

<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.0</version> <configuration> <source>1.6</source> <target>1.6</target> <compilerArgument>-Xlint:deprecation</compilerArgument> </configuration> </plugin>

Can't resolve Archetype when trying to add one in STS.

Problem: Can't resolve Archetype when trying to add one in STS.
Figure 1: Add Archetype.
Figure 2: Can't resolve Archetype.
Cause: STS cannot resolve the repository even though the Repository URL is specified.
Solution: Set the repository in .m2/settings.xml.
pom.xml
<profiles> <profile> <repositories> <repository> <id>mvn-repository</id> <name>MvnRepository.com</name> <url>http://mvnrepository/</url> </repository> </repositories> </profile> </profiles>

Java.Lang.ClassNotFoundException: Org.Objectweb.Asm.Type

Problem: Java.Lang.ClassNotFoundException: Org.Objectweb.Asm.Type
Caused by: java.lang.NoClassDefFoundError: org.objectweb.asm.Type

WARN:oejw.WebAppContext:Failed startup of context o.e.j.w.WebAppContext java.lang.reflect.InvocationTargetException Caused by: java.lang.ClassNotFoundException: org.objectweb.asm.Type

Cause: asm.jar is missing.

Solution: Add the dependency in the project's pom.xml.

<dependency> <groupId>asm</groupId> <artifactId>asm</artifactId> <version>3.3.1</version> </dependency>

Project configuration is not up-to-date with pom.xml. Run project configuration update.

Problem: Project configuration is not up-to-date with pom.xml. Run project configuration update.

Description Resource Path Location Type Project configuration is not up-to-date with pom.xml. Run project configuration update {Project Name} line 1 Maven Configuration Problem

Cause: Project configuration is not up-to-date.

Solution: Run "Maven" -> "Update Project Configuration...".

Figure 1: Update Project Configuration

15 Feb 2013

Setup Maven/Jetty plugins in Eclipse

Installation

  1. Install Maven in Eclipse.

Implementation

It is assumed that there is already a web application project on-hand. You may reference to another article "First Hello World Web Application using Maven" to create one.

  1. Configure the project's pom.xml.
    • In order to stop Jetty, <stopPort> and <stopKey> are configured in pom.xml.
    • <scanIntervalSeconds> defines the pause in seconds between sweeps of the webapp to check for changes and automatically hot redeploy if any are detected. By default this is 0, which disables hot deployment scanning. A number greater than 0 enables it.
    • Note that starting from Jetty 7, the Jetty/Maven plugin has been renamed to jetty-maven-plugin in order to fulfill the naming convention of Maven 2. Therefore, the configurations are different.
      • Add the following in the project's pom.xml for Jetty 6 or below.
        <repositories> <repository> <id>sonatype-nexus-snapshots</id> <name>Sonatype Nexus Snapshots</name> <url>https://oss.sonatype.org/content/repositories/snapshots</url> <releases> <enabled>false</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> <build> <plugins> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> <version>${jetty.version}</version> <configuration> <scanIntervalSeconds>60</scanIntervalSeconds> <stopPort>7788</stopPort> <stopKey>foo</stopKey> <webApp> <descriptor>${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor> </webApp> </configuration> </plugin> </plugins> </build> <properties> <jetty.version>6.1.26</jetty.version> </properties>
      • Add the following in the project's pom.xml for Jetty 7 or above.
        <repositories> <repository> <id>central-repo-browser</id> <name>The Central Repository Browser</name> <url>http://search.maven.org</url> </repository> </repositories> <build> <plugins> <plugin> <artifactId>jetty-maven-plugin</artifactId> <version>${jetty.version}</version> <configuration> <scanIntervalSeconds>60</scanIntervalSeconds> <stopPort>7788</stopPort> <stopKey>foo</stopKey> <webApp> <descriptor>${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor> </webApp> </configuration> </plugin> </plugins> </build> <properties> <jetty.version>8.1.9.v20130131</jetty.version> </properties>
  2. Setup the Debug/Run Configurations in Eclipse.
    1. Select "Debug Configurations.."/"Run Configurations.." from the menu in Eclipse.
    2. In the dialog showed up, create a new configuration and set the goals as "jetty:run". Click the "Apply" button to save.
      Figure 1: New Configuration for starting Jetty.

    3. Create a new configuration and set the goals as "jetty:stop". Click the "Apply" button to save.
      Figure 2: New Configuration for stopping Jetty.

    4. Figure 3: New Configuration for compilation.
    5. Create a new configuration and set the goals as "compile". Click the "Apply" button to save.
  3. Run the configurations.
    • To start Jetty, run the "Start" configuration (created as in Figure 1).
    • To stop Jetty, run the "Stop" configuration (created as in Figure 2).
    • To compile Jetty, run the "Compile" configuration (created as in Figure 3). When <scanIntervalSeconds> is defined, run this configuration for hot deployment.

6 Feb 2013

Spring Web Service

Create a Contract-First Spring Web Service
Contract-First Web Service is to develop web services by starting with the XML Schema/WSDL contract first followed by the Java code second.

Implementation

  1. Create the XML Schema.
    1. Define the XML Schema for the Request and Response messages.
    2. Save the XML Schema as "lucky.xsd" under the folder "WEB-INF/xsd".
    <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://com.blogspot.adaprognotebook/LuckyService/" elementFormDefault="qualified"> <xsd:element name="LuckyRequest"> <xsd:complexType> <xsd:sequence> <xsd:element name="name" type="xsd:string" /> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="LuckyResponse"> <xsd:complexType> <xsd:sequence> <xsd:element name="message" type="xsd:string" /> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema>
  2. Create and define the service interface in Java.

    LuckyService.java

    package main.java.com.blogspot.adaprognotebook.service; public interface LuckyService { String sayLuckyMessage(String name); }

    LuckyServiceImpl.java

    package main.java.com.blogspot.adaprognotebook.service; public class LuckyServiceImpl implements LuckyService { @Override public String sayLuckyMessage(String name) { if (name == null || name.trim().isEmpty()) { return "Tell me you name~~~"; } int number = (int)(Math.random()*100); return "Hello : " + name + "! Your lucky number is " + number + "."; } }
  3. Create the Object/XML binding.
    1. Create POJO classes for the Request (LuckyRequest.java) and Response (LuckyResponse.java) in Java.

      LuckyRequest.java

      package com.blogspot.adaprognotebook.message; public class LuckyRequest { private String name; public LuckyRequest() { super(); } public LuckyRequest(String name) { this.name = name; } public String getName() { return name; } public void setName(String name) { this.name = name; } }

      LuckyResponse.java

      package com.blogspot.adaprognotebook.message; public class LuckyResponse { private String message; public LuckyResponse() { super(); } public LuckyResponse(String message) { this.message = message; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } }
    2. Define the Object/XML binding using JiBX for the purpose of marshalling and unmarshalling for the above model classes.
    3. binding.xml

      <binding name="binding" package="com.blogspot.adaprognotebook.message" trim-whitespace="true"> <namespace uri="http://localhost:8080/luckyservice/" default="elements"/> <mapping class="com.blogspot.adaprognotebook.message.LuckyRequest" name="LuckyRequest"> <value style="element" name="name" get-method="getName" set-method="setName"/> </mapping> <mapping class="com.blogspot.adaprognotebook.message.LuckyResponse" name="LuckyResponse"> <value style="element" name="message" get-method="getMessage" set-method="setMessage"/> </mapping>
  4. Configure Spring's Application Context.

    WEB-INF/spring/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" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="payloadMapping" class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping"> <property name="endpointMap"> <map> <entry key="{http://localhost:8080/luckyservice/}/LuckyRequest" value-ref="luckyServiceEndpoint" /> </map> </property> </bean> <bean id="luckyService" class="com.blogspot.adaprognotebook.service.LuckyServiceImpl" /> <bean id="luckyServiceEndpoint" class="com.blogspot.adaprognotebook.endpoint.LuckyServiceEndpoint"> <property name="marshaller" ref="marshaller" /> <property name="unmarshaller" ref="unmarshaller" /> <property name="luckyService" ref="luckyService" /> </bean> <bean id="marshaller" class="org.springframework.oxm.jibx.JibxMarshaller"> <property name="targetClass" value="com.blogspot.adaprognotebook.message.LuckyResponse" /> </bean> <bean id="unmarshaller" class="org.springframework.oxm.jibx.JibxMarshaller"> <property name="targetClass" value="com.blogspot.adaprognotebook.message.LuckyRequest" /> </bean> <bean id="LuckyRequest" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition"> <property name="schema" ref="schema" /> <property name="portTypeName" value="Hello" /> <property name="locationUri" value="http://localhost:8080/luckyservice/services/LuckyRequest" /> </bean> <bean id="schema" class="org.springframework.xml.xsd.SimpleXsdSchema"> <property name="xsd" value="/WEB-INF/xsd/lucky.xsd" /> </bean> </beans>
  5. Define the Endpoint.
    package com.blogspot.adaprognotebook.endpoint; import com.blogspot.adaprognotebook.message.HelloRequest; import com.blogspot.adaprognotebook.message.HelloResponse; import com.blogspot.adaprognotebook.service.HelloService; import org.springframework.ws.server.endpoint.AbstractMarshallingPayloadEndpoint; @SuppressWarnings("deprecation") public class HelloServiceEndpoint extends AbstractMarshallingPayloadEndpoint { private HelloService helloService; protected Object invokeInternal(Object requestObject) throws Exception { HelloRequest request = (HelloRequest) requestObject; String name = request.getName(); return new HelloResponse(helloService.sayhello(name)); } public HelloService getHelloService() { return helloService; } public void setHelloService(HelloService helloService) { this.helloService = helloService; } }
  6. Deploy the web service to Web Server like Jetty.
  7. View the generated WSDL at http://localhost:8080/luckyservice/LuckyRequest.wsdl.
    <?xml version="1.0" encoding="UTF-8"?><wsdl:definitions targetNamespace="http://localhost:8080/luckyservice/" xmlns:sch="http://localhost:8080/luckyservice/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://localhost:8080/luckyservice/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> <wsdl:types> <xsd:schema elementFormDefault="qualified" targetNamespace="http://localhost:8080/luckyservice/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="LuckyRequest"> <xsd:complexType> <xsd:sequence> <xsd:element name="name" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="LuckyResponse"> <xsd:complexType> <xsd:sequence> <xsd:element name="message" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> </wsdl:types> <wsdl:message name="LuckyResponse"> <wsdl:part element="sch:LuckyResponse" name="LuckyResponse"> </wsdl:part> </wsdl:message> <wsdl:message name="LuckyRequest"> <wsdl:part element="sch:LuckyRequest" name="LuckyRequest"> </wsdl:part> </wsdl:message> <wsdl:portType name="Lucky"> <wsdl:operation name="Lucky"> <wsdl:input message="sch:LuckyRequest" name="LuckyRequest"> </wsdl:input> <wsdl:output message="sch:LuckyResponse" name="LuckyResponse"> </wsdl:output> </wsdl:operation> </wsdl:portType> <wsdl:binding name="LuckySoap11" type="sch:Lucky"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="Lucky"> <soap:operation soapAction=""/> <wsdl:input name="LuckyRequest"> <soap:body use="literal"/> </wsdl:input> <wsdl:output name="LuckyResponse"> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="LuckyService"> <wsdl:port binding="sch:LuckySoap11" name="LuckySoap11"> <soap:address location="http://localhost:8080/luckyservice/services/LuckyRequest"/> </wsdl:port> </wsdl:service> </wsdl:definitions>
  8. Test the web service using tools like SOAP UI.

java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be opened because it does not exist.

Problem: IOException parsing XML document from class path resource [applicationContext.xml]; nested exception is java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be opened because it does not exist.

Cause: Wrong path is set in web.xml (clsspath:applicationContext.xml).

Solution: Set the correct path in web.xml.

web.xml

<servlet> <servlet-name>helloservice</servlet-name> <servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>WEB-INF/spring/applicationContext.xml</param-value> </init-param> </servlet>

5 Feb 2013

ConnectException: UnresolvedAddressException

Problem: Plugin {plugin name} or one of its dependencies could not be resolved: ConnectException: UnresolvedAddressException
[INFO] ----------------------------------------------------------- [INFO] Building Hello Maven Webapp 1.0-SNAPSHOT [INFO] ----------------------------------------------------------- Downloading: http://repo1.maven.org/maven2/org/jibx/maven-jibx-plugin/1.2.1/maven-jibx-plugin-1.2.1.pom [INFO] -------------------------------------------------------- [INFO] BUILD FAILURE [INFO] ----------------------------------------------------------- [INFO] Total time: 2.656s [INFO] Finished at: Tue Feb 05 11:22:30 CST 2013 [INFO] Final Memory: 5M/9M [INFO] ----------------------------------------------------------- [ERROR] Plugin org.jibx:maven-jibx-plugin:1.2.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.jibx:maven-jibx-plugin:jar:1.2.1: Could not transfer artifact org.jibx:maven-jibx-plugin:pom:1.2.1 from/to central (http://repo1.maven.org/maven2): ConnectException: UnresolvedAddressException -> [Help 1]
Cause: There may be a proxy server or a firewall that restricts which websites one can connect to.
Solution: Configure a proxy to use for some or all of your HTTP requests (available in Maven 2.0) in the settings.xml file.
There are two locations where a settings.xml file may live:
  • The Maven install: $M2_HOME/conf/settings.xml
  • A user's install: ${user.home}/.m2/settings.xml
settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <localRepository/> <interactiveMode/> <usePluginRegistry/> <offline/> <pluginGroups/> <servers/> <mirrors/> <proxies/> <proxy> <active>true</active> <protocol>http</protocol> <host>proxy.somewhere.com</host> <port>8080</port> <username>proxyuser</username> <password>somepassword</password> <nonProxyHosts>www.google.com</nonProxyHosts> </proxy> </proxies> <profiles/> <activeProfiles/> </settings/&gt