我是部署网络应用的初学者。任何人都可以指导我如何使用MySQL数据库将我现有的Git项目运行在Tomcat上运行到Bluemix云?
当我尝试使用cf push
命令时,出现以下错误:
cf push Indus -p /Users/briantauro/Documents/workspace-sts-3.8.1.RELEASE/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Indus3 -b java_buildpack
这是输出:
Creating app Indus in org brian7 / space brian as briantauro7@gmail.com...
OK
Creating route indus.mybluemix.net...
OK
Binding indus.mybluemix.net to Indus...
OK
Uploading Indus...
Uploading app files from: /Users/briantauro/Documents/workspace-sts-3.8.1.RELEASE/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Indus3
Uploading 253.7K, 57 files
Done uploading
OK
Starting app Indus in org brian7 / space brian as briantauro7@gmail.com...
-----> Downloaded app package (19M)
-----> Java Buildpack Version: v3.6 | https://github.com/cloudfoundry/java-buildpack.git#5194155
-----> Downloading Open Jdk JRE 1.8.0_91-unlimited-crypto from https://java-buildpack.cloudfoundry.org/openjdk/trusty/x86_64/openjdk-1.8.0_91-unlimited-crypto.tar.gz (2.3s)
Expanding Open Jdk JRE to .java-buildpack/open_jdk_jre (1.9s)
-----> Downloading Open JDK Like Memory Calculator 2.0.2_RELEASE from https://java-buildpack.cloudfoundry.org/memory-calculator/trusty/x86_64/memory-calculator-2.0.2_RELEASE.tar.gz (0.0s)
Memory Settings: -Xms768M -Xss1M -Xmx768M -XX:MaxMetaspaceSize=104857K -XX:MetaspaceSize=104857K
Modifying /WEB-INF/web.xml for Auto Reconfiguration
-----> Downloading Tomcat Instance 8.0.36 from https://java-buildpack.cloudfoundry.org/tomcat/tomcat-8.0.36.tar.gz (0.2s)
Expanding Tomcat Instance to .java-buildpack/tomcat (0.2s)
-----> Downloading Tomcat Logging Support 2.5.0_RELEASE from https://java-buildpack.cloudfoundry.org/tomcat-logging-support/tomcat-logging-support-2.5.0_RELEASE.jar (0.0s)
-----> Downloading Tomcat Access Logging Support 2.5.0_RELEASE from https://java-buildpack.cloudfoundry.org/tomcat-access-logging-support/tomcat-access-logging-support-2.5.0_RELEASE.jar (0.0s)
-----> Downloading Tomcat Lifecycle Support 2.5.0_RELEASE from https://java-buildpack.cloudfoundry.org/tomcat-lifecycle-support/tomcat-lifecycle-support-2.5.0_RELEASE.jar (0.0s)
-----> Uploading droplet (72M)
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 down
0 of 1 instances running, 1 down
0 of 1 instances running, 1 down
0 of 1 instances running, 1 down
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 down
0 of 1 instances running, 1 down
0 of 1 instances running, 1 down
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 down
0 of 1 instances running, 1 down
0 of 1 instances running, 1 failing
FAILED
Error restarting application: Start unsuccessful
TIP: use 'cf logs Indus --recent' for more information
当我尝试使用cf log Indus --recent
时,我得到以下结果
Connected, dumping recent logs for app Indus in org brian7 / space brian as briantauro7@gmail.com...
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
2016-08-26T17:01:04.71+0530 [App/0] OUT at java.util.concurrent.FutureTask.run(FutureTask.java:266)
2016-08-26T17:01:04.71+0530 [App/0] OUT at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
2016-08-26T17:01:04.71+0530 [App/0] OUT at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
2016-08-26T17:01:04.71+0530 [App/0] OUT at java.lang.Thread.run(Thread.java:745)
2016-08-26T17:01:04.71+0530 [App/0] OUT Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.covenant.app.dao.DealRepository com.covenant.app.services.DealService.dealRepo; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dealRepository': Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.persistence.EntityManagerFactory] is defined
2016-08-26T17:01:04.71+0530 [App/0] OUT at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:558)
2016-08-26T17:01:04.71+0530 [App/0] OUT at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
2016-08-26T17:01:04.71+0530 [App/0] OUT at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
2016-08-26T17:01:04.71+0530 [App/0] OUT ... 26 more
2016-08-26T17:01:04.71+0530 [App/0] OUT Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dealRepository': Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.persistence.EntityManagerFactory] is defined
2016-08-26T17:01:04.71+0530 [App/0] OUT at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessPropertyValues(PersistenceAnnotationBeanPostProcessor.java:357)
2016-08-26T17:01:04.71+0530 [App/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1202)
2016-08-26T17:01:04.71+0530 [App/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
2016-08-26T17:01:04.71+0530 [App/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
2016-08-26T17:01:04.71+0530 [App/0] OUT at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
2016-08-26T17:01:04.71+0530 [App/0] OUT at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
2016-08-26T17:01:04.71+0530 [App/0] OUT at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
2016-08-26T17:01:04.71+0530 [App/0] OUT at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
2016-08-26T17:01:04.71+0530 [App/0] OUT at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1127)
2016-08-26T17:01:04.71+0530 [App/0] OUT at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1051)
2016-08-26T17:01:04.71+0530 [App/0] OUT at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:949)
2016-08-26T17:01:04.71+0530 [App/0] OUT at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:530)
2016-08-26T17:01:04.71+0530 [App/0] OUT ... 28 more
2016-08-26T17:01:04.71+0530 [App/0] OUT Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.persistence.EntityManagerFactory] is defined
2016-08-26T17:01:04.71+0530 [App/0] OUT at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findDefaultEntityManagerFactory(PersistenceAnnotationBeanPostProcessor.java:572)
2016-08-26T17:01:04.71+0530 [App/0] OUT at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findEntityManagerFactory(PersistenceAnnotationBeanPostProcessor.java:528)
2016-08-26T17:01:04.71+0530 [App/0] OUT at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement.resolveEntityManager(PersistenceAnnotationBeanPostProcessor.java:694)
2016-08-26T17:01:04.71+0530 [App/0] OUT at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement.getResourceToInject(PersistenceAnnotationBeanPostProcessor.java:667)
2016-08-26T17:01:04.71+0530 [App/0] OUT at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:155)
2016-08-26T17:01:04.71+0530 [App/0] OUT at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
2016-08-26T17:01:04.71+0530 [App/0] OUT at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessPropertyValues(PersistenceAnnotationBeanPostProcessor.java:354)
2016-08-26T17:01:04.71+0530 [App/0] OUT ... 39 more
2016-08-26T17:01:04.71+0530 [App/0] OUT [CONTAINER] org.apache.catalina.core.StandardContext SEVERE One or more listeners failed to start. Full details will be found in the appropriate container log file
2016-08-26T17:01:04.88+0530 [App/0] OUT [CONTAINER] org.apache.catalina.util.SessionIdGeneratorBase INFO Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [161] milliseconds.
2016-08-26T17:01:04.88+0530 [App/0] OUT [CONTAINER] org.apache.catalina.core.StandardContext SEVERE Context [] startup failed due to previous errors
2016-08-26T17:01:04.88+0530 [App/0] OUT [CONTAINER] lina.core.ContainerBase.[Catalina].[localhost].[/] INFO Closing Spring root WebApplicationContext
2016-08-26T17:01:04.93+0530 [App/0] OUT [CONTAINER] org.apache.catalina.loader.WebappClassLoaderBase WARNING The web application [ROOT] 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.
2016-08-26T17:01:04.93+0530 [App/0] OUT [CONTAINER] org.apache.catalina.loader.WebappClassLoaderBase WARNING The web application [ROOT] registered the JDBC driver [com.mysql.fabric.jdbc.FabricMySQLDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
2016-08-26T17:01:04.93+0530 [App/0] OUT [CONTAINER] org.apache.catalina.loader.WebappClassLoaderBase WARNING The web application [ROOT] registered the JDBC driver [org.hsqldb.jdbc.JDBCDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
2016-08-26T17:01:04.94+0530 [App/0] OUT [CONTAINER] org.apache.catalina.loader.WebappClassLoaderBase WARNING The web application [ROOT] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
2016-08-26T17:01:04.94+0530 [App/0] OUT java.lang.Object.wait(Native Method)
2016-08-26T17:01:04.94+0530 [App/0] OUT java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
2016-08-26T17:01:04.94+0530 [App/0] OUT com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:43)
2016-08-26T17:01:04.95+0530 [App/0] OUT [CONTAINER] org.apache.catalina.startup.HostConfig INFO Deployment of web application directory /home/vcap/app/.java-buildpack/tomcat/webapps/ROOT has finished in 11,953 ms
2016-08-26T17:01:04.95+0530 [App/0] OUT [CONTAINER] pplicationStartupFailureDetectingLifecycleListener SEVERE Error: Application 'Archetype Created Web Application' failed (state = STOPPED): see Tomcat's logs for details. Halting Tomcat.
2016-08-26T17:01:05.53+0530 [App/0] ERR
2016-08-26T17:01:05.63+0530 [DEA/162] ERR Instance (index 0) failed to start accepting connections
2016-08-26T17:01:05.67+0530 [API/1] OUT App instance exited with guid fe627d1a-3823-4174-8d70-32eeb604a601 payload: {"cc_partition"=>"default", "droplet"=>"fe627d1a-3823-4174-8d70-32eeb604a601", "version"=>"5dc8e37a-3be5-4a54-89a6-ca2c8158e848", "instance"=>"76b6a7864ec84ecda4a441ff1fbca5ff", "index"=>0, "reason"=>"CRASHED", "exit_status"=>148, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1472211065}
2016-08-26T17:01:05.68+0530 [API/8] OUT App instance exited with guid fe627d1a-3823-4174-8d70-32eeb604a601 payload: {"cc_partition"=>"default", "droplet"=>"fe627d1a-3823-4174-8d70-32eeb604a601", "version"=>"5dc8e37a-3be5-4a54-89a6-ca2c8158e848", "instance"=>"76b6a7864ec84ecda4a441ff1fbca5ff", "index"=>0, "reason"=>"CRASHED", "exit_status"=>148, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1472211065}
更新 我可以运行一个spring启动应用程序但是当我尝试运行一个spring mvc4无启动应用程序时,我得到以下错误我不明白应用程序永远不会被初始化?
Error 500: javax.servlet.ServletException: SRVE0207E: Uncaught initialization exception created by servlet
我试过man:cf push但它表示https://api.ng.bluemix.net的无效目标网址在部署java网络应用程序时正常工作
有人可以提供将此应用程序部署到Bluemix的过程吗?我不知道该怎么做
答案 0 :(得分:0)
我终于使用Liberty for Java,并且应用程序部署在蓝色混合中没有问题。