eclipse - Can't start war application on tomcat running on Linux server -


i can't start application on tomcat 7. i've deployed on tomcat , doesn't work (on linux server) can run eclipse on windows. here error:

jul 12, 2015 2:48:16 pm org.apache.catalina.core.containerbase addchildinternal severe: containerbase.addchild: start:  org.apache.catalina.lifecycleexception: failed start component [standardengine[catalina].standardhost[localhost].standardcontext[]]     @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:154)     @ org.apache.catalina.core.containerbase.addchildinternal(containerbase.java:901)     @ org.apache.catalina.core.containerbase.addchild(containerbase.java:877)     @ org.apache.catalina.core.standardhost.addchild(standardhost.java:649)     @ org.apache.catalina.startup.hostconfig.deploydescriptor(hostconfig.java:672)     @ org.apache.catalina.startup.hostconfig$deploydescriptor.run(hostconfig.java:1862)     @ java.util.concurrent.executors$runnableadapter.call(executors.java:471)     @ java.util.concurrent.futuretask.run(futuretask.java:262)     @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145)     @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615)     @ java.lang.thread.run(thread.java:745) caused by: java.lang.nullpointerexception     @ cz.prosvaly.configuration.appinitializer.onstartup(appinitializer.java:39)     @ org.springframework.web.springservletcontainerinitializer.onstartup(springservletcontainerinitializer.java:175)     @ org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5479)     @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150)     ... 10 more  jul 12, 2015 2:48:16 pm org.apache.catalina.startup.hostconfig deploydescriptor severe: error deploying configuration descriptor /etc/tomcat7/catalina/localhost/root.xml java.lang.illegalstateexception: containerbase.addchild: start: org.apache.catalina.lifecycleexception: failed start component [standardengine[catalina].standardhost[localhost].standardcontext[]]     @ org.apache.catalina.core.containerbase.addchildinternal(containerbase.java:904)     @ org.apache.catalina.core.containerbase.addchild(containerbase.java:877)     @ org.apache.catalina.core.standardhost.addchild(standardhost.java:649)     @ org.apache.catalina.startup.hostconfig.deploydescriptor(hostconfig.java:672)     @ org.apache.catalina.startup.hostconfig$deploydescriptor.run(hostconfig.java:1862)     @ java.util.concurrent.executors$runnableadapter.call(executors.java:471)     @ java.util.concurrent.futuretask.run(futuretask.java:262)     @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145)     @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615)     @ java.lang.thread.run(thread.java:745) 

here appinitializer

    package cz.prosvaly.configuration;  import javax.servlet.filterregistration; import javax.servlet.servletcontext; import javax.servlet.servletexception; import javax.servlet.servletregistration;  import org.springframework.web.webapplicationinitializer; import org.springframework.web.context.contextloaderlistener; import org.springframework.web.context.support.annotationconfigwebapplicationcontext; import org.springframework.web.filter.characterencodingfilter; import org.springframework.web.filter.delegatingfilterproxy; import org.springframework.web.servlet.dispatcherservlet;  public class appinitializer implements webapplicationinitializer {      public void onstartup(servletcontext container) throws servletexception {          annotationconfigwebapplicationcontext ctx = new annotationconfigwebapplicationcontext();         ctx.register(appconfig.class);         ctx.setservletcontext(container);          container.addlistener(new contextloaderlistener(ctx));          servletregistration.dynamic servlet = container.addservlet(                 "dispatcher", new dispatcherservlet(ctx));          servlet.setloadonstartup(1);         servlet.addmapping("/");          filterregistration.dynamic fr = container.addfilter("encodingfilter",                 new characterencodingfilter());         fr.setinitparameter("encoding", "utf-8");         fr.setinitparameter("forceencoding", "true");         fr.addmappingforurlpatterns(null, true, "/*");          filterregistration.dynamic filter = container.addfilter("springsecurityfilterchain",                 new delegatingfilterproxy());         filter.addmappingforurlpatterns(null, true, "/*");       }  } 

the error on row:

filter.addmappingforurlpatterns(null, true, "/*"); 

my pom

