gpt4 book ai didi

mysql - Openshift:Spring 和共享 MySQL

转载 作者:行者123 更新时间:2023-11-30 23:12:28 26 4
gpt4 key购买 nike

我有以下问题:

我有两个应用程序 app_1 和 app_2。

  • app_1 运行 Tomcat 7 (JBoss EWS 2.0)。
  • App_2 运行共享 MySQL。

我可以通过 MySQL 命令行从 app_1 毫无问题地连接到 app_2。

现在,当我在 Spring conf 文件中输入相同的数据连接并放置 app_1 时,我无法连接到 app_2。

我做错了什么?

这是我的配置。

数据源.xml

<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="username" value="adminus7xxx" />
<property name="password" value="xxxxx" />
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://525543ddd382ece1c300018b-lieferplatz.rhcloud.com:36091/<db_name>" />
</bean>

这个程序在我本地的 Tomcat 上运行没有问题,当然还有本地连接数据

这是错误轨迹

org.zkoss.zel.ELException: Error reading 'pizzeriaList' on type org.pizza.pro.shop.buchhaltung.zk.viewmodel.PizzeriaUebersichtView
org.zkoss.zel.BeanELResolver.getValue(BeanELResolver.java:96)
org.zkoss.zel.CompositeELResolver.getValue(CompositeELResolver.java:67)
org.zkoss.zel.CompositeELResolver.getValue(CompositeELResolver.java:67)
org.zkoss.xel.zel.XelELResolver.getValue(XelELResolver.java:72)
org.zkoss.bind.xel.zel.BindELResolver.getValue(BindELResolver.java:75)
org.zkoss.zel.impl.parser.AstValue.getValue(AstValue.java:177)
org.zkoss.zel.impl.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189)
org.zkoss.xel.zel.ELXelExpression.evaluate(ELXelExpression.java:40)
org.zkoss.bind.impl.BindEvaluatorXImpl.getValue(BindEvaluatorXImpl.java:43)
org.zkoss.bind.impl.LoadPropertyBindingImpl.load(LoadPropertyBindingImpl.java:58)
org.zkoss.bind.impl.PropertyBindingHandler.doLoadBinding(PropertyBindingHandler.java:171)
org.zkoss.bind.impl.PropertyBindingHandler.doLoad(PropertyBindingHandler.java:372)
org.zkoss.bind.impl.BinderImpl.loadComponentProperties(BinderImpl.java:1802)
org.zkoss.bind.impl.BinderImpl.loadComponent(BinderImpl.java:1779)
org.zkoss.bind.impl.BinderImpl.loadComponent(BinderImpl.java:1782)
org.zkoss.bind.BindComposer$BinderKeeper$Loader.load(BindComposer.java:468)
org.zkoss.bind.BindComposer$BinderKeeper.loadComponentForAllBinders(BindComposer.java:450)
org.zkoss.bind.BindComposer.doAfterCompose(BindComposer.java:174)
org.zkoss.zk.ui.impl.UiEngineImpl.doAfterCompose(UiEngineImpl.java:530)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:825)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:771)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:680)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:742)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:702)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:644)
org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:394)
org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:316)
org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:215)
org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:135)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
root cause

javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: Cannot open connection
org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:637)
org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:74)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
org.springframework.orm.jpa.SharedEntityManagerCreator$DeferredQueryInvocationHandler.invoke(SharedEntityManagerCreator.java:310)
com.sun.proxy.$Proxy33.getResultList(Unknown Source)
org.pizza.pro.shop.buchhaltung.zk.dao.impl.PizzeriaUebersichtDao.findAllPizzeriaUebersichts(PizzeriaUebersichtDao.java:21)
org.pizza.pro.shop.buchhaltung.zk.service.PizzeriaUebersichtService.getAllPizzeriaUeberichts(PizzeriaUebersichtService.java:35)
org.pizza.pro.shop.buchhaltung.zk.viewmodel.PizzeriaUebersichtView.getPizzeriaList(PizzeriaUebersichtView.java:80)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
org.zkoss.zel.BeanELResolver.getValue(BeanELResolver.java:90)
org.zkoss.zel.CompositeELResolver.getValue(CompositeELResolver.java:67)
org.zkoss.zel.CompositeELResolver.getValue(CompositeELResolver.java:67)
org.zkoss.xel.zel.XelELResolver.getValue(XelELResolver.java:72)
org.zkoss.bind.xel.zel.BindELResolver.getValue(BindELResolver.java:75)
org.zkoss.zel.impl.parser.AstValue.getValue(AstValue.java:177)
org.zkoss.zel.impl.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189)
org.zkoss.xel.zel.ELXelExpression.evaluate(ELXelExpression.java:40)
org.zkoss.bind.impl.BindEvaluatorXImpl.getValue(BindEvaluatorXImpl.java:43)
org.zkoss.bind.impl.LoadPropertyBindingImpl.load(LoadPropertyBindingImpl.java:58)
org.zkoss.bind.impl.PropertyBindingHandler.doLoadBinding(PropertyBindingHandler.java:171)
org.zkoss.bind.impl.PropertyBindingHandler.doLoad(PropertyBindingHandler.java:372)
org.zkoss.bind.impl.BinderImpl.loadComponentProperties(BinderImpl.java:1802)
org.zkoss.bind.impl.BinderImpl.loadComponent(BinderImpl.java:1779)
org.zkoss.bind.impl.BinderImpl.loadComponent(BinderImpl.java:1782)
org.zkoss.bind.BindComposer$BinderKeeper$Loader.load(BindComposer.java:468)
org.zkoss.bind.BindComposer$BinderKeeper.loadComponentForAllBinders(BindComposer.java:450)
org.zkoss.bind.BindComposer.doAfterCompose(BindComposer.java:174)
org.zkoss.zk.ui.impl.UiEngineImpl.doAfterCompose(UiEngineImpl.java:530)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:825)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:771)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:680)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:742)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:702)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:644)
org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:394)
org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:316)
org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:215)
org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:135)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
root cause

