-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate connecting Mysql (Windows okay, Linux failed)
PostPosted: Tue Dec 18, 2007 8:44 am 
Newbie

Joined: Tue Dec 18, 2007 8:36 am
Posts: 2
Hibernate version: 3.2.5

Full stack trace of any exception that occurs:

Code:
     [java] 2007-12-18 12:25:27,686 [main] INFO  org.hibernate.cfg.annotations.Version - Hibernate Annotations 3.3.0.GA
     [java] 2007-12-18 12:25:27,781 [main] INFO  org.hibernate.cfg.Environment - Hibernate 3.2.5
     [java] 2007-12-18 12:25:27,792 [main] INFO  org.hibernate.cfg.Environment - loaded properties from resource hibernate.properties: {hibernate.bytecode.use_reflection_optimizer=false}
     [java] 2007-12-18 12:25:27,795 [main] INFO  org.hibernate.cfg.Environment - Bytecode provider name : cglib
     [java] 2007-12-18 12:25:27,835 [main] INFO  org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
     [java] 2007-12-18 12:25:28,307 [main] INFO  org.hibernate.cfg.Configuration - configuring from resource: hibernate.cfg.xml
     [java] 2007-12-18 12:25:28,309 [main] INFO  org.hibernate.cfg.Configuration - Configuration resource: hibernate.cfg.xml
     [java] 2007-12-18 12:25:29,990 [main] INFO  org.hibernate.cfg.Configuration - Configured SessionFactory: null
     [java] 2007-12-18 12:25:30,519 [main] INFO  org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: de.develop.v2.entity.Oxarticle
     [java] 2007-12-18 12:25:30,821 [main] INFO  org.hibernate.cfg.annotations.EntityBinder - Bind entity de.develop.v2.entity.Oxarticle on table oxarticles
     [java] 2007-12-18 12:25:31,664 [main] INFO  org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: de.develop.v2.entity.Oxorderarticle
     [java] 2007-12-18 12:25:31,666 [main] INFO  org.hibernate.cfg.annotations.EntityBinder - Bind entity de.develop.v2.entity.Oxorderarticle on table oxorderarticles
     [java] 2007-12-18 12:25:31,830 [main] INFO  org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: de.develop.v2.entity.Oxorder
     [java] 2007-12-18 12:25:31,832 [main] INFO  org.hibernate.cfg.annotations.EntityBinder - Bind entity de.develop.v2.entity.Oxorder on table oxorder
     [java] 2007-12-18 12:25:31,961 [main] INFO  org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: de.develop.v2.entity.Oxuser
     [java] 2007-12-18 12:25:31,963 [main] INFO  org.hibernate.cfg.annotations.EntityBinder - Bind entity de.develop.v2.entity.Oxuser on table oxuser
     [java] 2007-12-18 12:25:32,019 [main] INFO  org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: de.develop.v2.entity.systems_oxorder
     [java] 2007-12-18 12:25:32,021 [main] INFO  org.hibernate.cfg.annotations.EntityBinder - Bind entity de.develop.v2.entity.systems_oxorder on table systems_oxorder
     [java] 2007-12-18 12:25:32,091 [main] INFO  org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: de.develop.v2.entity.systems_oxorderarticle
     [java] 2007-12-18 12:25:32,093 [main] INFO  org.hibernate.cfg.annotations.EntityBinder - Bind entity de.develop.v2.entity.systems_oxorderarticle on table tsystems_oxorderarticles
     [java] 2007-12-18 12:25:32,133 [main] INFO  org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: de.develop.v2.entity.systems_oxuser
     [java] 2007-12-18 12:25:32,136 [main] INFO  org.hibernate.cfg.annotations.EntityBinder - Bind entity de.develop.v2.entity.systems_oxuser on table tsystems_oxuser
     [java] 2007-12-18 12:25:32,176 [main] INFO  org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: de.develop.v2.entity.Packageunit
     [java] 2007-12-18 12:25:32,180 [main] INFO  org.hibernate.cfg.annotations.EntityBinder - Bind entity de.develop.v2.entity.Packageunit on table packageunit
     [java] 2007-12-18 12:25:32,186 [main] INFO  org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: de.develop.v2.entity.Articlepackageunits
     [java] 2007-12-18 12:25:32,188 [main] INFO  org.hibernate.cfg.annotations.EntityBinder - Bind entity de.develop.v2.entity.Articlepackageunits on table articlepackageunits
     [java] 2007-12-18 12:25:32,751 [main] INFO  org.hibernate.cfg.annotations.CollectionBinder - Mapping collection: de.develop.v2.entity.Oxarticle.articlepackageunits -> articlepackageunits
     [java] 2007-12-18 12:25:32,758 [main] INFO  org.hibernate.cfg.annotations.CollectionBinder - Mapping collection: de.develop.v2.entity.Oxorder.orderarticles -> oxorderarticles
     [java] 2007-12-18 12:25:32,759 [main] INFO  org.hibernate.cfg.annotations.CollectionBinder - Mapping collection: de.develop.v2.entity.Oxuser.orders -> oxorder
     [java] 2007-12-18 12:25:32,761 [main] INFO  org.hibernate.cfg.annotations.CollectionBinder - Mapping collection: de.develop.v2.entity.Tsystems_oxorder.orderarticles -> tsystems_oxorderarticles
     [java] 2007-12-18 12:25:32,763 [main] INFO  org.hibernate.cfg.annotations.CollectionBinder - Mapping collection: de.develop.v2.entity.Tsystems_oxuser.orders -> tsystems_oxorder
     [java] 2007-12-18 12:25:32,793 [main] INFO  org.hibernate.cfg.AnnotationConfiguration - Hibernate Validator not found: ignoring
     [java] 2007-12-18 12:25:33,068 [main] INFO  org.hibernate.connection.DriverManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!)
     [java] 2007-12-18 12:25:33,070 [main] INFO  org.hibernate.connection.DriverManagerConnectionProvider - Hibernate connection pool size: 20
     [java] 2007-12-18 12:25:33,071 [main] INFO  org.hibernate.connection.DriverManagerConnectionProvider - autocommit mode: false
     [java] 2007-12-18 12:25:33,120 [main] INFO  org.hibernate.connection.DriverManagerConnectionProvider - using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/daba
     [java] 2007-12-18 12:25:33,121 [main] INFO  org.hibernate.connection.DriverManagerConnectionProvider - connection properties: {user=admin, password=****, zeroDateTimeBehavior=convertToNull}
     [java] 2007-12-18 12:25:34,063 [main] WARN  org.hibernate.cfg.SettingsFactory - Could not obtain connection metadata
     [java] com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
     [java]
     [java] Last packet sent to the server was 0 ms ago.
     [java]     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
     [java]     at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
     [java]     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
     [java]     at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
     [java]     at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
     [java]     at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
     [java]     at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2104)
     [java]     at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:729)
     [java]     at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)
     [java]     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
     [java]     at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
     [java]     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
     [java]     at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
     [java]     at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
     [java]     at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:302)
     [java]     at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:283)
     [java]     at java.sql.DriverManager.getConnection(DriverManager.java:582)
     [java]     at java.sql.DriverManager.getConnection(DriverManager.java:154)
     [java]     at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
     [java]     at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84)
     [java]     at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
     [java]     at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
     [java]     at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)
     [java]     at de.develop.v2.util.HibernateUtils.<clinit>(Unknown Source)
     [java]     at de.develop.v2.manager.Manager.getArticle(Unknown Source)
     [java]     at de.develop.v2.util.Test.main(Unknown Source)
     [java] Caused by: java.net.ConnectException: Connection refused
     [java]     at java.net.PlainSocketImpl.socketConnect(Native Method)
     [java]     at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
     [java]     at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
     [java]     at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
     [java]     at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
     [java]     at java.net.Socket.connect(Socket.java:519)
     [java]     at java.net.Socket.connect(Socket.java:469)
     [java]     at java.net.Socket.<init>(Socket.java:366)
     [java]     at java.net.Socket.<init>(Socket.java:209)
     [java]     at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)
     [java]     at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:276)
     [java]     at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2027)
     [java]     ... 19 more
     [java] 2007-12-18 12:25:34,222 [main] INFO  org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.MySQL5Dialect
     [java] 2007-12-18 12:25:34,258 [main] INFO  org.hibernate.transaction.TransactionFactoryFactory - Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory
     [java] 2007-12-18 12:25:34,265 [main] INFO  org.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
     [java] 2007-12-18 12:25:34,266 [main] INFO  org.hibernate.cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled
     [java] 2007-12-18 12:25:34,267 [main] INFO  org.hibernate.cfg.SettingsFactory - Automatic session close at end of transaction: disabled
     [java] 2007-12-18 12:25:34,271 [main] INFO  org.hibernate.cfg.SettingsFactory - Scrollable result sets: disabled
     [java] 2007-12-18 12:25:34,272 [main] INFO  org.hibernate.cfg.SettingsFactory - JDBC3 getGeneratedKeys(): disabled
     [java] 2007-12-18 12:25:34,273 [main] INFO  org.hibernate.cfg.SettingsFactory - Connection release mode: auto
     [java] 2007-12-18 12:25:34,276 [main] INFO  org.hibernate.cfg.SettingsFactory - Maximum outer join fetch depth: 2
     [java] 2007-12-18 12:25:34,298 [main] INFO  org.hibernate.cfg.SettingsFactory - Default batch fetch size: 1
     [java] 2007-12-18 12:25:34,299 [main] INFO  org.hibernate.cfg.SettingsFactory - Generate SQL with comments: disabled
     [java] 2007-12-18 12:25:34,300 [main] INFO  org.hibernate.cfg.SettingsFactory - Order SQL updates by primary key: disabled
     [java] 2007-12-18 12:25:34,302 [main] INFO  org.hibernate.cfg.SettingsFactory - Order SQL inserts for batching: disabled
     [java] 2007-12-18 12:25:34,303 [main] INFO  org.hibernate.cfg.SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
     [java] 2007-12-18 12:25:34,311 [main] INFO  org.hibernate.hql.ast.ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory
     [java] 2007-12-18 12:25:34,312 [main] INFO  org.hibernate.cfg.SettingsFactory - Query language substitutions: {}
     [java] 2007-12-18 12:25:34,313 [main] INFO  org.hibernate.cfg.SettingsFactory - JPA-QL strict compliance: disabled
     [java] 2007-12-18 12:25:34,313 [main] INFO  org.hibernate.cfg.SettingsFactory - Second-level cache: enabled
     [java] 2007-12-18 12:25:34,315 [main] INFO  org.hibernate.cfg.SettingsFactory - Query cache: disabled
     [java] 2007-12-18 12:25:34,315 [main] INFO  org.hibernate.cfg.SettingsFactory - Cache provider: org.hibernate.cache.NoCacheProvider
     [java] 2007-12-18 12:25:34,317 [main] INFO  org.hibernate.cfg.SettingsFactory - Optimize cache for minimal puts: disabled
     [java] 2007-12-18 12:25:34,318 [main] INFO  org.hibernate.cfg.SettingsFactory - Structured second-level cache entries: disabled
     [java] 2007-12-18 12:25:34,357 [main] INFO  org.hibernate.cfg.SettingsFactory - Statistics: disabled
     [java] 2007-12-18 12:25:34,358 [main] INFO  org.hibernate.cfg.SettingsFactory - Deleted entity synthetic identifier rollback: disabled
     [java] 2007-12-18 12:25:34,359 [main] INFO  org.hibernate.cfg.SettingsFactory - Default entity-mode: pojo
     [java] 2007-12-18 12:25:34,360 [main] INFO  org.hibernate.cfg.SettingsFactory - Named query checking : enabled
     [java] 2007-12-18 12:25:34,527 [main] INFO  org.hibernate.impl.SessionFactoryImpl - building session factory
     [java] 2007-12-18 12:25:39,331 [main] INFO  org.hibernate.impl.SessionFactoryObjectFactory - Not binding factory to JNDI, no JNDI name configured
     [java] 2007-12-18 12:25:39,899 [main] WARN  org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: 08S01
     [java] 2007-12-18 12:25:39,900 [main] ERROR org.hibernate.util.JDBCExceptionReporter - Communications link failure
     [java]
     [java] Last packet sent to the server was 0 ms ago.
     [java] Exception in thread "main" java.lang.RuntimeException: Cannot open connection
     [java]     at de.develop.v2.manager.Manager.getArticle(Unknown Source)
     [java]     at de.develop.v2.util.Test.main(Unknown Source)
     [java] Java Result: 1