<?xml version="1.0"?> <project     xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"     xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance">      <modelversion>4.0.0</modelversion>     <groupid>cz.prosvaly</groupid>     <artifactid>prosvaly</artifactid>     <packaging>war</packaging>     <version>1.0.0</version>     <name>prosvaly.cz</name>      <properties>         <springframework.version>4.1.6.release</springframework.version>         <org.springframework.security.version>4.0.1.release</org.springframework.security.version>         <hibernate.version>4.3.6.final</hibernate.version>         <mysql.version>5.1.31</mysql.version>         <joda-time.version>2.3</joda-time.version>     </properties>      <dependencies>         <dependency>             <groupid>org.slf4j</groupid>             <artifactid>slf4j-api</artifactid>             <version>1.7.7</version>         </dependency>          <dependency>             <groupid>org.slf4j</groupid>             <artifactid>jul-to-slf4j</artifactid>             <version>1.7.7</version>         </dependency>          <dependency>             <groupid>org.slf4j</groupid>             <artifactid>jcl-over-slf4j</artifactid>             <version>1.7.7</version>         </dependency>          <dependency>             <groupid>org.slf4j</groupid>             <artifactid>log4j-over-slf4j</artifactid>             <version>1.7.7</version>         </dependency>          <dependency>             <groupid>org.slf4j</groupid>             <artifactid>slf4j-jdk14</artifactid>             <version>1.7.7</version>         </dependency>          <!-- spring security -->         <dependency>             <groupid>org.springframework.security</groupid>             <artifactid>spring-security-web</artifactid>             <version>${org.springframework.security.version}</version>         </dependency>          <dependency>             <groupid>org.springframework.security</groupid>             <artifactid>spring-security-config</artifactid>             <version>${org.springframework.security.version}</version>         </dependency>         <dependency>             <groupid>org.apache.pdfbox</groupid>             <artifactid>pdfbox</artifactid>             <version>1.8.6</version>         </dependency>         <dependency>             <groupid>ch.qos.logback</groupid>             <artifactid>logback-classic</artifactid>             <version>1.0.13</version>         </dependency>         <dependency>             <groupid>net.coobird</groupid>             <artifactid>thumbnailator</artifactid>             <version>0.4.7</version>         </dependency>         <dependency>             <groupid>javax.mail</groupid>             <artifactid>mail</artifactid>             <version>1.5.0-b01</version>         </dependency>          <!-- spring -->         <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-core</artifactid>             <version>${springframework.version}</version>         </dependency>         <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-web</artifactid>             <version>${springframework.version}</version>         </dependency>         <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-webmvc</artifactid>             <version>${springframework.version}</version>         </dependency>         <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-tx</artifactid>             <version>${springframework.version}</version>         </dependency>         <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-orm</artifactid>             <version>${springframework.version}</version>         </dependency>          <!-- hibernate -->         <dependency>             <groupid>org.hibernate</groupid>             <artifactid>hibernate-core</artifactid>             <version>${hibernate.version}</version>         </dependency>          <!-- jsr303 validation -->         <dependency>             <groupid>javax.validation</groupid>             <artifactid>validation-api</artifactid>             <version>1.1.0.final</version>         </dependency>         <dependency>             <groupid>org.hibernate</groupid>             <artifactid>hibernate-validator</artifactid>             <version>5.1.2.final</version>         </dependency>          <!-- mysql -->         <dependency>             <groupid>mysql</groupid>             <artifactid>mysql-connector-java</artifactid>             <version>${mysql.version}</version>         </dependency>          <!-- joda-time -->         <dependency>             <groupid>joda-time</groupid>             <artifactid>joda-time</artifactid>             <version>${joda-time.version}</version>         </dependency>          <!-- map jodatime database type -->         <dependency>             <groupid>org.jadira.usertype</groupid>             <artifactid>usertype.core</artifactid>             <version>3.0.0.cr1</version>         </dependency>          <!-- servlet+jsp+jstl -->         <dependency>             <groupid>javax.servlet</groupid>             <artifactid>javax.servlet-api</artifactid>             <version>3.1.0</version>         </dependency>         <dependency>             <groupid>javax.servlet.jsp</groupid>             <artifactid>javax.servlet.jsp-api</artifactid>             <version>2.3.1</version>         </dependency>         <dependency>             <groupid>javax.servlet</groupid>             <artifactid>jstl</artifactid>             <version>1.2</version>         </dependency>         <!-- apache commons upload -->         <dependency>             <groupid>commons-fileupload</groupid>             <artifactid>commons-fileupload</artifactid>             <version>1.3.1</version>         </dependency>     </dependencies>      <build>         <pluginmanagement>             <plugins>                 <plugin>                     <groupid>org.apache.maven.plugins</groupid>                     <artifactid>maven-war-plugin</artifactid>                     <version>2.4</version>                     <configuration>                         <warsourcedirectory>src/main/webapp</warsourcedirectory>                         <warname>prosvaly</warname>                         <failonmissingwebxml>false</failonmissingwebxml>                     </configuration>                 </plugin>                 <plugin>                     <groupid>org.apache.maven.plugins</groupid>                     <artifactid>maven-compiler-plugin</artifactid>                     <version>3.1</version>                     <configuration>                         <source>1.7</source>                         <target>1.7</target>                     </configuration>                 </plugin>             </plugins>         </pluginmanagement>         <finalname>prosvaly</finalname>     </build> </project>  @configuration     @enablewebmvc     @import({ securityconfig.class })     @componentscan(basepackages = "cz.prosvaly")     public class appconfig {          @bean         public viewresolver viewresolver() {             internalresourceviewresolver viewresolver = new internalresourceviewresolver();             viewresolver.setviewclass(jstlview.class);             viewresolver.setprefix("/web-inf/views/");             viewresolver.setsuffix(".jsp");              return viewresolver;         }          @bean         public messagesource messagesource() {             resourcebundlemessagesource messagesource = new resourcebundlemessagesource();             messagesource.setbasename("messages");             return messagesource;         }          @bean(name="multipartresolver")         public commonsmultipartresolver multipartresolver(){             commonsmultipartresolver multipartresolver = new commonsmultipartresolver();             multipartresolver.setmaxuploadsize(10000000);             return multipartresolver;         }        } 

