Spring Boot Standalone -> Whiteout

brunothg

Aktives Mitglied
Ich hoffe hier kann mir jemand helfen. Ich such jetzt schon seit Tagen nach einer Lösung.

Ich habe eine einfache SpringBoot Web MVC Applikation. Packe ich alles als war, SUPER es geht. Aber als eine der Standalone Jars meldet maven noch keinen Fehler, aber beim Aufruf im Browser nichts. Nicht einmal diese Default error Seite.
Im Log wird der Controller zwar aufgerufen, aber ein nicht weiter spezifizierter 404 Error angezeigt.
Und von Zeit zu Zeit macht der Jersey-Starter Probleme mit doppelten Mappingversuchen. Dazu finde ich zwar genügend Gründe, aber keine Lösungen. Der WebInitializer von Jersey und der von Spring liefern sich dort wohl ein Wettrennen.

Versucht habe ich bereits sämtliche Einstellungen für die war Erstellung wieder rückgängig zu machen (zumindest so weit ich das sagen kann), die Ordnerstruktur für den WebContent auf den Standard (webapp) geändert. Alles ohne Wirkung (Außer dass mit war dan auch Fehler auftreten).

Application.class
Java:
@SpringBootApplication
public class Application extends SpringBootServletInitializer {

    public static void main(String[] args) throws Exception {
        SpringApplication.run(Application.class, args);
    }

    /**
     * Wird genutzt um ein Deployment auf einem ApplicationServer zu ermöglichen
     */
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(Application.class);
    }

}

pom.xml
HTML:
<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.3.1.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <warSourceDirectory>WebContent</warSourceDirectory>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <configuration>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
                <configuration>
                    <additionalConfig>
                        <file>
                            <name>.settings/org.eclipse.core.resources.prefs</name>
                            <content>
                <![CDATA[eclipse.preferences.version=1${line.separator}encoding/<project>=${project.build.sourceEncoding}${line.separator}]]>
                            </content>
                        </file>
                    </additionalConfig>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>2.8</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.10.3</version>
                <configuration>
                    <charset>${project.build.sourceEncoding}</charset>
                    <docencoding>${project.build.sourceEncoding}</docencoding>
                    <show>private</show>
                    <failOnError>false</failOnError>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-report-plugin</artifactId>
                <version>2.19</version>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <version>2.7</version>
            </plugin>
        </plugins>
    </reporting>

    <dependencies>
        <!-- Spring Boot -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>logback-classic</artifactId>
                    <groupId>ch.qos.logback</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <!-- JAX-RS Jersey -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jersey</artifactId>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.media</groupId>
            <artifactId>jersey-media-multipart</artifactId>
            <version>2.22.1</version>
        </dependency>
        <!-- Testing -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
        </dependency>
        <!-- Logging -->
        <dependency>
            <!-- Connector for SpringBoot -->
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j-impl</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-web</artifactId>
            <version>2.4</version>
        </dependency>
        <!-- Persistenz -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>eclipselink</artifactId>
            <version>2.6.1-RC1</version>
        </dependency>
        <!-- JavaEE -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.2</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
        </dependency>
        <dependency>
            <groupId>de.web</groupId>
            <artifactId>PagEE</artifactId>
            <version>0.0.4</version>
        </dependency>
        <!-- JSON Support -->
        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
        </dependency>
        <!-- LDAP -->
        <dependency>
            <groupId>org.apache.directory.api</groupId>
            <artifactId>api-all</artifactId>
            <version>1.0.0-M32</version>
        </dependency>
        <!-- Utils -->
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.4</version>
        </dependency>
    </dependencies>

LOG
Code:
 :: Spring Boot ::        (v1.3.1.RELEASE)

