将更改推送到openshift服务器时构建失败

时间:2015-03-07 19:46:32

标签: java maven openshift

我正在尝试将我的项目推送到openshift服务器,它在服务器上进行maven构建时最终会出现此错误:

[INFO] Packaging webapp
[INFO] Assembling webapp [sani3ee] in [/var/lib/openshift/54f479214382ec83330000bd/app-root/runtime/repo/target/sani3ee]
[INFO] Processing war project
[INFO] Copying webapp resources [/var/lib/openshift/54f479214382ec83330000bd/app-root/runtime/repo/src/main/webapp]
[INFO] Webapp assembled in [112 msecs]
[INFO] Building war: /var/lib/openshift/54f479214382ec83330000bd/app-root/runtime/repo/webapps/ROOT.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31.677s
[INFO] Finished at: Sat Mar 07 14:01:05 EST 2015
[INFO] Final Memory: 9M/139M
[INFO] ------------------------------------------------------------------------
Preparing build for deployment
Deployment id is c2062771
Activating deployment
Starting PHPMyAdmin cartridge
Starting MySQL 5.5 cartridge
Stopping jbossews cartridge
Sending SIGTERM to jboss:514412 ...
Stopping PHPMyAdmin cartridge
Waiting for stop to finish
Waiting for stop to finish
Stopping MySQL 5.5 cartridge
Repairing links for 1 deployments
Building git ref 'master', commit 0d1853f
Using Maven mirror /var/lib/openshift/54f479214382ec83330000bd/app-root/runtime/repo//.openshift/config/settings.rhcloud.xml
Apache Maven 3.0.4 (r1232336; 2012-12-18 14:36:37-0500)
Maven home: /usr/share/java/apache-maven-3.0.4
Java version: 1.7.0_75, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "2.6.32-504.3.3.el6.x86_64", arch: "i386", family: "unix"
Found pom.xml... attempting to build with 'mvn --global-settings /var/lib/openshift/54f479214382ec83330000bd/app-root/runtime/repo//.openshift/config/settings.rhcloud.xml clean package -Popenshift -DskipTests'
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Sani3ee 1.0.0-BUILD-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ sani3ee ---
[INFO] 
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ sani3ee ---
[debug] execute contextualize
[WARNING] Using platform encoding (ANSI_X3.4-1968 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 2 resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ sani3ee ---
[WARNING] File encoding has not been set, using platform encoding ANSI_X3.4-1968, i.e. build is platform dependent!
[INFO] Compiling 58 source files to /var/lib/openshift/54f479214382ec83330000bd/app-root/runtime/repo/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] bootstrap class path not set in conjunction with -source 1.6
/var/lib/openshift/54f479214382ec83330000bd/app-root/runtime/repo/src/main/java/com/itworx/sani3ee/dao/favorite/FavoriteDaoImpl.java:[84,51] error: diamond operator is not supported in -source 1.6
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.823s
[INFO] Finished at: Sat Mar 07 14:35:34 EST 2015
[INFO] Final Memory: 8M/113M
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "openshift" could not be activated because it does not exist.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project sani3ee: Compilation failure
[ERROR] bootstrap class path not set in conjunction with -source 1.6
[ERROR] /var/lib/openshift/54f479214382ec83330000bd/app-root/runtime/repo/src/main/java/com/itworx/sani3ee/dao/favorite/FavoriteDaoImpl.java:[84,51] error: diamond operator is not supported in -source 1.6
[ERROR] -> [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/MojoFailureException
An error occurred executing 'gear postreceive' (exit code: 1)
Error message: CLIENT_ERROR: Failed to execute: 'control build' for /var/lib/openshift/54f479214382ec83330000bd/jbossews

For more details about the problem, try running the command again with the '--trace' option.

我不知道这里有什么问题,我一直试图解决这个问题一段时间,它在我的本地机器上构建得很好,openhift也认识到它应该使用JDK 7构建,感谢提前大家: )

编辑:这是tomcat日志,它表明我猜测应用程序已正确部署。