dispatcher config:

@configuration public class dispatcherconfig extends webmvcconfigureradapter {      @override     public void addresourcehandlers(resourcehandlerregistry registry) {         registry.addresourcehandler("/resources/**").addresourcelocations("/resources/"); //        registry.addresourcehandler("/css/**").addresourcelocations("/resources/css/"); //        registry.addresourcehandler("/html/**").addresourcelocations("/html/"); //        registry.addresourcehandler("/images/**").addresourcelocations("/images/");            } } 

spring security

@configuration @enablewebsecurity public class securityconfig extends websecurityconfigureradapter {      @autowired     datasource datasource;      @autowired     public void configureglobal(authenticationmanagerbuilder auth) throws exception {       auth.jdbcauthentication().datasource(datasource).       usersbyusernamequery("select username,password, enabled admin username=?").       authoritiesbyusernamequery("select username, role user_roles username =?  ")       .passwordencoder(new md5passwordencoder());     }      @override     protected void configure(httpsecurity http) throws exception {        http.authorizerequests()        .antmatchers("/admin/**").access("hasrole('role_admin')")        .and().formlogin()        .loginpage("/login").defaultsuccessurl("/admin/goods").failureurl("/login?error")             .usernameparameter("username").passwordparameter("password")                .and().logout().logouturl("/logout").logoutsuccessurl("/login?logout")        .and().csrf();      }  } 

could me please?

can post contents of spring security initializer (along annotations on class)? wasn't able reproduce error given configuration.

furthermore, looking @ config, few suggestions:

  1. tomcat 7 doesn't support servlet-api 3.1 , servlet-jsp 2.3. trying tomcat 8 might find luck.
  2. if decide stay tomcat 7, make sure use appropriate api versions of above jars in pom , mark servlet-api jar provided provided servlet container (specs tomcat versions).
  3. make sure haven't used changesessionid in session fixation configuration (if any); introduced in servelt-api 3.1.

you want take @ /etc/tomcat7/catalina/localhost/root.xml if there wrong (in case). eclipse uses own configuration metadata server runtime , copies server's configuration while defining new server.

update:

also, please annotate security initializer @order(1), remove @configuration there provided @enablewebsecurity , try. , 1 more thing, replace filter registration line , add filter directly container.addfilter("springsecurityfilterchain", new delegatingfilterproxy()).addmappingforurlpatterns(null, true, "/*"); remove @import line ur appconfig.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -