0

我正在尝试制作一个 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
4

0 回答 0