org.hibernate.exception.JDBCConnectionException: Cannot open connection
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:74)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:420)
org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1538)
org.hibernate.loader.Loader.doQuery(Loader.java:661)
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
org.hibernate.loader.Loader.doList(Loader.java:2211)
org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2095)
org.hibernate.loader.Loader.list(Loader.java:2090)
org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289)
org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695)
org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:150)
org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:65)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
org.springframework.orm.jpa.SharedEntityManagerCreator$DeferredQueryInvocationHandler.invoke(SharedEntityManagerCreator.java:310)
com.sun.proxy.$Proxy33.getResultList(Unknown Source)
org.pizza.pro.shop.buchhaltung.zk.dao.impl.PizzeriaUebersichtDao.findAllPizzeriaUebersichts(PizzeriaUebersichtDao.java:21)
org.pizza.pro.shop.buchhaltung.zk.service.PizzeriaUebersichtService.getAllPizzeriaUeberichts(PizzeriaUebersichtService.java:35)
org.pizza.pro.shop.buchhaltung.zk.viewmodel.PizzeriaUebersichtView.getPizzeriaList(PizzeriaUebersichtView.java:80)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
org.zkoss.zel.BeanELResolver.getValue(BeanELResolver.java:90)
org.zkoss.zel.CompositeELResolver.getValue(CompositeELResolver.java:67)
org.zkoss.zel.CompositeELResolver.getValue(CompositeELResolver.java:67)
org.zkoss.xel.zel.XelELResolver.getValue(XelELResolver.java:72)
org.zkoss.bind.xel.zel.BindELResolver.getValue(BindELResolver.java:75)
org.zkoss.zel.impl.parser.AstValue.getValue(AstValue.java:177)
org.zkoss.zel.impl.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189)
org.zkoss.xel.zel.ELXelExpression.evaluate(ELXelExpression.java:40)
org.zkoss.bind.impl.BindEvaluatorXImpl.getValue(BindEvaluatorXImpl.java:43)
org.zkoss.bind.impl.LoadPropertyBindingImpl.load(LoadPropertyBindingImpl.java:58)
org.zkoss.bind.impl.PropertyBindingHandler.doLoadBinding(PropertyBindingHandler.java:171)
org.zkoss.bind.impl.PropertyBindingHandler.doLoad(PropertyBindingHandler.java:372)
org.zkoss.bind.impl.BinderImpl.loadComponentProperties(BinderImpl.java:1802)
org.zkoss.bind.impl.BinderImpl.loadComponent(BinderImpl.java:1779)
org.zkoss.bind.impl.BinderImpl.loadComponent(BinderImpl.java:1782)
org.zkoss.bind.BindComposer$BinderKeeper$Loader.load(BindComposer.java:468)
org.zkoss.bind.BindComposer$BinderKeeper.loadComponentForAllBinders(BindComposer.java:450)
org.zkoss.bind.BindComposer.doAfterCompose(BindComposer.java:174)
org.zkoss.zk.ui.impl.UiEngineImpl.doAfterCompose(UiEngineImpl.java:530)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:825)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:771)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:680)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:742)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:702)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:644)
org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:394)
org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:316)
org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:215)
org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:135)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
root cause

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
java.lang.reflect.Constructor.newInstance(Constructor.java:526)
com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1117)
com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:350)
com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2393)
com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2430)
com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2215)
com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:813)
com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
java.lang.reflect.Constructor.newInstance(Constructor.java:526)
com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:399)
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:334)
java.sql.DriverManager.getConnection(DriverManager.java:571)
java.sql.DriverManager.getConnection(DriverManager.java:187)
org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:173)
org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:164)
org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnectionFromDriver(AbstractDriverBasedDataSource.java:149)
org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnection(AbstractDriverBasedDataSource.java:119)
org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:47)
org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1538)
org.hibernate.loader.Loader.doQuery(Loader.java:661)
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
org.hibernate.loader.Loader.doList(Loader.java:2211)
org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2095)
org.hibernate.loader.Loader.list(Loader.java:2090)
org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289)
org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695)
org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:150)
org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:65)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
org.springframework.orm.jpa.SharedEntityManagerCreator$DeferredQueryInvocationHandler.invoke(SharedEntityManagerCreator.java:310)
com.sun.proxy.$Proxy33.getResultList(Unknown Source)
org.pizza.pro.shop.buchhaltung.zk.dao.impl.PizzeriaUebersichtDao.findAllPizzeriaUebersichts(PizzeriaUebersichtDao.java:21)
org.pizza.pro.shop.buchhaltung.zk.service.PizzeriaUebersichtService.getAllPizzeriaUeberichts(PizzeriaUebersichtService.java:35)
org.pizza.pro.shop.buchhaltung.zk.viewmodel.PizzeriaUebersichtView.getPizzeriaList(PizzeriaUebersichtView.java:80)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
org.zkoss.zel.BeanELResolver.getValue(BeanELResolver.java:90)
org.zkoss.zel.CompositeELResolver.getValue(CompositeELResolver.java:67)
org.zkoss.zel.CompositeELResolver.getValue(CompositeELResolver.java:67)
org.zkoss.xel.zel.XelELResolver.getValue(XelELResolver.java:72)
org.zkoss.bind.xel.zel.BindELResolver.getValue(BindELResolver.java:75)
org.zkoss.zel.impl.parser.AstValue.getValue(AstValue.java:177)
org.zkoss.zel.impl.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189)
org.zkoss.xel.zel.ELXelExpression.evaluate(ELXelExpression.java:40)
org.zkoss.bind.impl.BindEvaluatorXImpl.getValue(BindEvaluatorXImpl.java:43)
org.zkoss.bind.impl.LoadPropertyBindingImpl.load(LoadPropertyBindingImpl.java:58)
org.zkoss.bind.impl.PropertyBindingHandler.doLoadBinding(PropertyBindingHandler.java:171)
org.zkoss.bind.impl.PropertyBindingHandler.doLoad(PropertyBindingHandler.java:372)
org.zkoss.bind.impl.BinderImpl.loadComponentProperties(BinderImpl.java:1802)
org.zkoss.bind.impl.BinderImpl.loadComponent(BinderImpl.java:1779)
org.zkoss.bind.impl.BinderImpl.loadComponent(BinderImpl.java:1782)
org.zkoss.bind.BindComposer$BinderKeeper$Loader.load(BindComposer.java:468)
org.zkoss.bind.BindComposer$BinderKeeper.loadComponentForAllBinders(BindComposer.java:450)
org.zkoss.bind.BindComposer.doAfterCompose(BindComposer.java:174)
org.zkoss.zk.ui.impl.UiEngineImpl.doAfterCompose(UiEngineImpl.java:530)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:825)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:771)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:680)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:742)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:702)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:644)
org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:394)
org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:316)
org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:215)
org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:135)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
root cause