Mar 08, 2015 11:01:07 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-bio-127.7.36.1-8080"]
Mar 08, 2015 11:01:07 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-bio-127.7.36.1-8080"]
Mar 08, 2015 11:02:29 AM org.apache.catalina.startup.Catalina addClusterRuleSet
INFO: Cluster RuleSet not found due to [java.lang.ClassNotFoundException: org.apache.catalina.ha.ClusterRuleSet]. Cluster configuration disabled.
Mar 08, 2015 11:02:29 AM org.apache.catalina.startup.Catalina addClusterRuleSet
INFO: Cluster RuleSet not found due to [java.lang.ClassNotFoundException: org.apache.catalina.ha.ClusterRuleSet]. Cluster configuration disabled.
Mar 08, 2015 11:02:30 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /opt/rh/mysql55/root/usr/lib64:/usr/java/packages/lib/i386:/lib:/usr/lib
Mar 08, 2015 11:02:31 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-127.7.36.1-8080"]
Mar 08, 2015 11:02:31 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1867 ms
Mar 08, 2015 11:02:31 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Mar 08, 2015 11:02:31 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.54
Mar 08, 2015 11:02:31 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /var/lib/openshift/54f479214382ec83330000bd/app-root/runtime/dependencies/jbossews/webapps/ROOT.war
INFO : org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization started
INFO : org.springframework.web.context.support.XmlWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Sun Mar 08 11:02:50 EDT 2015]; root of context hierarchy
INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/config/BeanLocations.xml]
INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/database/DataSource.xml]
INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/database/Hibernate.xml]
INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/database/hibernate.cfg.xml]
INFO : org.springframework.beans.factory.config.PropertyPlaceholderConfigurer - Loading properties file from ServletContext resource [/WEB-INF/properties/database.properties]
WARN : org.hibernate.mapping.RootClass - HHH000038: Composite-id class does not override equals(): com.itworx.sani3ee.model.Favorite
WARN : org.hibernate.mapping.RootClass - HHH000039: Composite-id class does not override hashCode(): com.itworx.sani3ee.model.Favorite
INFO : org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 24507 ms
Mar 08, 2015 11:03:14 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Mar 08, 2015 11:03:14 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [] startup failed due to previous errors
log4j:WARN No appenders could be found for logger (org.springframework.web.context.support.XmlWebApplicationContext).
log4j:WARN Please initialize the log4j system properly.
Mar 08, 2015 11:03:14 AM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application [] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Mar 08, 2015 11:03:14 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [MySQL Statement Cancellation Timer] but has failed to stop it. This is very likely to create a memory leak.
Mar 08, 2015 11:03:14 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [Resource Destroyer in BasicResourcePool.close()] but has failed to stop it. This is very likely to create a memory leak.
Mar 08, 2015 11:03:14 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive /var/lib/openshift/54f479214382ec83330000bd/app-root/runtime/dependencies/jbossews/webapps/ROOT.war has finished in 43,453 ms
Mar 08, 2015 11:03:14 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-127.7.36.1-8080"]
Mar 08, 2015 11:03:14 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 43689 ms
Mar 09, 2015 12:03:22 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-bio-127.7.36.1-8080"]
Mar 09, 2015 12:03:22 PM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
Mar 09, 2015 12:03:22 PM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-bio-127.7.36.1-8080"]
Mar 09, 2015 12:03:22 PM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-bio-127.7.36.1-8080"]
Mar 14, 2015 4:41:16 PM org.apache.catalina.startup.Catalina addClusterRuleSet
INFO: Cluster RuleSet not found due to [java.lang.ClassNotFoundException: org.apache.catalina.ha.ClusterRuleSet]. Cluster configuration disabled.
Mar 14, 2015 4:41:16 PM org.apache.catalina.startup.Catalina addClusterRuleSet
INFO: Cluster RuleSet not found due to [java.lang.ClassNotFoundException: org.apache.catalina.ha.ClusterRuleSet]. Cluster configuration disabled.
Mar 14, 2015 4:41:17 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /opt/rh/mysql55/root/usr/lib64:/usr/java/packages/lib/i386:/lib:/usr/lib
Mar 14, 2015 4:41:18 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-127.7.36.1-8080"]
Mar 14, 2015 4:41:18 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 2071 ms
Mar 14, 2015 4:41:18 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Mar 14, 2015 4:41:18 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.54
Mar 14, 2015 4:41:18 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /var/lib/openshift/54f479214382ec83330000bd/app-root/runtime/dependencies/jbossews/webapps/ROOT.war
INFO : org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization started
INFO : org.springframework.web.context.support.XmlWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Sat Mar 14 16:41:38 EDT 2015]; root of context hierarchy
INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/config/BeanLocations.xml]
INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/database/DataSource.xml]
INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/database/Hibernate.xml]
INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/database/hibernate.cfg.xml]
INFO : org.springframework.beans.factory.config.PropertyPlaceholderConfigurer - Loading properties file from ServletContext resource [/WEB-INF/properties/database.properties]
WARN : org.hibernate.mapping.RootClass - HHH000038: Composite-id class does not override equals(): com.itworx.sani3ee.model.Favorite
WARN : org.hibernate.mapping.RootClass - HHH000039: Composite-id class does not override hashCode(): com.itworx.sani3ee.model.Favorite
INFO : org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 6553 ms
Mar 14, 2015 4:41:45 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Mar 14, 2015 4:41:45 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [] startup failed due to previous errors
log4j:WARN No appenders could be found for logger (org.springframework.web.context.support.XmlWebApplicationContext).
log4j:WARN Please initialize the log4j system properly.
Mar 14, 2015 4:41:45 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application [] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Mar 14, 2015 4:41:45 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [MySQL Statement Cancellation Timer] but has failed to stop it. This is very likely to create a memory leak.
Mar 14, 2015 4:41:45 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [Resource Destroyer in BasicResourcePool.close()] but has failed to stop it. This is very likely to create a memory leak.
Mar 14, 2015 4:41:45 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive /var/lib/openshift/54f479214382ec83330000bd/app-root/runtime/dependencies/jbossews/webapps/ROOT.war has finished in 26,168 ms
Mar 14, 2015 4:41:45 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-127.7.36.1-8080"]
Mar 14, 2015 4:41:45 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 26418 ms

1 个答案:

答案 0 :(得分:0)

看起来您可能错过了pom.xml文件中的“openshift”配置文件。你可以在这里看到它的一个例子: https://github.com/openshift/origin-server/blob/master/cartridges/openshift-origin-cartridge-jbossas/versions/7/template/pom.xml

如果要使用git push从源代码部署,则需要在pom.xml中使用它,否则openshift将不知道如何部署它构建的.war文件。

<profiles>
    <profile>
     <!-- When built in OpenShift the 'openshift' profile will be used when invoking mvn. -->
     <!-- Use this profile for any OpenShift specific customization your app will need. -->
     <!-- By default that is to put the resulting archive into the 'deployments' folder. -->
     <!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
     <id>openshift</id>
     <build>
        <finalName>{APP_NAME}</finalName>
        <plugins>
          <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1.1</version>
            <configuration>
              <outputDirectory>deployments</outputDirectory>
              <warName>ROOT</warName>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>