2014-07-26 22 views
0

我有一个相当大的Java应用程序,它使用一些作业和大量的http和db活动。这个应用程序是使用maven构建的,具有相当多的依赖关系,并在tomcat 6上运行 - 好处是,它的工作原理。jsf(像servlet)的依赖关系阻止应用程序启动

不过,我现在想添加一些JSF的功能,也就是我希望能够手动启动,并从网站停止工作石英,所以我激活我的pom.xml两个依赖:

<!-- to get the servlet container --> 
    <dependency> 
     <groupId>javax.servlet</groupId> 
     <artifactId>javax.servlet-api</artifactId> 
     <version>3.1.0</version> 
    </dependency> 


    <!-- To work with java server faces --> 
    <dependency> 
     <groupId>com.sun.faces</groupId> 
     <artifactId>jsf-api</artifactId> 
     <version>2.2.7</version> 
    </dependency> 

这样做后,我的应用程序不再出现。它开始了,但我没有看到任何通常的调试信息,告诉我该应用程序实际上在做某些事情。它也不会崩溃。它似乎坐在那里,什么都不做。奇怪的是,java类使用这些依赖关系甚至没有开始。

谁能告诉我,JSF是什么?我必须做一些故障切换配置,或什么?

我将附加一个正常的启动日志和激活这两个依赖关系后的日志。

正常启动:

[INFO] Scanning for projects... 

[WARNING] 

[WARNING] Some problems were encountered while building the effective model for de.comlineag.snc:SocialNetworkConnector:war:0.2.5-SNAPSHOT 

[WARNING] 'dependencies.dependency.systemPath' for ngdbc:ngdbc:jar should use a variable instead of a hard-coded path /Applications/eclipse/plugins/ngdbc.jar @ line 281, column 16 

[WARNING] 

