hy, i just start using hibernate and i have a problem
i have this cfg.xml
<?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 name="sessionFactory"> <property name="hibernate.bytecode.use_reflection_optimizer">false</property> <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driber</property> <property name="hibernate.connection.autocommitt">true</property> <property name="hibernate.connection.url">jdbc:mysql://localhost/test</property> <property name="connection.username">root</property> <property name="connection.password">mami</property> <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> <property name="hibernate.current_session_context_class">thread</property> <mapping resource="beans/Color.hbm.xml" /> </session-factory> </hibernate-configuration>
and i receive this message
15:17:44,113 INFO Environment:570 - Hibernate 3.5.2-Final 15:17:44,117 INFO Environment:603 - hibernate.properties not found 15:17:44,126 INFO Environment:781 - Bytecode provider name : javassist 15:17:44,131 INFO Environment:662 - using JDK 1.4 java.sql.Timestamp handling 15:17:44,276 INFO Configuration:1552 - configuring from file: hibernate.cfg.xml 15:17:44,415 INFO Configuration:655 - Reading mappings from resource : beans/Color.hbm.xml 15:17:44,504 INFO HbmBinder:348 - Mapping class: beans.Color -> colors 15:17:44,527 INFO Configuration:1633 - Configured SessionFactory: sessionFactory 15:17:44,603 INFO DriverManagerConnectionProvider:64 - Using Hibernate built-in connection pool (not for production use!) 15:17:44,603 INFO DriverManagerConnectionProvider:65 - Hibernate connection pool size: 20 15:17:44,603 INFO DriverManagerConnectionProvider:68 - autocommit mode: false 15:17:44,608 INFO DriverManagerConnectionProvider:103 - using driver: net.sourceforge.jtds.jdbc.Driver at URL: jdbc:jtds:sqlserver://localhost:1433/ISS 15:17:44,609 INFO DriverManagerConnectionProvider:109 - connection properties: {autocommitt=true} 15:17:45,663 WARN SettingsFactory:137 - Could not obtain connection to query metadata java.sql.SQLException: Network error IOException: Connection refused: connect at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:410) at net.sourceforge.jtds.jdbc.ConnectionJDBC3.<init>(ConnectionJDBC3.java:50) at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:133) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:114) at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2163) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2159) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1383) at utils.HibernateUtil.<clinit>(HibernateUtil.java:16) at Main.main(Main.java:9) Caused by: java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(Unknown Source) at java.net.PlainSocketImpl.connectToAddress(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.sourceforge.jtds.jdbc.SharedSocket.createSocketForJDBC3(SharedSocket.java:307) at net.sourceforge.jtds.jdbc.SharedSocket.<init>(SharedSocket.java:257) at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:311) ... 11 more 15:17:45,700 INFO Dialect:206 - Using dialect: org.hibernate.dialect.MySQLDialect 15:17:45,707 INFO JdbcSupportLoader:70 - Disabling contextual LOB creation as connection was null 15:17:45,709 INFO TransactionFactoryFactory:59 - Using default transaction strategy (direct JDBC transactions) 15:17:45,711 INFO TransactionManagerLookupFactory:80 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended) 15:17:45,711 INFO SettingsFactory:169 - Automatic flush during beforeCompletion(): disabled 15:17:45,711 INFO SettingsFactory:173 - Automatic session close at end of transaction: disabled 15:17:45,712 INFO SettingsFactory:188 - Scrollable result sets: disabled 15:17:45,714 INFO SettingsFactory:196 - JDBC3 getGeneratedKeys(): disabled 15:17:45,714 INFO SettingsFactory:204 - Connection release mode: auto 15:17:45,715 INFO SettingsFactory:228 - Maximum outer join fetch depth: 2 15:17:45,715 INFO SettingsFactory:231 - Default batch fetch size: 1 15:17:45,716 INFO SettingsFactory:235 - Generate SQL with comments: disabled 15:17:45,716 INFO SettingsFactory:239 - Order SQL updates by primary key: disabled 15:17:45,716 INFO SettingsFactory:243 - Order SQL inserts for batching: disabled 15:17:45,717 INFO SettingsFactory:410 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory 15:17:45,719 INFO ASTQueryTranslatorFactory:47 - Using ASTQueryTranslatorFactory 15:17:45,720 INFO SettingsFactory:251 - Query language substitutions: {} 15:17:45,720 INFO SettingsFactory:256 - JPA-QL strict compliance: disabled 15:17:45,720 INFO SettingsFactory:261 - Second-level cache: enabled 15:17:45,720 INFO SettingsFactory:265 - Query cache: disabled 15:17:45,720 INFO SettingsFactory:395 - Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory 15:17:45,721 INFO SettingsFactory:275 - Optimize cache for minimal puts: disabled 15:17:45,721 INFO SettingsFactory:284 - Structured second-level cache entries: disabled 15:17:45,727 INFO SettingsFactory:313 - Statistics: disabled 15:17:45,727 INFO SettingsFactory:317 - Deleted entity synthetic identifier rollback: disabled 15:17:45,728 INFO SettingsFactory:332 - Default entity-mode: pojo 15:17:45,728 INFO SettingsFactory:336 - Named query checking : enabled 15:17:45,728 INFO SettingsFactory:340 - Check Nullability in Core (should be disabled when Bean Validation is on): enabled 15:17:45,781 INFO SessionFactoryImpl:199 - building session factory 15:17:46,046 INFO SessionFactoryObjectFactory:109 - Factory name: sessionFactory 15:17:46,047 INFO NamingHelper:49 - JNDI InitialContext properties:{} 15:17:46,050 WARN SessionFactoryObjectFactory:121 - Could not bind factory to JNDI javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial at javax.naming.spi.NamingManager.getInitialContext(Unknown Source) at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source) at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source) at javax.naming.InitialContext.getNameParser(Unknown Source) at org.hibernate.util.NamingHelper.bind(NamingHelper.java:75) at org.hibernate.impl.SessionFactoryObjectFactory.addInstance(SessionFactoryObjectFactory.java:113) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:376) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1385) at utils.HibernateUtil.<clinit>(HibernateUtil.java:16) at Main.main(Main.java:9) 15:17:47,159 WARN JDBCExceptionReporter:100 - SQL Error: 0, SQLState: 08S01 15:17:47,159 ERROR JDBCExceptionReporter:101 - Network error IOException: Connection refused: connect Exception in thread "main" org.hibernate.exception.JDBCConnectionException: Cannot open connection at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:99) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52) at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:449) at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167) at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:142) at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:85) at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1463) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:344) at $Proxy0.beginTransaction(Unknown Source) at Main.main(Main.java:10) Caused by: java.sql.SQLException: Network error IOException: Connection refused: connect at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:410) at net.sourceforge.jtds.jdbc.ConnectionJDBC3.<init>(ConnectionJDBC3.java:50) at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:133) at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446) ... 11 more Caused by: java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(Unknown Source) at java.net.PlainSocketImpl.connectToAddress(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.sourceforge.jtds.jdbc.SharedSocket.createSocketForJDBC3(SharedSocket.java:307) at net.sourceforge.jtds.jdbc.SharedSocket.<init>(SharedSocket.java:257) at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:311) ... 17 more
could someone tell me that can i do?
|