- This topic has 10 replies, 4 voices, and was last updated 13 years, 5 months ago by support-swapna.
-
AuthorPosts
-
DavidMemberI hope this is the correct forum for this. I used MyEclipse 9.0 to create a Web Services project using Jersey. I added Spring, Hibernate, and Maven to the project. I tweaked the pom.xml slightly because it would seem MyEclipse was adding lots of dependencies I didn’t need. When I run the project as a Eclipse Server or Tomcat application I get the following exception:
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [applicationContext.xml]; nested exception is java.lang.NoSuchMethodError: org.springframework.beans.MutablePropertyValues.add(Ljava/lang/String;Ljava/lang/Object;)Lorg/springframework/beans/MutablePropertyValues;
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:420)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4701)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5204)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5199)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.NoSuchMethodError: org.springframework.beans.MutablePropertyValues.add(Ljava/lang/String;Ljava/lang/Object;)Lorg/springframework/beans/MutablePropertyValues;
at org.springframework.transaction.config.AnnotationDrivenBeanDefinitionParser.registerTransactionManager(AnnotationDrivenBeanDefinitionParser.java:95)
at org.springframework.transaction.config.AnnotationDrivenBeanDefinitionParser.access$0(AnnotationDrivenBeanDefinitionParser.java:94)
at org.springframework.transaction.config.AnnotationDrivenBeanDefinitionParser$AopAutoProxyConfigurer.configureAutoProxyCreator(AnnotationDrivenBeanDefinitionParser.java:121)
at org.springframework.transaction.config.AnnotationDrivenBeanDefinitionParser.parse(AnnotationDrivenBeanDefinitionParser.java:79)
at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:69)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1297)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1287)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)I looked around and it would appear this message is related to mixed up Spring versions – specifically pre-Spring3.0. However, I am explicitly declaring Spring 3.0.5RELEASE as shown in my 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/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>dental</groupId> <artifactId>dental</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>war</packaging> <name /> <description /> <properties> <spring.version>3.0.5.RELEASE</spring.version> <hibernate.version>3.2.6.ga</hibernate.version> <jersey-version>1.7</jersey-version> <base.path>${basedir}</base.path> </properties> <repositories> <repository> <id>maven2-repository.java.net</id> <name>Java.net Repository for Maven</name> <url>http://download.java.net/maven/2/</url> <layout>default</layout> </repository> <repository> <id>maven-repository.java.net</id> <name>Java.net Maven 1 Repository (legacy)</name> <url>http://download.java.net/maven/1</url> <layout>legacy</layout> </repository> <repository> <id>maven2-repository.dev.java.net</id> <name>Java.net Repository for Maven</name> <url>http://download.java.net/maven/2/</url> <layout>default</layout> </repository> <repository> <id>JBoss Repo</id> <url>http://repository.jboss.com/maven2</url> </repository> </repositories> <dependencies> <!-- PERSISTENCE DEPENDENCIES (HIBERNATE / HSQLDB) --> <!-- MySQL --> <dependency> <groupId>org.eclipse.persistence</groupId> <artifactId>javax.persistence</artifactId> <version>2.0.0</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.16</version> </dependency> <dependency> <groupId>javax.transaction</groupId> <artifactId>jta</artifactId> <version>1.1</version> </dependency> <dependency> <groupId>commons-dbcp</groupId> <artifactId>commons-dbcp</artifactId> <version>1.2.1</version> </dependency> <dependency> <groupId>commons-pool</groupId> <artifactId>commons-pool</artifactId> <version>1.5.3</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate</artifactId> <version>3.3.2</version> </dependency> <dependency> <groupId>net.sf.ehcache</groupId> <artifactId>ehcache</artifactId> <version>1.2.3</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-annotations</artifactId> <version>3.4.0.GA</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-commons-annotations</artifactId> <version>3.1.0.GA</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>3.4.0.GA</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> <version>3.1.0.GA</version> </dependency> <dependency> <groupId>c3p0</groupId> <artifactId>c3p0</artifactId> <version>0.9.1</version> </dependency> <!-- JERSEY --> <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-core</artifactId> <version>${jersey-version}</version> </dependency> <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-server</artifactId> <version>${jersey-version}</version> </dependency> <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-client</artifactId> <version>${jersey-version}</version> </dependency> <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-json</artifactId> <version>${jersey-version}</version> </dependency> <!-- SPRING FRAMEWORK DEPENDENCY --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</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-context</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-expression</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-jdbc</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-tx</artifactId> <version>${spring.version}</version> </dependency> <!-- COMMONS/UTITLIES --> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.1.1</version> </dependency> <dependency> <groupId>cglib</groupId> <artifactId>cglib-nodep</artifactId> <version>2.2</version> </dependency> <dependency> <groupId>cglib</groupId> <artifactId>cglib</artifactId> <version>2.2</version> </dependency> <dependency> <groupId>commons-collections</groupId> <artifactId>commons-collections</artifactId> <version>3.1</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.5.8</version> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.14</version> </dependency> </dependencies> <build> <sourceDirectory>${basedir}/src</sourceDirectory> <outputDirectory>${basedir}/webapp/WEB-INF/classes</outputDirectory> <resources> <resource> <directory>${basedir}/src</directory> <excludes> <exclude>**/*.java</exclude> </excludes> </resource> </resources> <plugins> <plugin> <artifactId>maven-war-plugin</artifactId> <configuration> <webappDirectory>${basedir}/webapp</webappDirectory> <warSourceDirectory>${basedir}/webapp</warSourceDirectory> </configuration> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> </plugins> </build> </project>
I would greatly appreciate any pointers or help you can send my way.
support-joyMembersonoerin,
Sorry to hear you are running into this issue. Could you try out the recommendations here – http://forum.springsource.org/showthread.php?62634-SEVERE-Exception-sending-context-initialized-event-to-listener-instance-of-class-org
Let me know how this works for you.
DavidMemberThank you Joy,
I am not explicitly declaring any AOP dependencies, but I see that spring-context use aopalliance. Are you suggesting that I exclude aop from this <dependency>?
DavidMemberAnother question – I read that thread and it says to just update the project spring version to 3. However, in my project properties It says Spring 3.0 and Hibernate 3.3. However, I am getting the error despite that. Could this be because my pom.xml declares:
<spring.version>3.0.5.RELEASE</spring.version>
<hibernate.version>3.2.6.ga</hibernate.version>Either way, I appear to have the correct spring and hibernate versions so I am a bit confused why this error is occuring.
David
Brian FernandesModeratorDavid,
1) Can you please paste your .classpath file here? If you look at the project in the project explorers view, do you have any containers other than the “Maven Dependencies” container? Possible that you already have some older Spring containers on your classpath?
2) Try removing the deployment and then deploy it again (as opposed to redeploy). Do you still see the problem? Go to the deployment location (you can browse the deployment location using the context menu in the Servers view) and actually examine the libraries deployed. Do you notice older spring libraries present?
DavidMember1) Here is my .classpath:
<?xml version=”1.0″ encoding=”UTF-8″?>
<classpath>
<classpathentry kind=”src” output=”webapp/WEB-INF/classes” path=”src”/>
<classpathentry kind=”src” path=”test”/>
<classpathentry exported=”true” kind=”con” path=”org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6″/>
<classpathentry exported=”true” kind=”con” path=”org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER”/>
<classpathentry kind=”con” path=”org.eclipse.jst.j2ee.internal.web.container”/>
<classpathentry kind=”con” path=”org.eclipse.jst.j2ee.internal.module.container”/>
<classpathentry kind=”lib” path=”webapp/WEB-INF/lib/mysql-connector-java-5.1.16.jar”/>
<classpathentry exported=”true” kind=”con” path=”org.eclipse.jdt.junit.JUNIT_CONTAINER/4″/>
<classpathentry kind=”output” path=”webapp/WEB-INF/classes”/>
</classpath>My project explorer shows the following containers:
-> Maven Dependencies
-> Web App Libraries (which contains the asm-3.1.jar
-> JRE System Library
-> Referenced Libraries (which contains mysql-connector-java jar)2) I removed the deployment and redeployed and still see the error on Tomcat startup. When I browse the deployment directory I see in the lib directory duplicate Spring jars – for example, spring-aop-2.5.6.SEC02.jar and spring-aop-3.0.5.RELEASE.jar. I see asm-3.1.jar and spring-asm-3.0.5.RELEASE.jar. Where are the non Spring 3.x versions coming from?
Thank you for your help.
David
DavidMemberI undeployed and redeployed. I see many duplicate jars in my deployed webapps lib directory :
- spring-aop-2.5.6.SEC02.jar - spring-aop-3.0.5.RELEASE.jar - asm-3.1.jar - spring-asm-3.0.5.RELEASE.jar
etc.
But now when i startup I get
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory’ defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.reflect.MalformedParameterizedTypeException
which according to this https://www.genuitec.com/forums/topic/8-6-flex-scaffold-spring-2-5-lib-conflict-amp-workaround/ seems to indicate more asm classpath conflicts. I am using Spring 3 and Hibenate 3 so I am not really sure which asm.xx file to remove from the project capabilities.[/list]
DavidMemberUpdate:
I found that if I redeploy and then manually delete:
- spring-aop-2.5.6.SEC02.jar
spring-beans-2.5.6.SEC02.jar
spring-context-2.5.6.SEC02.jar
spring-core-2.5.6.SEC02.jarthen restart Tomcat, I am able to run my application. However, a redeploy copies these jars back in. Unfortunately, I cannot find where these jars are being imported from. I checked the pom.xml, maven dependencies, and Eclipse properties and I don’t see them.
Brian FernandesModeratorDavid,
I am as perplexed as you. You are using MyEclipse and not MyEclipse for Spring, correct?
Perhaps you could remove all the dependencies in your pom.xml and add them back a few at a time to see which dependency is possibly pulling in the additional binaries? Your project will obviously not work during this time, but you can simply try deployment and examine the deployment location?
DavidMemberI think I found it – in my WEB-INF/lib were the 2.5 Spring jars. So I removed those and all appears to be well now. No idea how they got there, but thank you for your time and patience.
support-swapnaModeratorsonoerin,
Glad that it is working.
Do let us know if you have any other issues. -
AuthorPosts