22:46:20.827 [main] INFO  de.fh.azubi.app.Application - Starting Application on **** with PID 6544 (started by **** in D:\Dateien\Workspaces\JavaEE\fh WebApp 2.0)
22:46:20.829 [main] DEBUG de.fh.azubi.app.Application - Running with Spring Boot v1.3.1.RELEASE, Spring v4.2.4.RELEASE
22:46:20.829 [main] INFO  de.fh.azubi.app.Application - No active profile set, falling back to default profiles: default
22:46:21.235 [main] INFO  org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext - Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@70f36812: startup date [Mon Dec 28 22:46:21 CET 2015]; root of context hierarchy
22:46:21.705 [pool-2-thread-1] INFO  org.hibernate.validator.internal.util.Version - HV000001: Hibernate Validator 5.2.2.Final
22:46:23.295 [main] INFO  org.springframework.beans.factory.support.DefaultListableBeanFactory - Overriding bean definition for bean 'requestContextFilter' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration; factoryMethodName=requestContextFilter; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/jersey/JerseyAutoConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter; factoryMethodName=requestContextFilter; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]]
22:46:23.296 [main] INFO  org.springframework.beans.factory.support.DefaultListableBeanFactory - Overriding bean definition for bean 'beanNameViewResolver' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]]
22:46:23.747 [main] INFO  org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
22:46:24.891 [main] INFO  org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer - Tomcat initialized with port(s): 8080 (http)
22:46:24.923 [main] INFO  org.apache.catalina.core.StandardService - Starting service Tomcat
22:46:24.925 [main] INFO  org.apache.catalina.core.StandardEngine - Starting Servlet Engine: Apache Tomcat/7.0.59
22:46:25.423 [localhost-startStop-1] INFO  org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext
22:46:25.423 [localhost-startStop-1] INFO  org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 4198 ms
22:46:25.530 [localhost-startStop-1] INFO  de.fh.azubi.app.service.ServiceConfiguration - Register services ...
22:46:25.534 [localhost-startStop-1] DEBUG de.fh.azubi.app.service.ServiceConfiguration - DynamicService -> de.fh.azubi.app.service.LoginService
22:46:25.562 [localhost-startStop-1] DEBUG de.fh.azubi.app.service.ServiceConfiguration - DynamicService -> de.fh.azubi.app.service.LogoutService
22:46:25.562 [localhost-startStop-1] DEBUG de.fh.azubi.app.service.ServiceConfiguration - DynamicService -> de.fh.azubi.app.service.UserService
22:46:25.562 [localhost-startStop-1] DEBUG de.fh.azubi.app.service.ServiceConfiguration - DynamicService -> de.fh.azubi.app.service.ProfileService
22:46:25.563 [localhost-startStop-1] DEBUG de.fh.azubi.app.service.ServiceConfiguration - DynamicService -> de.fh.azubi.app.service.NewsService
22:46:25.563 [localhost-startStop-1] DEBUG de.fh.azubi.app.service.ServiceConfiguration - DynamicService -> de.fh.azubi.app.service.RoleService
22:46:25.564 [localhost-startStop-1] DEBUG de.fh.azubi.app.service.ServiceConfiguration - DynamicService -> de.fh.azubi.app.service.IdentityService
22:46:25.564 [localhost-startStop-1] DEBUG de.fh.azubi.app.service.ServiceConfiguration - DynamicService -> de.fh.azubi.app.service.EducationModulService
22:46:25.564 [localhost-startStop-1] DEBUG de.fh.azubi.app.service.ServiceConfiguration - DynamicService -> de.fh.azubi.app.service.TimeTableService
22:46:25.567 [localhost-startStop-1] DEBUG de.fh.azubi.app.service.ServiceConfiguration - DynamicService -> org.glassfish.jersey.media.multipart.MultiPartFeature
22:46:25.571 [localhost-startStop-1] INFO  de.fh.azubi.app.service.ServiceConfiguration - ... Services registered
22:46:26.191 [localhost-startStop-1] INFO  org.springframework.boot.context.embedded.ServletRegistrationBean - Mapping servlet: 'jerseyServlet' to [/service/*]
22:46:26.193 [localhost-startStop-1] INFO  org.springframework.boot.context.embedded.ServletRegistrationBean - Mapping servlet: 'dispatcherServlet' to [/]
22:46:26.196 [localhost-startStop-1] INFO  org.springframework.boot.context.embedded.FilterRegistrationBean - Mapping filter: 'characterEncodingFilter' to: [/*]
22:46:26.197 [localhost-startStop-1] INFO  org.springframework.boot.context.embedded.FilterRegistrationBean - Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
22:46:26.197 [localhost-startStop-1] INFO  org.springframework.boot.context.embedded.FilterRegistrationBean - Mapping filter: 'httpPutFormContentFilter' to: [/*]
22:46:26.197 [localhost-startStop-1] INFO  org.springframework.boot.context.embedded.FilterRegistrationBean - Mapping filter: 'requestContextFilter' to: [/*]
22:46:27.409 [main] DEBUG de.fh.azubi.app.dao.file.LocalFileSystem - Using Root Folder -> D:\Dateien\Workspaces\JavaEE\fh WebApp 2.0\.\files\AzubiApp-2_0
22:46:27.605 [main] DEBUG de.fh.azubi.app.util.AutowireHelper - New AutowireHelper
22:46:27.606 [main] DEBUG de.fh.azubi.app.util.AutowireHelper - New AutowireHelper
22:46:27.609 [main] DEBUG de.fh.azubi.app.util.AutowireHelper - New ApplicationContext 'org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@70f36812: startup date [Mon Dec 28 22:46:21 CET 2015]; root of context hierarchy'
22:46:28.139 [main] INFO  org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter - Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@70f36812: startup date [Mon Dec 28 22:46:21 CET 2015]; root of context hierarchy
22:46:28.285 [main] INFO  org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/educationmodulmanagement]}" onto public org.springframework.web.servlet.ModelAndView de.fh.azubi.app.web.controller.admin.EducationModulManagementController.getEducationModulManagement(javax.servlet.http.HttpServletRequest) throws de.fh.azubi.app.logic.exception.PermissionException
22:46:28.288 [main] INFO  org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/timetablemanagement]}" onto public org.springframework.web.servlet.ModelAndView de.fh.azubi.app.web.controller.admin.TimetableManagementController.getTimetableManagement(javax.servlet.http.HttpServletRequest) throws de.fh.azubi.app.logic.exception.PermissionException
22:46:28.289 [main] INFO  org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/usermanagement]}" onto public org.springframework.web.servlet.ModelAndView de.fh.azubi.app.web.controller.admin.UserManagementController.getUsermanagement(javax.servlet.http.HttpServletRequest) throws de.fh.azubi.app.logic.exception.PermissionException
22:46:28.290 [main] INFO  org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/competence]}" onto public org.springframework.web.servlet.ModelAndView de.fh.azubi.app.web.controller.CompetenceController.getOwnCompetences(javax.servlet.http.HttpServletRequest)
22:46:28.291 [main] INFO  org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/educationmodulprofile]}" onto public org.springframework.web.servlet.ModelAndView de.fh.azubi.app.web.controller.EducationModulProfileController.doAny(javax.servlet.http.HttpServletRequest)
22:46:28.292 [main] INFO  org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/error]}" onto public org.springframework.web.servlet.ModelAndView de.fh.azubi.app.web.controller.ErrorController.processError(javax.servlet.http.HttpServletRequest)
22:46:28.293 [main] INFO  org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/logout]}" onto public void de.fh.azubi.app.web.controller.LogoutController.logout(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws java.io.IOException
22:46:28.295 [main] INFO  org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/]}" onto public org.springframework.web.servlet.ModelAndView de.fh.azubi.app.web.controller.MainController.main(javax.servlet.http.HttpServletRequest)
22:46:28.296 [main] INFO  org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/profile]}" onto public org.springframework.web.servlet.ModelAndView de.fh.azubi.app.web.controller.ProfileController.getOwnProfile(javax.servlet.http.HttpServletRequest) throws de.fh.azubi.app.logic.exception.UserNotFoundException
22:46:28.297 [main] INFO  org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/profile/{user}]}" onto public org.springframework.web.servlet.ModelAndView de.fh.azubi.app.web.controller.ProfileController.getOtherProfile(java.lang.String,javax.servlet.http.HttpServletRequest) throws de.fh.azubi.app.logic.exception.UserNotFoundException
22:46:28.298 [main] INFO  org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/timetable]}" onto public org.springframework.web.servlet.ModelAndView de.fh.azubi.app.web.controller.TimeTableController.getOwnTimetable(javax.servlet.http.HttpServletRequest)
22:46:28.380 [main] INFO  org.springframework.web.servlet.handler.SimpleUrlHandlerMapping - Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
22:46:28.381 [main] INFO  org.springframework.web.servlet.handler.SimpleUrlHandlerMapping - Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
22:46:28.463 [main] INFO  org.springframework.web.servlet.handler.SimpleUrlHandlerMapping - Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
22:46:28.761 [main] INFO  org.springframework.jmx.export.annotation.AnnotationMBeanExporter - Registering beans for JMX exposure on startup
22:46:28.811 [main] INFO  org.apache.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-8080"]
22:46:28.845 [main] INFO  org.apache.coyote.http11.Http11NioProtocol - Starting ProtocolHandler ["http-nio-8080"]
22:46:28.877 [main] INFO  org.apache.tomcat.util.net.NioSelectorPool - Using a shared selector for servlet write/read
22:46:28.923 [main] INFO  org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer - Tomcat started on port(s): 8080 (http)
22:46:28.936 [main] INFO  de.fh.azubi.app.Application - Started Application in 8.745 seconds (JVM running for 26.505)
22:48:45.642 [http-nio-8080-exec-1] INFO  org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/] - Initializing Spring FrameworkServlet 'dispatcherServlet'
22:48:45.643 [http-nio-8080-exec-1] INFO  org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'dispatcherServlet': initialization started
22:48:45.668 [http-nio-8080-exec-1] INFO  org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'dispatcherServlet': initialization completed in 25 ms
22:48:45.736 [http-nio-8080-exec-1] DEBUG de.fh.azubi.app.web.controller.MainController - ROOT request - want to get main page
22:48:45.797 [http-nio-8080-exec-1] INFO  de.fh.azubi.app.web.controller.MainController - ROOT request - illegal request - no login
22:48:45.857 [http-nio-8080-exec-1] ERROR de.fh.azubi.app.web.controller.ErrorController - Requesting error page -> RequestError [throwable=null, exceptionType=null, errorMessage=, statusCode=404, servletName=dispatcherServlet, requestUri=/]

Ordnerstruktur
Code:
|-src
|--- main
|----- java
|----- resources
|--- test
|----- java
|----- resources
|-WebContent
|--- WEB-INF
|--- META-INF
 
Ok ein kleinen Schritt weiter bin ich doch noch gekommen.
Offensichtlich sorgt SpringBoot zwar für einen Tomcat, aber nicht für einen JspContainer.

HTML:
<dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
            <scope>provided</scope>
        </dependency>

Das löst zumindest die leeren Seiten.
Jersey macht weiterhin sein eigenes Ding.
 

Zurück
Oben