I am trying out a simple spring web service application. I have configured the application correctly but when i try access the wsdl file i get the following error:
at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_07] 17:24:35,409 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/springWsTest]] (http--127.0.0.1-8080-1) Initializing Spring FrameworkServlet 'webservice' 17:24:35,419 INFO [org.springframework.ws.transport.http.MessageDispatcherServlet] (http--127.0.0.1-8080-1) FrameworkServlet 'webservice': initialization started 17:24:35,428 INFO [org.springframework.web.context.support.XmlWebApplicationContext] (http--127.0.0.1-8080-1) Refreshing WebApplicationContext for namespace 'webservice-servlet': startup date [Tue Jul 03 17:24:35 BST 2012]; parent: Root WebApplicationContext 17:24:35,443 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (http--127.0.0.1-8080-1) Loading XML bean definitions from ServletContext resource [/WEB-INF/ws-config.xml] 17:24:35,541 INFO [org.springframework.context.annotation.ClassPathBeanDefinitionScanner] (http--127.0.0.1-8080-1) JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning 17:24:35,595 INFO [org.springframework.context.annotation.ClassPathBeanDefinitionScanner] (http--127.0.0.1-8080-1) JSR-330 'javax.inject.Named' annotation found and supported for component scanning 17:24:35,655 INFO [org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor] (http--127.0.0.1-8080-1) JSR-330 'javax.inject.Inject' annotation found and supported for autowiring 17:24:35,691 INFO [org.springframework.ws.soap.addressing.server.AnnotationActionEndpointMapping] (http--127.0.0.1-8080-1) Supporting [WS-Addressing August 2004, WS-Addressing 1.0] 17:24:35,699 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] (http--127.0.0.1-8080-1) Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1445d3c: defining beans [testEndPoint,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping#0,org.springframework.ws.soap.server.endpoint.mapping.SoapActionAnnotationMethodEndpointMapping#0,org.springframework.ws.soap.addressing.server.AnnotationActionEndpointMapping#0,org.springframework.ws.server.endpoint.adapter.method.dom.DomPayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.method.SourcePayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.method.jaxb.XmlRootElementPayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.method.jaxb.JaxbElementPayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapter#0,org.springframework.xml.xsd.SimpleXsdSchema#0,serviceDefinition,marshaller,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@a32ba9 17:24:35,764 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] (http--127.0.0.1-8080-1) Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1445d3c: defining beans [testEndPoint,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping#0,org.springframework.ws.soap.server.endpoint.mapping.SoapActionAnnotationMethodEndpointMapping#0,org.springframework.ws.soap.addressing.server.AnnotationActionEndpointMapping#0,org.springframework.ws.server.endpoint.adapter.method.dom.DomPayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.method.SourcePayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.method.jaxb.XmlRootElementPayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.method.jaxb.JaxbElementPayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapter#0,org.springframework.xml.xsd.SimpleXsdSchema#0,serviceDefinition,marshaller,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@a32ba9 17:24:35,837 ERROR [org.springframework.ws.transport.http.MessageDispatcherServlet] (http--127.0.0.1-8080-1) Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapter#0': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.springframework.expression.TypedValue at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913) [spring-context-3.1.0.RELEASE.jar:3.1.0.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) [spring-context-3.1.0.RELEASE.jar:3.1.0.RELEASE] at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:467) [spring-webmvc-3.0.6.RELEASE.jar:3.0.6.RELEASE] at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:483) [spring-webmvc-3.0.6.RELEASE.jar:3.0.6.RELEASE] at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:358) [spring-webmvc-3.0.6.RELEASE.jar:3.0.6.RELEASE] at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:325) [spring-webmvc-3.0.6.RELEASE.jar:3.0.6.RELEASE] at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127) [spring-webmvc-3.0.6.RELEASE.jar:3.0.6.RELEASE] at javax.servlet.GenericServlet.init(GenericServlet.java:242) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final] at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.10.Final.jar:] at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:952) [jbossweb-7.0.10.Final.jar:] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:188) [jbossweb-7.0.10.Final.jar:] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.10.Final.jar:] at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:154) [jboss-as-web-7.1.0.Final.jar:7.1.0.Final] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.10.Final.jar:] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.10.Final.jar:] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.10.Final.jar:] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.10.Final.jar:] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.10.Final.jar:] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.10.Final.jar:] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.10.Final.jar:] at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_07] Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.springframework.expression.TypedValue at org.springframework.expression.spel.support.StandardEvaluationContext.setRootObject(StandardEvaluationContext.java:85) [spring-expression-3.0.6.RELEASE.jar:3.0.6.RELEASE] at org.springframework.expression.spel.support.StandardEvaluationContext.<init>(StandardEvaluationContext.java:74) [spring-expression-3.0.6.RELEASE.jar:3.0.6.RELEASE] at org.springframework.context.expression.StandardBeanExpressionResolver.evaluate(StandardBeanExpressionResolver.java:124) [spring-context-3.1.0.RELEASE.jar:3.1.0.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.evaluateBeanDefinitionString(AbstractBeanFactory.java:1299) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE] at org.springframework.beans.factory.support.BeanDefinitionValueResolver.evaluate(BeanDefinitionValueResolver.java:224) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE] at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:311) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE] at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE] at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:353) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE] at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:153) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1360) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE] ... 27 more
Here are my configuration files:
ws-config.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:ws="http://www.springframework.org/schema/web-services" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-2.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:component-scan base-package="com.mypackage"/> <ws:annotation-driven/> <ws:dynamic-wsdl id="serviceDefinition" portTypeName="myService" locationUri="http://localhost:8080/springWsTest/webservice"> <ws:xsd location="/WEB-INF/schemas/downloadMessageRequest.xsd"/> </ws:dynamic-wsdl> <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"> <property name="contextPath" value="com.mypackage"/> <property name="mtomEnabled" value="true"/> </bean> </beans>
web.xml
<?xml version="1.0" encoding="ISO-8859-1"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> <context-param> <param-name>contextConfigLocation</param-name> <param-value> /WEB-INF/app-config.xml </param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <servlet> <servlet-name>webservice</servlet-name> <servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/ws-config.xml</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>webservice</servlet-name> <url-pattern>/webservice/*</url-pattern> </servlet-mapping> <mime-mapping> <extension>wsdl</extension> <mime-type>text/xml</mime-type> </mime-mapping> <mime-mapping> <extension>xsd</extension> <mime-type>text/xml</mime-type> </mime-mapping> </web-app>
app-config.xml
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:ws="http://www.springframework.org/schema/web-services" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd 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 http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-2.0.xsd"> <context:annotation-config/> <context:component-scan base-package="com.mypackage"/> </beans>
downloadMessageRequest.xsd
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:m="http://ws.mypackage.com" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" elementFormDefault="qualified" targetNamespace="http://ws.mypackage.com" attributeFormDefault="unqualified"> <xs:element name="downloadMessageRequest"> <xs:complexType/> </xs:element> <xs:element name="downloadMessageResponse" type="m:downloadResponseType" /> <xs:complexType name="downloadResponseType"> <xs:sequence> <xs:element name="requestName" type="xs:string"/> <xs:element name="payLoad"> <xs:complexType> <xs:sequence> <xs:element name="messagePayLoad" type="xs:base64Binary" xmime:expectedContentTypes="application/octet-stream"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> <xs:element name="localDTMRequest"> <xs:complexType/> </xs:element> <xs:element name="localDTMResponse"> <xs:complexType> <xs:sequence> <xs:element name="localDTM" type="xs:dateTime"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
Edit
pom.xml
<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>springWs</groupId> <artifactId>springWsTest</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>war</packaging> <name>springWs</name> <description> </description> <properties> <spring.version>3.1.0.RELEASE</spring.version> <spring.ws.version>2.0.3.RELEASE</spring.ws.version> <javax.servlet.version>2.5</javax.servlet.version> <jstl.version>1.2</jstl.version> <dom4j.version>1.6.1</dom4j.version> <xml.bind.version>2.2</xml.bind.version> </properties> <dependencies> <dependency> <groupId>org.springframework.ws</groupId> <artifactId>spring-ws-core</artifactId> <version>${spring.ws.version}</version> <exclusions> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> </exclusion> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> </exclusion> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> </exclusion> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> </exclusion> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring-asm</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-oxm</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>${xml.bind.version}</version> </dependency> <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-impl</artifactId> <version>${xml.bind.version}</version> </dependency> </dependencies> <build> <finalName>springWsTest</finalName> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.6</version> <configuration> <includes> <include>**/*Test.java</include> </includes> </configuration> </plugin> <plugin> <groupId>org.jvnet.jaxb2.maven2</groupId> <artifactId>maven-jaxb2-plugin</artifactId> <executions> <execution> <goals> <goal>generate</goal> </goals> </execution> </executions> <configuration> <schemaDirectory>src/main/webapp/WEB-INF/schemas</schemaDirectory> <packageName>com.mypackage.ws</packageName> </configuration> </plugin> </plugins> </build> <reporting> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>findbugs-maven-plugin</artifactId> <version>${findbugs.plugin.version}</version> <configuration> <includeFilterFile>findbugs.xml</includeFilterFile> <effort>Max</effort> <threshold>Low</threshold> <includeTests>true</includeTests> <findbugsXmlOutput>true</findbugsXmlOutput> <findbugsXmlWithMessages>true</findbugsXmlWithMessages> <xmlOutput>true</xmlOutput> <excludeFilterFile>findbugs-exclude.xml</excludeFilterFile> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <version>${checkstyle.version}</version> <configuration> <configLocation>checkstyle.xml</configLocation> </configuration> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jdepend-maven-plugin</artifactId> </plugin> <!-- JUnit reports --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-report-plugin</artifactId> <version>${surefire.report.version}</version> <reportSets> <reportSet> <id>test</id> <reports> <report>report-only</report> </reports> </reportSet> </reportSets> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-report-plugin</artifactId> <version>${surefire.report.version}</version> <reportSets> <reportSet> <id>integration-tests</id> <reports> <report>report-only</report> </reports> <configuration> <outputName>failsafe-report</outputName> <reportsDirectories> <reportsDirectory>target/failsafe-reports</reportsDirectory> </reportsDirectories> </configuration> </reportSet> </reportSets> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-deploy-plugin</artifactId> <version>2.5</version> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId> <version>2.4</version> <configuration> <formats> <format>html</format> <format>xml</format> </formats> <instrumentation> <ignores> <ignore>com/bt/bl/**/*Test.*</ignore> <ignore>**/*Steps.*</ignore> <ignore>**/*Story.*</ignore> </ignores> <excludes> <exclude>com/bt/bl/**/*Test.class</exclude> <exclude>**/*Steps.class</exclude> <ignore>**/*Story.*</ignore> <ignore>**/*jbehave*.*</ignore> </excludes> </instrumentation> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-pmd-plugin</artifactId> <configuration> <targetJdk>1.5</targetJdk> <rulesets> <!-- PMD rule sets --> <ruleset>/rulesets/basic.xml</ruleset> <ruleset>rulesets/codesize.xml</ruleset> <ruleset>/rulesets/coupling.xml</ruleset> <ruleset>/rulesets/design.xml</ruleset> <ruleset>/rulesets/imports.xml</ruleset> <ruleset>/rulesets/unusedcode.xml</ruleset> </rulesets> </configuration> </plugin> </plugins> </reporting> </project>
Advertisement
Answer
Do you have spring-expression in your Maven dependencies ?
If you are not using Maven, check your WEB-INF/lib folder.