Spring error creating bean xStreamMarshaller
I have a problem with starting my Application.
When I start mvn jetty:run I get the following exception:
2013-08-21 12:14:59.977:WARN:oejw.WebAppContext:Failed startup of context
o.m.j.p.JettyWebAppContext{/,file:/Users/markus/Documents/workspace/shadowrunV3_gui/src/main/webapp/},file:/Users/markus/Documents/workspace/shadowrunV3_gui/src/main/webapp/
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'restTemplate' defined in ServletContext resource
[/WEB-INF/applicationContext.xml]: Cannot create inner bean
'org.springframework.http.converter.xml.MarshallingHttpMessageConverter#3744cc2c'
of type
[org.springframework.http.converter.xml.MarshallingHttpMessageConverter]
while setting bean property 'messageConverters' with key [0]; nested
exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name
'org.springframework.http.converter.xml.MarshallingHttpMessageConverter#3744cc2c'
defined in ServletContext resource [/WEB-INF/applicationContext.xml]:
Cannot resolve reference to bean 'xStreamMarshaller' while setting
constructor argument; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'xStreamMarshaller' defined in ServletContext resource
[/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested
exception is org.springframework.beans.TypeMismatchException: Failed to
convert property value of type 'java.util.ArrayList' to required type
'java.lang.Class[]' for property 'annotatedClasses'; nested exception is
java.lang.IllegalArgumentException: Cannot find class
[at.itn.shadowrun.domain.DChars]
my applicationContext.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jndi="http://www.springframework.org/schema/jndi"
xmlns:util="http://www.springframework.org/schema/util"
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.2.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/jndi
http://www.springframework.org/schema/jndi/spring-jndi-3.2.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.2.xsd">
<bean id="restTemplate" class="org.springframework.web.client.RestTemplate">
<property name="messageConverters">
<list>
<bean
class="org.springframework.http.converter.xml.MarshallingHttpMessageConverter">
<constructor-arg>
<ref bean="xStreamMarshaller" />
</constructor-arg>
</bean>
</list>
</property>
</bean>
<bean id="xStreamMarshaller"
class="org.springframework.oxm.xstream.XStreamMarshaller">
<property name="annotatedClasses">
<list>
<value>at.itn.shadowrun.domain.DChars</value>
<!-- other classes (the package is correct) -->
</list>
</property>
</bean>
<!-- from an old configuration, from my understanding I dont need this
part anymore, but since I'm not sure here it is: -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="annotatedClasses">
<list>
<value>
at.itn.shadowrun.domain.DChars
</value>
<!-- other classes -->
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
${hibernate.dialect}
</prop>
</props>
</property>
</bean>
my DChars class:
package at.itn.shadowrun.domain;
@Entity
@Table(name = "D_CHARS")
@XStreamAlias("D_CHARS")
public class DChars implements DomainObject {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
// etc..
and just to make sure I didnt do something wrong in the pom, here's the
spring relevant pom:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.beans</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
My Spring version is: 3.2.3.RELEASE
From my understanding the Class at.itn.shadowrun.domain.DChars cannot be
found, but I dont understand why. It's definately in the correct package!
Any help would be much appreciated! Thank You!
No comments:
Post a Comment