Config
Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
                                         "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
  <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
  <property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property>
  <property name="hibernate.connection.url">jdbc:mysql://localhost/daba</property>
  <property name="hibernate.connection.username">admin</property>
  <property name="hibernate.connection.password">****</property>
  <property name="current_session_context_class">thread</property>
  <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
  <property name="hibernate.connection.zeroDateTimeBehavior">convertToNull</property>
  <mapping class="de.develop.v2.entity.Oxarticle"/>
  <mapping class="de.develop.v2.entity.Oxorderarticle"/>
  <mapping class="de.develop.v2.entity.Oxorder"/>
  <mapping class="de.develop.v2.entity.Oxuser"/>
  <mapping class="de.develop.v2.entity.systems_oxorder"/>
  <mapping class="de.develop.v2.entity.systems_oxorderarticle"/>
  <mapping class="de.develop.v2.entity.systems_oxuser"/>
  <mapping class="de.develop.v2.entity.Packageunit"/>
  <mapping class="de.develop.v2.entity.Articlepackageunits"/>
  <mapping class="de.develop.v2.entity.ArticlepackageunitsId"/>
</session-factory>
</hibernate-configuration>



Name and version of the database you are using: MySQL 5.0.45


Hallo,

ich habe per Hibernate meine Datenbank daba angebunden und lese Daten aus mehreren Tabellen aus. Ich nutze unter Windows als auch Linux das Xampp Studio 1.6.4 mit der MySql Datenbank 5.0.45.

Führe ich nun meine Anwendung unter Windows aus, so werden alle Daten korrekt ausgelesen. Führe ich die gleiche Anwendung einschl. Libraries auf dem Linux-System aus, so tritt der oben genannte Fehler auf.

Kann mir jemand sagen, was das Problem ist???

Viele Dank


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 18, 2007 12:18 pm 
Newbie

Joined: Tue Dec 18, 2007 8:36 am
Posts: 2
Inzwischen habe ich die Lösung gefunden:

die Datenbankinstallation schein fehlerhaft gewesen zu sein. Nach einem kompletten Reinstall läuft nun die Anwendung.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.