jetty - noSuchMethodError
I get the following error when running mvn jetty:run-war
:
2009-11-14 15:19:28.459:/:INFO: Initializing Spring root WebApplicationContext
* ERROR 15:19:28,491 Context initialization failed (ContextLoader.java [main])
java.lang.NoSuchMethodError: org.springframework.util.ReflectionUtils.makeAccessible(Ljava/lang/reflect/Constructor;)V
...
(Not including the whole stacktrace)
I know that there is no开发者_如何学运维thing wrong with the code as it works perfectly fine both in Windows and OSX. Right now Im using Ubuntu karmic koala and installed maven through apt-get, could there be something that I have forgotten to configure in linux to make it work? I dont get any errors when doing mvn clean install.
Anyone?
There must be a compatibility mismatch somewhere. Maybe your local repository contains a "stale" version of some jar. I'd suggest to retry with a fresh and clean local repository.
First, make a backup copy:
mv ~/.m2/repository ~/.m2/repository.save
Then, try again.
I think the issue is with local repository. I guess your maven repo would have stored like root/.m2/repository Old jar may be the issue
I guess you have written Jetty depandencies like below
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.version}</version>
<configuration>
<webAppSourceDirectory>WebContent</webAppSourceDirectory>
<!-- <classesDirectory>WebContent/WEB-INF/classes</classesDirectory> -->
<!-- Redeploy every 1 seconds if changes are detected, 0 for no automatic
redeployment -->
<scanIntervalSeconds>0</scanIntervalSeconds>
<!-- reload manually by hitting enter on console -->
<reload>manual</reload>
<webApp>
<contextPath>/</contextPath>
<descriptor>WebContent/WEB-INF/web.xml</descriptor>
</webApp>
<connectors>
<connector implementation="org.eclipse.jetty.server.bio.SocketConnector">
<port>8080</port>
<maxIdleTime>600000</maxIdleTime>
</connector>
</connectors>
</configuration>
</plugin>
Check if the the "mvn install" is a Sucess then run Jetty.
精彩评论