[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. 

[WARNING] 

[WARNING] For this reason, future Maven versions might no longer support building such malformed projects. 

[WARNING] 

[INFO]                   

[INFO] ------------------------------------------------------------------------ 

[INFO] Building Social Network Connector 0.2.5-SNAPSHOT 

[INFO] ------------------------------------------------------------------------ 

[INFO] 

[INFO] >>> tomcat-maven-plugin:1.1:run (default-cli) @ SocialNetworkConnector >>> 

[INFO] 

[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ SocialNetworkConnector --- 

[debug] execute contextualize 

[INFO] Using 'UTF-8' encoding to copy filtered resources. 

[INFO] skip non existing resourceDirectory 
/Users/chris/Developer/workspace/socialnetworkconnector/src/main/resources 

[INFO] 

[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ SocialNetworkConnector --- 

[INFO] Nothing to compile - all classes are up to date 

[INFO] 

[INFO] <<< tomcat-maven-plugin:1.1:run (default-cli) @ SocialNetworkConnector <<< 

[INFO] 

[INFO] --- tomcat-maven-plugin:1.1:run (default-cli) @ SocialNetworkConnector --- 

[INFO] Running war on http : // localhost : 8080/SocialNetworkConnector 

[INFO] Using existing Tomcat server configuration at /Users/chris/Developer/workspace/socialnetworkconnector/target/tomcat Jul 26, 2014 11:54:38 PM org.apache.catalina.startup.Embedded start 

INFO: Starting tomcat server Jul 26, 2014 11:54:38 PM org.apache.catalina.core.StandardEngine start 

INFO: Starting Servlet Engine: Apache Tomcat/6.0.29 Jul 26, 2014 11:54:38 PM org.apache.catalina.core.ApplicationContext log 

INFO: Set web app root system property: 'webapp.root' = [/Users/chris/Developer/workspace/socialnetworkconnector/src/main/webapp/] 
Jul 26, 2014 11:54:38 PM org.apache.catalina.core.ApplicationContext log 

INFO: Initializing log4j from [/Users/chris/Developer/workspace/socialnetworkconnector/src/main/webapp/WEB-INF/log4j.xml] 
Jul 26, 2014 11:54:38 PM org.apache.catalina.core.ApplicationContext log 

INFO: Initializing Spring root WebApplicationContext 

INFO ContextLoader - Root WebApplicationContext: initialization started 

INFO XmlWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Sat Jul 26 23:54:38 CEST 2014]; root of context hierarchy 

INFO XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml] 

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". 

SLF4J: Defaulting to no-operation (NOP) logger implementation 

SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. 

INFO DefaultLifecycleProcessor - Starting beans in phase 2147483647 

INFO SchedulerFactoryBean - Starting Quartz Scheduler now 

INFO ContextLoader - Root WebApplicationContext: initialization completed in 808 ms 

DEBUG GeneralConfiguration - using configuration file from job control src/main/webapp/WEB-INF/GeneralConfiguration.xml 
Jul 26, 2014 11:54:39 PM org.apache.coyote.http11.Http11Protocol init 

INFO: Initializing Coyote HTTP/1.1 on http-8080 
Jul 26, 2014 11:54:39 PM org.apache.coyote.http11.Http11Protocol start 

INFO: Starting Coyote HTTP/1.1 on http-8080 

DEBUG ComplexXmlConfigurationPersistence - the domain Banking is active true and has priority 0 

启动这里什么也没有发生:

[INFO] Scanning for projects... 

[WARNING] 

[WARNING] Some problems were encountered while building the effective model for de.comlineag.snc:SocialNetworkConnector:war:0.2.5-SNAPSHOT 

[WARNING] 'dependencies.dependency.systemPath' for ngdbc:ngdbc:jar should use a variable instead of a hard-coded path /Applications/eclipse/plugins/ngdbc.jar @ line 280, column 16 

[WARNING] 

[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. 

[WARNING] 

[WARNING] For this reason, future Maven versions might no longer support building such malformed projects. 

[WARNING] 

[INFO]                   

[INFO] ------------------------------------------------------------------------ 

[INFO] Building Social Network Connector 0.2.5-SNAPSHOT 

[INFO] ------------------------------------------------------------------------ 

[INFO] 

[INFO] >>> tomcat-maven-plugin:1.1:run (default-cli) @ SocialNetworkConnector >>> 

[INFO] 

[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ SocialNetworkConnector --- 

[debug] execute contextualize 

[INFO] Using 'UTF-8' encoding to copy filtered resources. 

[INFO] skip non existing resourceDirectory /Users/chris/Developer/workspace/socialnetworkconnector/src/main/resources 

[INFO] 

[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ SocialNetworkConnector --- 

[INFO] Nothing to compile - all classes are up to date 

[INFO] 

[INFO] <<< tomcat-maven-plugin:1.1:run (default-cli) @ SocialNetworkConnector <<< 

[INFO] 

[INFO] --- tomcat-maven-plugin:1.1:run (default-cli) @ SocialNetworkConnector --- 

[INFO] Running war on http : // localhost : 8080/SocialNetworkConnector 

[INFO] Using existing Tomcat server configuration at /Users/chris/Developer/workspace/socialnetworkconnector/target/tomcat 
Jul 26, 2014 11:46:58 PM org.apache.catalina.startup.Embedded start 

INFO: Starting tomcat server 
Jul 26, 2014 11:46:59 PM org.apache.catalina.core.StandardEngine start 
    INFO: Starting Servlet Engine: Apache Tomcat/6.0.29 
    Jul 26, 2014 11:46:59 PM org.apache.coyote.http11.Http11Protocol init 
    INFO: Initializing Coyote HTTP/1.1 on http-8080 
    Jul 26, 2014 11:46:59 PM org.apache.coyote.http11.Http11Protocol start 
    INFO: Starting Coyote HTTP/1.1 on http-8080 

回答

0

要包括该servlet API是最有可能与版本相冲突在Tomcat提供。使用这种依赖关系,而不是(与你的Tomcat的版本替换版本6.0.41):

<dependency> 
    <groupId>org.apache.tomcat</groupId> 
    <artifactId>servlet-api</artifactId> 
    <version>6.0.41</version> 
    <scope>provided</scope> 
</dependency> 

通知范围设置为提供。这意味着该jar将用于编译您的代码,但不会包含在您的WAR文件中。这是你想要的,因为tomcat会在运行时从lib目录提供你需要的servlet api jar - 因此不会发生冲突。