Spring Java Config: Tomcat bereitstellen, ohne web.xml

Baute ich eine java konfiguriert Spring MVC Anwendung ohne XML. Ich kann bereitstellen und starten Sie die Anwendung auf meinem laptop ohne Probleme. Aber sobald ich versuche, für die Bereitstellung der Anwendung auf meinem testserver (tomcat 7), erhalte ich folgende Meldung:

HTTP Status 404 - The requested resource (/[application context]/) is not available.

Baue ich meine Anwendungen mit dem Eclipse-Maven-plugin. Ist es möglich, die Anwendung bereitstellen, ohne die web.xml und wenn nicht, welche ist die grundlegende web.xml brauche ich wirklich?

Maven-KRIEG-Plugin:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>${maven.war.plugin.version}</version>
    <configuration>
        <failOnMissingWebXml>false</failOnMissingWebXml>
    </configuration>
</plugin>

WebAppInitializer:

@Order(value = 1)
public class WebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {

    @Override
    public void onStartup(ServletContext servletContext) throws ServletException {
        super.onStartup(servletContext);
    }

    @Override
    protected Class<?>[] getRootConfigClasses() {
        return new Class[] { HibernateConfig.class, SecurityConfig.class, HibernateDaoConfig.class };
    }

    @Override
    protected Class<?>[] getServletConfigClasses() {
        return new Class[] { WebAppConfig.class };
    }

    @Override
    protected String[] getServletMappings() {
        return new String[] { "/" };
    }

    @Override
    protected Filter[] getServletFilters() {
        return new Filter[]{};
    }
}

Update: catalina.aus

Feb 3, 2014 4:18:32 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/[appname]] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak.
Feb 3, 2014 4:18:33 PM org.apache.catalina.startup.HostConfig checkResources
INFO: Undeploying context [/[appname]]
Feb 3, 2014 4:18:45 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive [appname].war
Was sind Ihre startup-logs zeigen?
Nur "INFO: Deploying web application archive [appname].Krieg" in catalina.aus
Ändern Frühling logging auf DEBUG und schauen.
Bitte prüfen, update:, Aber ich bekomme immer noch nicht mehr Informationen.
Tomcat6 nicht unterstützt Java-config. Sie benötigen eine aktuelle version von Tomcat 7 zu unterstützen. Frühe Versionen von Tomcat 7 hatte Probleme mit Java-config.

InformationsquelleAutor Tunguska | 2014-02-03

Schreibe einen Kommentar