java.net.NoRouteToHostException: No route to host
java.net.PlainSocketImpl.socketConnect(Native Method)
java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
java.net.Socket.connect(Socket.java:579)
java.net.Socket.connect(Socket.java:528)
java.net.Socket.<init>(Socket.java:425)
java.net.Socket.<init>(Socket.java:241)
com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:257)
com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:300)
com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2393)
com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2430)
com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2215)
com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:813)
com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
java.lang.reflect.Constructor.newInstance(Constructor.java:526)
com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:399)
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:334)
java.sql.DriverManager.getConnection(DriverManager.java:571)
java.sql.DriverManager.getConnection(DriverManager.java:187)
org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:173)
org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:164)
org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnectionFromDriver(AbstractDriverBasedDataSource.java:149)
org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnection(AbstractDriverBasedDataSource.java:119)
org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:47)
org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1538)
org.hibernate.loader.Loader.doQuery(Loader.java:661)
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
org.hibernate.loader.Loader.doList(Loader.java:2211)
org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2095)
org.hibernate.loader.Loader.list(Loader.java:2090)
org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289)
org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695)
org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:150)
org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:65)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
org.springframework.orm.jpa.SharedEntityManagerCreator$DeferredQueryInvocationHandler.invoke(SharedEntityManagerCreator.java:310)
com.sun.proxy.$Proxy33.getResultList(Unknown Source)
org.pizza.pro.shop.buchhaltung.zk.dao.impl.PizzeriaUebersichtDao.findAllPizzeriaUebersichts(PizzeriaUebersichtDao.java:21)
org.pizza.pro.shop.buchhaltung.zk.service.PizzeriaUebersichtService.getAllPizzeriaUeberichts(PizzeriaUebersichtService.java:35)
org.pizza.pro.shop.buchhaltung.zk.viewmodel.PizzeriaUebersichtView.getPizzeriaList(PizzeriaUebersichtView.java:80)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
org.zkoss.zel.BeanELResolver.getValue(BeanELResolver.java:90)
org.zkoss.zel.CompositeELResolver.getValue(CompositeELResolver.java:67)
org.zkoss.zel.CompositeELResolver.getValue(CompositeELResolver.java:67)
org.zkoss.xel.zel.XelELResolver.getValue(XelELResolver.java:72)
org.zkoss.bind.xel.zel.BindELResolver.getValue(BindELResolver.java:75)
org.zkoss.zel.impl.parser.AstValue.getValue(AstValue.java:177)
org.zkoss.zel.impl.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189)
org.zkoss.xel.zel.ELXelExpression.evaluate(ELXelExpression.java:40)
org.zkoss.bind.impl.BindEvaluatorXImpl.getValue(BindEvaluatorXImpl.java:43)
org.zkoss.bind.impl.LoadPropertyBindingImpl.load(LoadPropertyBindingImpl.java:58)
org.zkoss.bind.impl.PropertyBindingHandler.doLoadBinding(PropertyBindingHandler.java:171)
org.zkoss.bind.impl.PropertyBindingHandler.doLoad(PropertyBindingHandler.java:372)
org.zkoss.bind.impl.BinderImpl.loadComponentProperties(BinderImpl.java:1802)
org.zkoss.bind.impl.BinderImpl.loadComponent(BinderImpl.java:1779)
org.zkoss.bind.impl.BinderImpl.loadComponent(BinderImpl.java:1782)
org.zkoss.bind.BindComposer$BinderKeeper$Loader.load(BindComposer.java:468)
org.zkoss.bind.BindComposer$BinderKeeper.loadComponentForAllBinders(BindComposer.java:450)
org.zkoss.bind.BindComposer.doAfterCompose(BindComposer.java:174)
org.zkoss.zk.ui.impl.UiEngineImpl.doAfterCompose(UiEngineImpl.java:530)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:825)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:771)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:680)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:742)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:702)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:644)
org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:394)
org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:316)
org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:215)
org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:135)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

我有以下 MySql 环境变量:

OPENSHIFT_MYSQL_DB_PORT=36091
OPENSHIFT_MYSQL_DB_HOST=525543d44382ece1c300018b-lieferplatz.rhcloud.com
OPENSHIFT_MYSQL_DB_PASSWORD=xxx
OPENSHIFT_MYSQL_DB_GEAR_UUID=525543d44382ece1c300018b
OPENSHIFT_MYSQL_DB_USERNAME=adminus7xxx
OPENSHIFT_MYSQL_DB_URL=mysql://adminus7Ust4:xmVSZyYjAiKj@525543d44382ece1c300018b- lieferplatz.rhcloud.com:36091/
OPENSHIFT_MYSQL_DB_GEAR_DNS=525543ddd382ece1c300018b-lieferplatz.rhcloud.com

谢谢

最佳答案

您需要确保在 app_1 中使用具有数据库的应用的 DNS 以及连接字符串中该应用的 OPENSHIFT_MYSQL_DB_PROXY_PORT 环境变量的值。

关于mysql - Openshift:Spring 和共享 MySQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19273524/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com