so it means openshift doesn't provides this variable.

Romain Manni-Bucau
@rmannibucau
http://www.tomitribe.com
http://rmannibucau.wordpress.com
https://github.com/rmannibucau


2014-11-20 18:22 GMT+01:00 mauro2java2011 <[email protected]>:
> I have already  make the simulation. With ubuntu i have created a file
> setenv.sh that it is called from catalina.sh and i have esported the
> variables for mysql with the same names .
>
> Locally it works .
> Il 20/nov/2014 17:18 "Romain Manni-Bucau [via TomEE & OpenEJB]" <
> [email protected]> ha scritto:
>
>> it is the one often used for php apps. Prefixing it by "jdbc:" can be
>> enough. In all cases you can try to reproduce locally setting the
>> envrt variables and creating a resource using them. This would say us
>> if it is a tomee/config issue or an openshift specific issue.
>>
>>
>> Romain Manni-Bucau
>> @rmannibucau
>> http://www.tomitribe.com
>> http://rmannibucau.wordpress.com
>> https://github.com/rmannibucau
>>
>>
>> 2014-11-20 16:55 GMT+01:00 mauro2java2011 <[hidden email]
>> <http://user/SendEmail.jtp?type=node&node=4672961&i=0>>:
>>
>> > But the url returned from env var is different that classic connection
>> > string
>> > Il 20/nov/2014 12:51 "Romain Manni-Bucau [via TomEE & OpenEJB]" <
>> > [hidden email] <http://user/SendEmail.jtp?type=node&node=4672961&i=1>>
>> ha scritto:
>> >
>> >> Hi
>> >>
>> >> maybe try: JdbcUrl = ${OPENSHIFT_MYSQL_DB_URL}
>> >>
>> >>
>> >> Romain Manni-Bucau
>> >> @rmannibucau
>> >> http://www.tomitribe.com
>> >> http://rmannibucau.wordpress.com
>> >> https://github.com/rmannibucau
>> >>
>> >>
>> >> 2014-11-20 12:34 GMT+01:00 mauro2java2011 <[hidden email]
>> >> <http://user/SendEmail.jtp?type=node&node=4672951&i=0>>:
>> >>
>> >> >
>> >> >
>> >> > i have tried to wirte a tomee application that use tomee on openshift
>> >> and
>> >> > mysql .
>> >> >
>> >> > but i get :
>> >> >
>> >> > Caused by:
>> >> > com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:
>> >> Cannot
>> >> > load connection class because of underlying exception:
>> >> > 'java.lang.NumberFormatException: For input string:
>> >> > "${OPENSHIFT_MYSQL_DB_PORT}"'.
>> >> >         at
>> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>> >> Method)
>> >> >         at
>> >> >
>> >>
>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
>>
>> >>
>> >> >         at
>> >> >
>> >>
>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>>
>> >>
>> >> >         at
>> >> java.lang.reflect.Constructor.newInstance(Constructor.java:526)
>> >> >         at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
>> >> >         at com.mysql.jdbc.Util.getInstance(Util.java:386)
>> >> >         at
>> >> com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1013)
>> >> >         at
>> com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987)
>> >> >         at
>> com.mysql.jdbc.SQLError.createSQLException(SQLError.java:982)
>> >> >         at
>> com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927)
>> >> >         at
>> >> >
>> >>
>> com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:314)
>> >> >         at
>> >> >
>> >>
>> org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:278)
>>
>> >>
>> >> >         at
>> >> >
>> >>
>> org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:182)
>>
>> >>
>> >> >         at
>> >> >
>> >>
>> org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:702)
>>
>> >>
>> >> >         at
>> >> >
>> >>
>> org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:634)
>>
>> >>
>> >> >         at
>> >> >
>> >>
>> org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:188)
>>
>> >>
>> >> >         at
>> >> >
>> >>
>> org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:128)
>>
>> >>
>> >> >         at
>> >> >
>> >>
>> org.apache.tomee.jdbc.TomEEDataSourceCreator$TomEEDataSource.getConnection(TomEEDataSourceCreator.java:251)
>>
>> >>
>> >> >         at
>> >> >
>> >>
>> org.apache.openejb.resource.jdbc.managed.local.ManagedDataSource.getConnection(ManagedDataSource.java:43)
>>
>> >>
>> >> >         at
>> >> >
>> >>
>> org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:110)
>>
>> >>
>> >> >         at
>> >> >
>> >>
>> org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:87)
>>
>> >>
>> >> >         at
>> >> >
>> >>
>> org.apache.openjpa.jdbc.sql.DBDictionaryFactory.newDBDictionary(DBDictionaryFactory.java:91)
>>
>> >>
>> >> >         ... 104 more
>> >> > Caused by: java.lang.NumberFormatException: For input string:
>> >> > "${OPENSHIFT_MYSQL_DB_PORT}"
>> >> >         at
>> >> >
>> >>
>> java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
>>
>> >>
>> >> >         at java.lang.Integer.parseInt(Integer.java:481)
>> >> >         at java.lang.Integer.parseInt(Integer.java:527)
>> >> >         at
>> >> com.mysql.jdbc.NonRegisteringDriver.port(NonRegisteringDriver.java:831)
>> >> >         at
>> >> >
>> >>
>> com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)
>> >> >         ... 115 more
>> >> > -------------------------------------------------------------------
>> >> >
>> >> > The resource.xml file contains:
>> >> >
>> >> >
>> >> > <?xml version="1.0" encoding="UTF-8"?>
>> >> >
>> >> > <resources>
>> >> >      <Resource id="db/web" type="javax.sql.DataSource">
>> >> >     UserName = ${OPENSHIFT_MYSQL_DB_USERNAME}
>> >> >     Password = ${OPENSHIFT_MYSQL_DB_PASSWORD}
>> >> >  JdbcUrl =
>> >> >
>> >>
>> jdbc:mysql://${OPENSHIFT_MYSQL_DB_HOST}:${OPENSHIFT_MYSQL_DB_PORT}/${OPENSHIFT_APP_NAME}
>>
>> >>
>> >> >     JdbcDriver = com.mysql.jdbc.Driver
>> >> >     JtaManaged = true
>> >> >
>> >> >    </Resource>
>> >> >
>> >> >   <Resource id="db/web_unmanaged" type="javax.sql.DataSource">
>> >> >     UserName = ${OPENSHIFT_MYSQL_DB_USERNAME}
>> >> >     Password = ${OPENSHIFT_MYSQL_DB_PASSWORD}
>> >> >    JdbcUrl =
>> >> >
>> >>
>> jdbc:mysql://${OPENSHIFT_MYSQL_DB_HOST}:${OPENSHIFT_MYSQL_DB_PORT}/${OPENSHIFT_APP_NAME}
>>
>> >>
>> >> >       JdbcDriver = com.mysql.jdbc.Driver
>> >> >       JtaManaged = false
>> >> >
>> >> >   </Resource>
>> >> > </resources>
>> >> >
>> >> >
>> >> >
>> >> > ------------------------------------
>> >> > the file persistence.xml contain:
>> >> >
>> >> > <?xml version="1.0" encoding="UTF-8"?>
>> >> > <persistence version="2.0" xmlns="
>> http://java.sun.com/xml/ns/persistence";
>> >>
>> >> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>> >> > xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
>> >> > http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd";>
>> >> >   <persistence-unit name="TestDBMysqlTOMEEOpenshiftPU"
>> >> > transaction-type="JTA">
>> >> >
>> >> >
>> >>
>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>> >> >     <jta-data-source>db/web</jta-data-source>
>> >> >     <non-jta-data-source>db/web_unmanaged</non-jta-data-source>
>> >> >     <exclude-unlisted-classes>false</exclude-unlisted-classes>
>> >> >     <properties>
>> >> >       <property name="openjpa.jdbc.SynchronizeMappings"
>> >> > value="buildSchema(ForeignKeys=true)"/>
>> >> >     </properties>
>> >> >   </persistence-unit>
>> >> > </persistence>
>> >> >
>> >> >
>> >>
>> ----------------------------------------------------------------------------
>>
>> >>
>> >> > whi it not reaead the myslq port from environment variable of
>> openshift
>> >>  ?
>> >> >
>> >> > Caused by:
>> >> > com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:
>> >> Cannot
>> >> > load connection class because of underlying exception:
>> >> > 'java.lang.NumberFormatException: For input string:
>> >> > "${OPENSHIFT_MYSQL_DB_PORT}"'.
>> >> >
>> >> >
>> >> > i have to se t the dialect int opersistence.xml?
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > View this message in context:
>> >>
>> http://tomee-openejb.979440.n4.nabble.com/datasource-mysql-not-work-at-openshift-tomee-diy-tp4672950.html
>> >> > Sent from the TomEE Users mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ------------------------------
>> >>  If you reply to this email, your message will be added to the
>> discussion
>> >> below:
>> >>
>> >>
>> http://tomee-openejb.979440.n4.nabble.com/datasource-mysql-not-work-at-openshift-tomee-diy-tp4672950p4672951.html
>> >>  To unsubscribe from datasource mysql not work at openshift tomee diy,
>> click
>> >> here
>> >> <
>> >> .
>> >> NAML
>> >> <
>> http://tomee-openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>> >>
>> >
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> http://tomee-openejb.979440.n4.nabble.com/datasource-mysql-not-work-at-openshift-tomee-diy-tp4672950p4672960.html
>> > Sent from the TomEE Users mailing list archive at Nabble.com.
>>
>>
>> ------------------------------
>>  If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://tomee-openejb.979440.n4.nabble.com/datasource-mysql-not-work-at-openshift-tomee-diy-tp4672950p4672961.html
>>  To unsubscribe from datasource mysql not work at openshift tomee diy, click
>> here
>> <http://tomee-openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4672950&code=bWF1cm8yamF2YTIwMTFAZ21haWwuY29tfDQ2NzI5NTB8LTExMTcxODc2MjU=>
>> .
>> NAML
>> <http://tomee-openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
>
>
> --
> View this message in context: 
> http://tomee-openejb.979440.n4.nabble.com/datasource-mysql-not-work-at-openshift-tomee-diy-tp4672950p4672962.html
> Sent from the TomEE Users mailing list archive at Nabble.com.

Reply via email to