我正在尝试制作一个webapp,但我遇到了一个问题。
首先,我在Jetty中运行了这个webapp,一切都很完美。现在,当我切换到Apache tomcat 7时,我遇到了错误。
我收到的错误是
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.NullPointerExceptionorg.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:681)org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:585)javax.servlet.http.HttpServlet.service(HttpServlet.java:647)javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
根本原因是
java.lang.NullPointerExceptionorg.eclipse.aether.examples.util.Booter.newRepositorySystemSession(Booter.java:41)
所以我去那个地方,显然我发现它是空的。
所以我想知道Tomcat正在做什么让它成为一个没有码头的空?
这是返回null的填充
public class ManualRepositorySystemFactory
{
public static RepositorySystem newRepositorySystem()
{
/*
* Aether's components implement org.eclipse.aether.spi.locator.Service to ease manual wiring and using the
* prepopulated DefaultServiceLocator, we only need to register the repository connector factories.
*/
DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
locator.addService( RepositoryConnectorFactory.class, FileRepositoryConnectorFactory.class );
locator.addService( RepositoryConnectorFactory.class, WagonRepositoryConnectorFactory.class );
locator.setServices( WagonProvider.class, new ManualWagonProvider() );
//THis is the line that is returning a null
return locator.getService( RepositorySystem.class );
}
}
修改
public class Booter
{
public static RepositorySystem newRepositorySystem()
{
return org.eclipse.aether.examples.manual.ManualRepositorySystemFactory.newRepositorySystem();
// return org.eclipse.aether.examples.guice.GuiceRepositorySystemFactory.newRepositorySystem();
// return org.eclipse.aether.examples.plexus.PlexusRepositorySystemFactory.newRepositorySystem();
}
public static DefaultRepositorySystemSession newRepositorySystemSession( RepositorySystem system )
{
DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
// LocalRepository localRepo = new LocalRepository( "target/local-repo" );
LocalRepository localRepo = new LocalRepository("target/local-repo/"); // For testing purposes dls to this directory, give an option later
///Users/Shared/dependencyBuilder/
session.setLocalRepositoryManager( system.newLocalRepositoryManager( session, localRepo ) ) // Line that gives me the error