Maven构建jetty9出问题了。
直接上配置文件,多Maven构建项目不熟悉。弄了一下午悲剧了,本来打算直接移植代码的。
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>J2EE</groupId> <artifactId>Zeng</artifactId> <packaging>war</packaging> <version>0.0.1-SNAPSHOT</version> <name>Zeng Maven Webapp</name> <url>http://maven.apache.org</url> <properties> <spring.version>4.1.6.RELEASE</spring.version> <org.springframework.data.version>1.7.2.RELEASE</org.springframework.data.version> <org.slf4j.version>1.7.2</org.slf4j.version> <mysql.driver.version>5.1.10</mysql.driver.version> <org.hibernate.version>4.3.10.Final</org.hibernate.version> <com.baidu.ueditor.version>1.1.1</com.baidu.ueditor.version> <cxf.version>3.1.2</cxf.version> <commons-io.version>2.4</commons-io.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <!-- Spring --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context-support</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-messaging</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-tx</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-websocket</artifactId> <version>${spring.version}</version> </dependency> <!-- spring data jpa --> <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-jpa</artifactId> <version>${org.springframework.data.version}</version> </dependency> <!-- hibernate --> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-osgi</artifactId> <version>${org.hibernate.version}</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-envers</artifactId> <version>${org.hibernate.version}</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-c3p0</artifactId> <version>${org.hibernate.version}</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-proxool</artifactId> <version>${org.hibernate.version}</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-infinispan</artifactId> <version>${org.hibernate.version}</version> <exclusions> <exclusion> <artifactId>jboss-transaction-api_1.1_spec</artifactId> <groupId>org.jboss.spec.javax.transaction</groupId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-ehcache</artifactId> <version>${org.hibernate.version}</version> </dependency> <dependency> <groupId>org.hibernate.common</groupId> <artifactId>hibernate-commons-annotations</artifactId> <version>4.0.5.Final</version> </dependency> <dependency> <groupId>org.hibernate.javax.persistence</groupId> <artifactId>hibernate-jpa-2.1-api</artifactId> <version>1.0.0.Final</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> <version>5.1.3.Final</version> </dependency> <!-- log配置:Log4j2 --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>${org.slf4j.version}</version> </dependency> <!-- cxf 依赖包 begin --> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-frontend-jaxws</artifactId> <version>${cxf.version}</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-frontend-jaxrs</artifactId> <version>${cxf.version}</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-transports-http</artifactId> <version>${cxf.version}</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-transports-http-jetty</artifactId> <version>${cxf.version}</version> </dependency> <!-- spring 4.0 依赖包 end --> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.1.3</version> </dependency> <dependency> <groupId>cglib</groupId> <artifactId>cglib-nodep</artifactId> <version>3.1</version> </dependency> <dependency> <groupId>javax.ws.rs</groupId> <artifactId>jsr311-api</artifactId> <version>1.1.1</version> </dependency> <!-- Test --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.10</version> <scope>test</scope> </dependency> <!-- oracle driver --> <dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc6</artifactId> <version>11.2.0.1.0</version> </dependency> <!-- mysql driver --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>${mysql.driver.version}</version> </dependency> <!-- deail with json data need --> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-core-lgpl</artifactId> <version>1.9.6</version> </dependency> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-core-asl</artifactId> <version>1.9.4</version> </dependency> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-mapper-asl</artifactId> <version>1.9.5</version> </dependency> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-mapper-lgpl</artifactId> <version>1.9.6</version> </dependency> <!--json-lib --> <dependency> <groupId>net.sf.json-lib</groupId> <artifactId>json-lib</artifactId> <version>2.4</version> <classifier>jdk15</classifier> </dependency> </dependencies> <build> <finalName>Zeng</finalName> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.3</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> <plugin> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>9.2.13.v20150730</version> <executions> <execution> <id>start-jetty</id> <phase>pre-integration-test</phase> <goals> <goal>start</goal> </goals> </execution> <execution> <id>stop-jetty</id> <phase>post-integration-test</phase> <goals> <goal>stop</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.16</version> <configuration> <skip>true</skip> </configuration> </plugin> </plugins> </build> </project>
web.xml
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> <display-name>Archetype Created Web Application</display-name> <context-param> <param-name>webAppRootKey</param-name> <param-value>webapp.root</param-value> </context-param> <!-- 字符集处理 --> <filter> <filter-name>CharacterEncodingFilter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>utf-8</param-value> </init-param> </filter> <filter-mapping> <filter-name>CharacterEncodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- spring 配置 --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath*:/applicationContext*.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <!-- 配置缓存清除监听器,负责处理由 JavaBean Introspector 功能而引起的缓存泄露 --> <listener> <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class> </listener> <context-param> <param-name>log4jConfigLocation</param-name> <param-value>classpath:/Log4j.properties</param-value> </context-param> <context-param> <param-name>log4jRefreshInterval</param-name> <param-value>60000</param-value> </context-param> <!--添加监听 --> <listener> <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> </listener> <!-- CXF begin --> <servlet> <servlet-name>CXFServlet</servlet-name> <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>CXFServlet</servlet-name> <url-pattern>/api/*</url-pattern> </servlet-mapping> <!-- CXF end --> <!-- session timeout --> <session-config> <!-- 分钟 --> <session-timeout>60</session-timeout> </session-config> </web-app>
关键信息来了
[INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building Zeng Maven Webapp 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Zeng --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 4 resources [INFO] [INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ Zeng --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 4 source files to D:WorkspacesEclipseZengtargetclasses [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ Zeng --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory D:WorkspacesEclipseZengsrctestresources [INFO] [INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) @ Zeng --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 2 source files to D:WorkspacesEclipseZengtargettest-classes [INFO] [INFO] --- maven-surefire-plugin:2.16:test (default-test) @ Zeng --- [INFO] Tests are skipped. [INFO] [INFO] --- maven-war-plugin:2.2:war (default-war) @ Zeng --- [INFO] Packaging webapp [INFO] Assembling webapp [Zeng] in [D:WorkspacesEclipseZengtargetZeng] [INFO] Processing war project [INFO] Copying webapp resources [D:WorkspacesEclipseZengsrcmainwebapp] [INFO] Webapp assembled in [894 msecs] [INFO] Building war: D:WorkspacesEclipseZengtargetZeng.war [INFO] WEB-INFweb.xml already added, skipping [INFO] [INFO] >>> jetty-maven-plugin:9.2.13.v20150730:start (start-jetty) > validate @ Zeng >>> [INFO] [INFO] <<< jetty-maven-plugin:9.2.13.v20150730:start (start-jetty) < validate @ Zeng <<< [INFO] [INFO] --- jetty-maven-plugin:9.2.13.v20150730:start (start-jetty) @ Zeng --- [INFO] Logging initialized @6508ms [INFO] Configuring Jetty for project: Zeng Maven Webapp [INFO] webAppSourceDirectory not set. Trying srcmainwebapp [INFO] Reload Mechanic: automatic [INFO] Classes = D:WorkspacesEclipseZengtargetclasses [INFO] Context path = / [INFO] Tmp directory = D:WorkspacesEclipseZengtargettmp [INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml [INFO] Web overrides = none [INFO] web.xml file = file:/D:/Workspaces/Eclipse/Zeng/src/main/webapp/WEB-INF/web.xml [INFO] Webapp directory = D:WorkspacesEclipseZengsrcmainwebapp [INFO] jetty-9.2.13.v20150730 [INFO] No Spring WebApplicationInitializer types detected on classpath [INFO] Initializing Spring root WebApplicationContext 2015-09-12 20:02:58 ZengDemo INFO [org.springframework.web.context.ContextLoader:285] | Root WebApplicationContext: initialization started 2015-09-12 20:02:58 ZengDemo INFO [org.springframework.web.context.support.XmlWebApplicationContext:510] | Refreshing Root WebApplicationContext: startup date [Sat Sep 12 20:02:58 CST 2015]; root of context hierarchy 2015-09-12 20:02:58 ZengDemo INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader:317] | Loading XML bean definitions from file [D:WorkspacesEclipseZengtargetclassesapplicationContext.xml] 2015-09-12 20:02:58 ZengDemo INFO [org.springframework.context.support.PropertySourcesPlaceholderConfigurer:172] | Loading properties file from URL [file:/D:/Workspaces/Eclipse/Zeng/target/classes/db.properties] 2015-09-12 20:02:58 ZengDemo INFO [org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor:153] | JSR-330 'javax.inject.Inject' annotation found and supported for autowiring 2015-09-12 20:02:59 ZengDemo INFO [com.mchange.v2.log.MLog:92] | MLog clients using log4j logging. 2015-09-12 20:02:59 ZengDemo INFO [com.mchange.v2.c3p0.C3P0Registry:216] | Initializing c3p0-0.9.2.1 [built 20-March-2013 10:47:27 +0000; debug? true; trace: 10] 2015-09-12 20:02:59 ZengDemo INFO [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean:339] | Building JPA container EntityManagerFactory for persistence unit 'default' 2015-09-12 20:02:59 ZengDemo INFO [org.hibernate.jpa.internal.util.LogHelper:46] | HHH000204: Processing PersistenceUnitInfo [ name: default ...] 2015-09-12 20:02:59 ZengDemo INFO [org.hibernate.Version:54] | HHH000412: Hibernate Core {4.3.10.Final} 2015-09-12 20:02:59 ZengDemo INFO [org.hibernate.cfg.Environment:239] | HHH000206: hibernate.properties not found 2015-09-12 20:02:59 ZengDemo INFO [org.hibernate.cfg.Environment:346] | HHH000021: Bytecode provider name : javassist 2015-09-12 20:02:59 ZengDemo INFO [org.hibernate.annotations.common.Version:66] | HCANN000001: Hibernate Commons Annotations {4.0.5.Final} 2015-09-12 20:02:59 ZengDemo INFO [org.hibernate.dialect.Dialect:145] | HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect 2015-09-12 20:02:59 ZengDemo INFO [org.hibernate.engine.jdbc.internal.LobCreatorBuilder:88] | HHH000422: Disabling contextual LOB creation as connection was null 2015-09-12 20:02:59 ZengDemo INFO [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory:47] | HHH000397: Using ASTQueryTranslatorFactory 2015-09-12 20:02:59 ZengDemo INFO [org.hibernate.validator.internal.util.Version:27] | HV000001: Hibernate Validator 5.1.3.Final 2015-09-12 20:03:00 ZengDemo INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate:207] | HHH000228: Running hbm2ddl schema update 2015-09-12 20:03:00 ZengDemo INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate:218] | HHH000102: Fetching database metadata 2015-09-12 20:03:00 ZengDemo INFO [com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource:522] | Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 5, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1hge1859b1ho6sf51ne8uzp|52c46334, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> oracle.jdbc.driver.OracleDriver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1hge1859b1ho6sf51ne8uzp|52c46334, idleConnectionTestPeriod -> 10000, initialPoolSize -> 10, jdbcUrl -> jdbc:oracle:thin:@localhost:1521:orcl, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 28000, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 50, maxStatements -> 0, maxStatementsPerConnection -> 10, minPoolSize -> 10, numHelperThreads -> 10, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ] 2015-09-12 20:03:00 ZengDemo INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate:230] | HHH000396: Updating schema 2015-09-12 20:03:00 ZengDemo INFO [org.hibernate.tool.hbm2ddl.TableMetadata:65] | HHH000261: Table found: ZENG.SYS_USER 2015-09-12 20:03:00 ZengDemo INFO [org.hibernate.tool.hbm2ddl.TableMetadata:66] | HHH000037: Columns: [id, login, pwd] 2015-09-12 20:03:00 ZengDemo INFO [org.hibernate.tool.hbm2ddl.TableMetadata:68] | HHH000108: Foreign keys: [] 2015-09-12 20:03:00 ZengDemo INFO [org.hibernate.tool.hbm2ddl.TableMetadata:69] | HHH000126: Indexes: [sys_c0036356] 2015-09-12 20:03:00 ZengDemo INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate:267] | HHH000232: Schema update complete 2015-09-12 20:03:00 ZengDemo INFO [org.springframework.web.context.ContextLoader:325] | Root WebApplicationContext: initialization completed in 2462 ms [INFO] Set web app root system property: 'webapp.root' = [D:WorkspacesEclipseZengsrcmainwebapp] [INFO] Initializing log4j from [classpath:/Log4j.properties] [INFO] Started o.e.j.m.p.JettyWebAppContext@3bf54172{/,file:/D:/Workspaces/Eclipse/Zeng/src/main/webapp/,AVAILABLE}{file:/D:/Workspaces/Eclipse/Zeng/src/main/webapp/} [WARNING] !RequestLog [INFO] Started ServerConnector@3a917017{HTTP/1.1}{0.0.0.0:8080} [INFO] Started @12410ms [INFO] Started Jetty Server [INFO] [INFO] --- jetty-maven-plugin:9.2.13.v20150730:stop (stop-jetty) @ Zeng --- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 11.585 s [INFO] Finished at: 2015-09-12T20:03:00+08:00 [INFO] Final Memory: 53M/686M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.eclipse.jetty:jetty-maven-plugin:9.2.13.v20150730:stop (stop-jetty) on project Zeng: The parameters 'stopKey', 'stopPort' for goal org.eclipse.jetty:jetty-maven-plugin:9.2.13.v20150730:stop are missing or invalid -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginParameterException
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
一个服务应用
@天真小白 linux吧。。
企业级啊。。
还没启动呢,刚install完。
@天真小白 用我说的那个命令试试, 在run configuration 配置启动一般就没问题
回复
启动是没问题了,不过CXF服务发布的不对,你玩过CXF吗?
仔细检查吧 我没玩过cxf
你的启动命令是什么 jetty-run ?