mysql - 如何将 Tomcat 上运行的 Spring Mvc Hibernate MySql 应用程序推送到 Bluemix 云?

标签 mysql spring-mvc deployment tomcat7 ibm-cloud

我是部署网络应用程序的初学者。谁能指导我如何使用 MySQL 数据库将在 Tomcat 上运行的现有 Git 项目推送到 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 boot 应用程序,但是当我尝试运行 spring mvc4 bootless 应用程序时,出现以下错误 我不明白该应用程序是否从未初始化?

Error 500: javax.servlet.ServletException: SRVE0207E: Uncaught initialization exception created by servlet

我尝试了 man:cf push 但它说 https://api.ng.bluemix.net 的目标 URL 无效在部署 java web 应用程序时可以正常工作

任何人都可以提供将此应用程序部署到 Bluemix 的过程吗?我不知道该做什么

最佳答案

我最终转向 Liberty for Java,并且应用程序部署在 blue mix 中,没有任何问题。

关于mysql - 如何将 Tomcat 上运行的 Spring Mvc Hibernate MySql 应用程序推送到 Bluemix 云?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39165640/

相关文章:

deployment - 对于使用Docker的多个项目,请在具有多个容器的单个主机上使用多个VM

mysql - 在mysql中获取一周的最后一个值

google-app-engine - 谷歌应用程序引擎Restful Web服务身份验证

spring - 如何 Autowiring 另一个项目中的类

deployment - Jenkins - 如何使用 shell 脚本创建列表字段参数

c# - 如何在安装/卸载 ClickOnce 应用程序期间执行自定义任务?

mysql - 如何刷新 INFORMATION_SCHEMA.COLUMNS?

mysql - UNION SELECT 的问题

python - WIN32 程序可以使用 MYSQL 通过 Django 身份验证系统进行身份验证吗?

mysql - 非法参数异常 : Type cannot be null (in JAVA)