I have 2 machines with identical databases.
I'm using hibernate version 4.3.6.Final
When I'm using this configuration (connecting to local DB) - everything is ok :
<persistence-unit name="stg">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<properties>
<!--
<property name="hibernate.ejb.cfgfile" value="/hibernate.cfg.xml"/>
-->
<property name="hibernate.ejb.naming_strategy" value="org.hibernate.cfg.ImprovedNamingStrategy"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.archive.autodetection" value="class, hbm"/>
<property name="hibernate.show_sql" value="false"/>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
<property name="hibernate.connection.password" value="PASSWORD"/>
<property name="hibernate.connection.url" value="jdbc:mysql://127.0.0.1:3306/DATABASENAME?autoReconnect=true"/>
<property name="hibernate.connection.username" value="root"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.c3p0.timeout" value="3600"/>
<property name="hibernate.c3p0.min_size" value="20"/>
<property name="hibernate.c3p0.max_size" value="100"/>
<property name="hibernate.c3p0.acquire_increment" value="5"/>
<property name="hibernate.c3p0.maxIdleTimeExcessConnections" value="300"/>
<property name="hibernate.c3p0.automaticTestTable" value="hibernate_conn_test"/>
<property name="hibernate.c3p0.testConnectionOnCheckout" value="false"/>
<property name="hibernate.c3p0.validate" value="false"/>
<property name="hibernate.c3p0.testConnectionOnCheckin" value="true"/>
<property name="hibernate.c3p0.idle_test_period" value="300"/>
<property name="hibernate.c3p0.unreturnedConnectionTimeout" value="3600"/>
<property name="hibernate.c3p0.numHelperThreads" value="6"/>
</properties>
</persistence-unit>
The only thing that I changed is the IP to the other machine , and I always get the same error :
<property name="hibernate.connection.url" value="jdbc:mysql://2.2.2.2:3306/te?autoReconnect=true"/>
This is the errors I'm getting:
[localhost-startStop-1][ ][13 Jan 2016 16:40:43,386] [internal.JdbcServicesImpl ]: [WARN ] HHH000342: Could not obtain connection to query metadata : Could not create connection to database server. Attempted reconnect 3 times. Giving up.
[localhost-startStop-1][ ][13 Jan 2016 16:40:48,819] [hbm2ddl.SchemaUpdate ]: [ERROR] HHH000319: Could not get database metadata
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
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:1015)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:920)
at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2395)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2316)
at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:834)
at com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:47)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:416)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:347)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:131)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:156)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:145)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.initializeAutomaticTestTable(C3P0PooledConnectionPoolManager.java:898)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.createPooledConnectionPool(C3P0PooledConnectionPoolManager.java:821)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.getPool(C3P0PooledConnectionPoolManager.java:331)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.getPool(C3P0PooledConnectionPoolManager.java:348)
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:140)
at org.hibernate.c3p0.internal.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:89)
at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:51)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:194)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:178)
at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:522)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1857)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:843)
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:398)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:842)
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:75)
at com.checkpoint.te.shared.service.CustomHibernatePersistence.createEntityManagerFactory(CustomHibernatePersistence.java:43)
at com.checkpoint.te.shared.service.CustomHibernatePersistence.createEntityManagerFactory(CustomHibernatePersistence.java:28)
at com.checkpoint.te.shared.sql.DbHandler.lifeCycleUp(DbHandler.java:192)
at com.checkpoint.te.shared.BaseLifecycleListener.contextInitialized(BaseLifecycleListener.java:42)
at com.checkpoint.te.shared.TomcatLifecycleListener.contextInitialized(TomcatLifecycleListener.java:13)
at com.checkpoint.te.pod.PodLifecycleListener.contextInitialized(PodLifecycleListener.java:43)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4797)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5291)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:977)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1655)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: 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.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1121)
at com.mysql.jdbc.MysqlIO.(MysqlIO.java:358)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2489)
at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2334)
... 48 more
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.(Unknown Source)
at java.net.Socket.(Unknown Source)
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:259)
at com.mysql.jdbc.MysqlIO.(MysqlIO.java:308)
... 50 more
[localhost-startStop-1][ ][13 Jan 2016 16:40:48,825] [hbm2ddl.SchemaUpdate ]: [ERROR] HHH000299: Could not complete schema update
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
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:1015)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:920)
at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2395)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2316)
at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:834)
at com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:47)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:416)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:347)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:131)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:156)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:145)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.initializeAutomaticTestTable(C3P0PooledConnectionPoolManager.java:898)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.createPooledConnectionPool(C3P0PooledConnectionPoolManager.java:821)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.getPool(C3P0PooledConnectionPoolManager.java:331)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.getPool(C3P0PooledConnectionPoolManager.java:348)
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:140)
at org.hibernate.c3p0.internal.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:89)
at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:51)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:194)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:178)
at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:522)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1857)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:843)
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:398)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:842)
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:75)
at com.checkpoint.te.shared.service.CustomHibernatePersistence.createEntityManagerFactory(CustomHibernatePersistence.java:43)
at com.checkpoint.te.shared.service.CustomHibernatePersistence.createEntityManagerFactory(CustomHibernatePersistence.java:28)
at com.checkpoint.te.shared.sql.DbHandler.lifeCycleUp(DbHandler.java:192)
at com.checkpoint.te.shared.BaseLifecycleListener.contextInitialized(BaseLifecycleListener.java:42)
at com.checkpoint.te.shared.TomcatLifecycleListener.contextInitialized(TomcatLifecycleListener.java:13)
at com.checkpoint.te.pod.PodLifecycleListener.contextInitialized(PodLifecycleListener.java:43)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4797)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5291)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:977)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1655)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: 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.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1121)
at com.mysql.jdbc.MysqlIO.(MysqlIO.java:358)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2489)
at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2334)
... 48 more
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.(Unknown Source)
at java.net.Socket.(Unknown Source)
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:259)
at com.mysql.jdbc.MysqlIO.(MysqlIO.java:308)
... 50 more
Can anyone help?
I tried changing the port but nothing helper. Have no idea where to start
This screams "Network issue".
Check the following items:
destination host can be reached on TCP 3306 (run telnet destination 3306 or similar)
check netstat -na while that connection is trying to establish: Any SYN_SENT would indicate a firewall is in the way.
check netstat -na on your MySQL box - is 3306 bound to outside interface (or to 127.0.0.1 / localhost only?)
Related
I went through this post and implemented eventListner.
Best practice for handling low-level socket error in spring integration?
I have implemented Spring TCP channels as below:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-ip="http://www.springframework.org/schema/integration/ip"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:int-event="http://www.springframework.org/schema/integration/event"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/integration/event http://www.springframework.org/schema/integration/event/spring-integration-event.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/ip http://www.springframework.org/schema/integration/ip/spring-integration-ip.xsd">
<context:annotation-config />
<!--Deserializer for incoming data on the socket -->
<bean
class="org.springframework.integration.ip.tcp.serializer.ByteArraySingleTerminatorSerializer"
id="serializeAndDeserializer">
<constructor-arg type="byte" value="0" />
</bean>
<int:channel id="tcp-client-input" />
<int:channel id="message" />
<int:gateway id="gateway" service-interface="com.tcpclient.ClientGateway"
default-request-channel="tcp-client-input" default-reply-channel="message" />
<int-ip:tcp-connection-factory id="clientFactory"
type="client" host="10.255.233.21" port="1234" single-use="false"
so-timeout="10000" deserializer="serializeAndDeserializer" serializer="serializeAndDeserializer" />
<int-ip:tcp-outbound-channel-adapter
id="outBoundClient" channel="tcp-client-input" connection-factory="clientFactory"
retry-interval="60000" auto-startup="false" />
<int-ip:tcp-inbound-channel-adapter
id="inBoundClient" channel="message" connection-factory="clientFactory"
client-mode="true" auto-startup="false" retry-interval="60000" />
<int-event:inbound-channel-adapter
channel="eventChannel" error-channel="tcpReceiveError"
event- types="org.springframework.integration.ip.tcp.connection.TcpConnectionExceptionEvent"/>
<int:object-to-string-transformer
input-channel="message" output-channel="message-serviceActivator" />
<int:service-activator input-channel="message-serviceActivator"
method="onRtlsMessageArrival">
<bean class="com.tcpclient.HandleMessage" />
</int:service-activator>
</beans>
Service Activator
#ServiceActivator(inputChannel = "tcpReceiveError")
public void handleSocketFlags(Message m) {
System.out.println(m.getPayload());
}
My service activator is not getting called on below exception:
java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method) ~[na:1.8.0_92]
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) ~[na:1.8.0_92]
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) ~[na:1.8.0_92]
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) ~[na:1.8.0_92]
at java.net.AbstractPlainSocketImpl.connect(Unknown Source) ~[na:1.8.0_92]
at java.net.PlainSocketImpl.connect(Unknown Source) ~[na:1.8.0_92]
at java.net.SocksSocketImpl.connect(Unknown Source) ~[na:1.8.0_92]
at java.net.Socket.connect(Unknown Source) ~[na:1.8.0_92]
at java.net.Socket.connect(Unknown Source) ~[na:1.8.0_92]
at java.net.Socket.<init>(Unknown Source) ~[na:1.8.0_92]
at java.net.Socket.<init>(Unknown Source) ~[na:1.8.0_92]
at javax.net.DefaultSocketFactory.createSocket(Unknown Source) ~[na:1.8.0_92]
at org.springframework.integration.ip.tcp.connection.TcpNetClientConnectionFactory.createSocket(TcpNetClientConnectionFactory.java:76) ~[spring-integration-ip-4.2.5.RELEASE.jar:na]
at org.springframework.integration.ip.tcp.connection.TcpNetClientConnectionFactory.buildNewConnection(TcpNetClientConnectionFactory.java:49) ~[spring-integration-ip-4.2.5.RELEASE.jar:na]
at org.springframework.integration.ip.tcp.connection.AbstractClientConnectionFactory.obtainNewConnection(AbstractClientConnectionFactory.java:114) ~[spring-integration-ip-4.2.5.RELEASE.jar:na]
at org.springframework.integration.ip.tcp.connection.AbstractClientConnectionFactory.obtainConnection(AbstractClientConnectionFactory.java:77) ~[spring-integration-ip-4.2.5.RELEASE.jar:na]
at org.springframework.integration.ip.tcp.connection.AbstractClientConnectionFactory.getConnection(AbstractClientConnectionFactory.java:67) ~[spring-integration-ip-4.2.5.RELEASE.jar:na]
at org.springframework.integration.ip.tcp.connection.AbstractClientConnectionFactory.getConnection(AbstractClientConnectionFactory.java:31) ~[spring-integration-ip-4.2.5.RELEASE.jar:na]
at org.springframework.integration.ip.tcp.connection.ClientModeConnectionManager.run(ClientModeConnectionManager.java:54) ~[spring-integration-ip-4.2.5.RELEASE.jar:na]
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [na:1.8.0_92]
at java.util.concurrent.FutureTask.runAndReset(Unknown Source) [na:1.8.0_92]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source) [na:1.8.0_92]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) [na:1.8.0_92]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_92]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_92]
at java.lang.Thread.run(Unknown Source) [na:1.8.0_92]
I there anything I am missing. I hope the event-type in int-event:inbound-channel-adapter is appropriate one. Please let me know if I have to correct something.
Connection exception events are only generated after a connection is established, we don't currently emit an event for a failure to create a connection in the first place (e.g. connection refused).
The TcpConnectionExceptionEvent is for an exception on an existing TcpConnection.
Feel free to open a JIRA Improvement issue and we'll look at adding a new event.
I created a JavaFX project as a desktop standalone application.
For persistence I use hibernate 5.0.1
When I run the project in Eclipse everything works fine.
Building the project with Ant leads to the following error:
"javax.persistence.PersistenceException: Unable to locate persistence units"
Exception in Application constructor
Exception in thread "main" java.lang.reflect.InvocationTargetException
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.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa
der.java:58)
Caused by: java.lang.RuntimeException: Unable to construct Application instance:
class src.main.java.MainApp
at com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown So
urce)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$147(
Unknown Source)
at com.sun.javafx.application.LauncherImpl$$Lambda$1/1634198.run(Unknown
Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
rce)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$152
(Unknown Source)
at com.sun.javafx.application.LauncherImpl$$Lambda$44/13272165.run(Unkno
wn Source)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$166(Unknown
Source)
at com.sun.javafx.application.PlatformImpl$$Lambda$46/24080292.run(Unkno
wn Source)
at com.sun.javafx.application.PlatformImpl.lambda$null$164(Unknown Sourc
e)
at com.sun.javafx.application.PlatformImpl$$Lambda$48/19739574.run(Unkno
wn Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$165(Unknown S
ource)
at com.sun.javafx.application.PlatformImpl$$Lambda$47/27265806.run(Unkno
wn Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$141(Unknown Source)
at com.sun.glass.ui.win.WinApplication$$Lambda$38/7264602.run(Unknown So
urce)
... 1 more
Caused by: javax.persistence.PersistenceException: Unable to locate persistence
units
at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactor
yBuilderOrNull(HibernatePersistenceProvider.java:84)
at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactor
yBuilderOrNull(HibernatePersistenceProvider.java:71)
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFac
tory(HibernatePersistenceProvider.java:52)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.
java:55)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.
java:39)
at src.main.java.dao.TypGen_DAO.<init>(TypGen_DAO.java:22)
at src.main.java.MainApp.<init>(MainApp.java:53)
... 18 more
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range:
-1
at java.lang.String.substring(Unknown Source)
at org.hibernate.boot.archive.internal.ArchiveHelper.getJarURLFromURLEnt
ry(ArchiveHelper.java:45)
at org.hibernate.jpa.boot.internal.PersistenceXmlParser.parsePersistence
Xml(PersistenceXmlParser.java:105)
at org.hibernate.jpa.boot.internal.PersistenceXmlParser.doResolve(Persis
tenceXmlParser.java:84)
at org.hibernate.jpa.boot.internal.PersistenceXmlParser.locatePersistenc
eUnits(PersistenceXmlParser.java:66)
at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactor
yBuilderOrNull(HibernatePersistenceProvider.java:80)
... 24 more
the Persistence.xml
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence" version="2.1">
<persistence-unit name="jpa-example" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<class>src.main.model.testClass</class>
<properties>
<property name="javax.persistence.jdbc.url"
value="jdbc:sqlite:\\\\...localnetworkURL\\Database\\TypGen.db"></property>
<property name="javax.persistence.jdbc.user" value="root"></property>
<property name="javax.persistence.jdbc.password" value="my_root_password"></property>
<property name="javax.persistence.jdbc.driver" value="org.sqlite.JDBC"></property>
<property name="hibernate.show_sql" value="true"></property>
<property name="hibernate.format_sql" value="true"></property>
<property name="hibernate.dialect" value="src.main.java.resources.SQLiteDialect"></property>
<property name="hibernate.hbm2ddl.auto" value="update"></property>
<property name="hibernate.c3p0.min_size" value="5" />
<property name="hibernate.c3p0.max_size" value="20" />
<property name="hibernate.c3p0.timeout" value="500" />
<property name="hibernate.c3p0.max_statements" value="50" />
<property name="hibernate.c3p0.idle_test_period" value="2000" />
</properties>
</persistence-unit>
</persistence>
Unfortunately I can not use maven for the project, I`m grateful for any help :)
The Problem was:
Usage of wrong Java Version when starting the Jar from Console
I have this problem with my Java 8 + ControlsFX 2 app.
I'm using H2 database serverless, and everything works fine in run/debug from eclipse, but when I creare the runnable jar and start it i get this message
2015-07-02 15:29:23,535|JavaFX Application Thread|ERROR|GestioneProdottiView.<init>() Errore creazione tabella
org.eclipse.persistence.exceptions.PersistenceUnitLoadingException:
Exception Description: An exception was thrown while trying to load persistence unit at url: rsrc:../
Internal Exception: Exception [EclipseLink-30004] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while processing persistence.xml from URL: rsrc:../
Internal Exception: java.net.MalformedURLException
at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionLoadingFromUrl(PersistenceUnitLoadingException.java:100) ~[jar:rsrc:org.eclipse.persistence.core-2.6.0.jar!/:?]
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceArchive(PersistenceUnitProcessor.java:616) ~[jar:rsrc:org.eclipse.persistence.jpa-2.6.0.jar!/:?]
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.getPersistenceUnits(PersistenceUnitProcessor.java:500) ~[jar:rsrc:org.eclipse.persistence.jpa-2.6.0.jar!/:?]
at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.findPersistenceUnitInfoInArchive(JPAInitializer.java:178) ~[jar:rsrc:org.eclipse.persistence.jpa-2.6.0.jar!/:?]
at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.findPersistenceUnitInfoInArchives(JPAInitializer.java:160) ~[jar:rsrc:org.eclipse.persistence.jpa-2.6.0.jar!/:?]
at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.findPersistenceUnitInfo(JPAInitializer.java:141) ~[jar:rsrc:org.eclipse.persistence.jpa-2.6.0.jar!/:?]
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:183) ~[jar:rsrc:org.eclipse.persistence.jpa-2.6.0.jar!/:?]
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63) ~[jar:rsrc:hibernate-jpa-2.0-api-1.0.1.Final.jar!/:?]
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47) ~[jar:rsrc:hibernate-jpa-2.0-api-1.0.1.Final.jar!/:?]
at com.cremonaufficio.appbarsangiorgio.backend.database.DaoBase.<init>(DaoBase.java:34) ~[rsrc:./:?]
at com.cremonaufficio.appbarsangiorgio.frontend.prodotti.GestioneProdottiView.<init>(GestioneProdottiView.java:93) [rsrc:./:?]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_45]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) [?:1.8.0_45]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) [?:1.8.0_45]
at java.lang.reflect.Constructor.newInstance(Unknown Source) [?:1.8.0_45]
at java.lang.Class.newInstance(Unknown Source) [?:1.8.0_45]
at sun.reflect.misc.ReflectUtil.newInstance(Unknown Source) [?:1.8.0_45]
at javafx.fxml.FXMLLoader$InstanceDeclarationElement.constructValue(Unknown Source) [rsrc:./:?]
at javafx.fxml.FXMLLoader$ValueElement.processStartElement(Unknown Source) [rsrc:./:?]
at javafx.fxml.FXMLLoader.processStartElement(Unknown Source) [rsrc:./:?]
at javafx.fxml.FXMLLoader.loadImpl(Unknown Source) [rsrc:./:?]
at javafx.fxml.FXMLLoader.loadImpl(Unknown Source) [rsrc:./:?]
at javafx.fxml.FXMLLoader.load(Unknown Source) [rsrc:./:?]
at com.cremonaufficio.appbarsangiorgio.frontend.main.MainView.<init>(MainView.java:18) [rsrc:./:?]
at com.cremonaufficio.appbarsangiorgio.ApplicationRoot.start(ApplicationRoot.java:60) [rsrc:./:?]
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$159(Unknown Source) [rsrc:./:?]
at com.sun.javafx.application.LauncherImpl$$Lambda$52/1019606772.run(Unknown Source) [rsrc:./:?]
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$172(Unknown Source) [rsrc:./:?]
at com.sun.javafx.application.PlatformImpl$$Lambda$48/672080502.run(Unknown Source) [rsrc:./:?]
at com.sun.javafx.application.PlatformImpl.lambda$null$170(Unknown Source) [rsrc:./:?]
at com.sun.javafx.application.PlatformImpl$$Lambda$50/1955345122.run(Unknown Source) [rsrc:./:?]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_45]
at com.sun.javafx.application.PlatformImpl.lambda$runLater$171(Unknown Source) [rsrc:./:?]
at com.sun.javafx.application.PlatformImpl$$Lambda$49/1936897764.run(Unknown Source) [rsrc:./:?]
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source) [rsrc:./:?]
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) ~[rsrc:./:?]
at com.sun.glass.ui.win.WinApplication.lambda$null$145(Unknown Source) [rsrc:./:?]
at com.sun.glass.ui.win.WinApplication$$Lambda$38/479808962.run(Unknown Source) [rsrc:./:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_45]
Caused by: org.eclipse.persistence.exceptions.PersistenceUnitLoadingException:
Exception Description: An exception was thrown while processing persistence.xml from URL: rsrc:../
Internal Exception: java.net.MalformedURLException
at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionProcessingPersistenceXML(PersistenceUnitLoadingException.java:118) ~[jar:rsrc:org.eclipse.persistence.core-2.6.0.jar!/:?]
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceXML(PersistenceUnitProcessor.java:657) ~[jar:rsrc:org.eclipse.persistence.jpa-2.6.0.jar!/:?]
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceArchive(PersistenceUnitProcessor.java:614) ~[jar:rsrc:org.eclipse.persistence.jpa-2.6.0.jar!/:?]
... 37 more
Caused by: java.net.MalformedURLException
at java.net.URL.<init>(Unknown Source) ~[?:1.8.0_45]
at java.net.URL.<init>(Unknown Source) ~[?:1.8.0_45]
at java.net.URL.<init>(Unknown Source) ~[?:1.8.0_45]
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(Unknown Source) ~[?:1.8.0_45]
at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(Unknown Source) ~[?:1.8.0_45]
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) ~[?:1.8.0_45]
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) ~[?:1.8.0_45]
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source) ~[?:1.8.0_45]
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source) ~[?:1.8.0_45]
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) ~[?:1.8.0_45]
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceXML(PersistenceUnitProcessor.java:655) ~[jar:rsrc:org.eclipse.persistence.jpa-2.6.0.jar!/:?]
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceArchive(PersistenceUnitProcessor.java:614) ~[jar:rsrc:org.eclipse.persistence.jpa-2.6.0.jar!/:?]
... 37 more
Caused by: java.lang.NullPointerException
at java.net.URL.<init>(Unknown Source) ~[?:1.8.0_45]
at java.net.URL.<init>(Unknown Source) ~[?:1.8.0_45]
at java.net.URL.<init>(Unknown Source) ~[?:1.8.0_45]
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(Unknown Source) ~[?:1.8.0_45]
at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(Unknown Source) ~[?:1.8.0_45]
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) ~[?:1.8.0_45]
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) ~[?:1.8.0_45]
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source) ~[?:1.8.0_45]
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source) ~[?:1.8.0_45]
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) ~[?:1.8.0_45]
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceXML(PersistenceUnitProcessor.java:655) ~[jar:rsrc:org.eclipse.persistence.jpa-2.6.0.jar!/:?]
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceArchive(PersistenceUnitProcessor.java:614) ~[jar:rsrc:org.eclipse.persistence.jpa-2.6.0.jar!/:?]
... 37 more
My persistence unit file is
<?xml version="1.0" encoding="UTF-8"?>
<persistence
version="2.1"
xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="default" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>com.cremonaufficio.appbarsangiorgio.backend.database.entity.ProdottoEntity</class>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:h2:~/scanner/database/database" /><!-- ~/ -->
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
<property name="javax.persistence.jdbc.user" value="app" />
<property name="javax.persistence.jdbc.password" value="app1505" />
<property name="eclipselink.logging.level" value="INFO" />
<property name="eclipselink.ddl-generation" value="create-tables" />
</properties>
</persistence-unit>
</persistence>
I guess the problem is the url but even with ./ to point a folder next to jar, it's not working. Any guesses?
I got what was the problem. It turned out to be how I generate the JAR: I had to choose to "Extract required libraries" and not just "Package required libraries".
Cheers.
Caused by: org.hibernate.MappingException: invalid configuration
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2018)
at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:201)
at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:46)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1935)
at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:183)
at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:46)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1914)
at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:177)
at com.isti.client.HibernateUtil.getAnnotationConfiguration(HibernateUtil.java:20)
at com.isti.client.HibernateUtil.getUser(HibernateUtil.java:75)
at com.isti.server.GreetingServiceImpl.getUser(GreetingServiceImpl.java:52)
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 com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:561)
... 22 more!
Caused by: org.xml.sax.SAXParseException; lineNumber: 17; columnNumber: 61; Attribute "value" must be declared for element type "property".
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.addDTDDefaultAttrsAndValidate(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.dom4j.io.SAXReader.read(SAXReader.java:465)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2015)
... 37 more
Here's my hibernate.cfg.xml
<session-factory>
<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
<property name="hibernate.connection.password">root</property>
<property name="hibernate.connection.url">jdbc:postgresql://localhost:5432/LoginForm</property>
<property name="hibernate.connection.username">postgres</property>
<property name="hibernate.default_schema">public</property>
<property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<property name="javax.persistence.validation.mode">none</property>
<property name="show_sql">true</property>
<property name="hibernate.format_sql" value="true"/>
<property name="hbm2ddl.auto">create</property>
<mapping class="com.isti.client.model.User" />
</session-factory>
Doesn't
<property name="show_sql">true</property>
<property name="hibernate.format_sql" value="true"/>
looks inconsistent ? In particular the absence of the value attribute doesn't look right.
Im trying to run a java desktop application which accesses a MSSQL server using hibernate, but when trying to connect, it throws an exception and i really dont know what to do, here is my config file
<?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">
<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>
<session-factory>
<property name="connection.username"></property>
<property name="connection.password"></property>
<property name="connection.url">
jdbc:jtds:sqlserver://localhost/databasename;useNTLMv2=true
</property>
<property name="dialect">
ba.fit.utilities.FDialect_SqlServer
</property>
<property name="myeclipse.connection.profile">nova 3</property>
<property name="connection.driver_class">
net.sourceforge.jtds.jdbc.Driver
</property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>
<!-- Opcije printanja SQL koda u konzolnom prozoru-->
<property name="show_sql">true</property>
<property name="format_sql">false</property>
<property name="use_sql_comments">false</property>
<!--vrijednost "update" kreira tabele ako nepostoje, ali ih nece mijenjati ako ima potrebe-->
<property name="hibernate.hbm2ddl.auto">update</property>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">
org.hibernate.cache.NoCacheProvider
</property>
<!-- mapirane klase koje trebaju biti "persistence" -->
<!--
-->
<mapping class="ba.fit.Tomo_seminar.model.Administrator" />
<mapping class="ba.fit.Tomo_seminar.model.BiografijaPosloprimca" />
<mapping class="ba.fit.Tomo_seminar.model.BiografijaPoslodavca" />
<mapping class="ba.fit.Tomo_seminar.model.Drzava" />
<mapping class="ba.fit.Tomo_seminar.model.Grad" />
<mapping class="ba.fit.Tomo_seminar.model.Kategorija" />
<mapping class="ba.fit.Tomo_seminar.model.KategorijaBiografija" />
<mapping class="ba.fit.Tomo_seminar.model.OcjenePoslodavca" />
<mapping class="ba.fit.Tomo_seminar.model.OcjenePosloprimca" />
<mapping class="ba.fit.Tomo_seminar.model.Poslodavac" />
<mapping class="ba.fit.Tomo_seminar.model.Posloprimaoc" />
<mapping class="ba.fit.Tomo_seminar.model.Projekt" />
<mapping class="ba.fit.Tomo_seminar.model.ProjektKategorija" />
<mapping class="ba.fit.Tomo_seminar.model.Racun" />
<mapping class="ba.fit.Tomo_seminar.model.StatusTuzbe" />
<mapping class="ba.fit.Tomo_seminar.model.StrucnaSprema" />
<mapping class="ba.fit.Tomo_seminar.model.Tuzba" />
<mapping class="ba.fit.Tomo_seminar.model.Uplatnica" />
<mapping class="ba.fit.Tomo_seminar.model.ZahtjevZaRadNaProjektu" />
<mapping class="ba.fit.Tomo_seminar.model.RadnoVrijeme" />
</session-factory>
</hibernate-configuration>
but i get this exception
20:52:43,562 WARN SettingsFactory:109 - Could not obtain connection 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:110)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:76)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1933)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1216)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)
at ba.fit.utilities.HibernateUtil.<clinit>(HibernateUtil.java:24)
at ba.fit.Tomo_seminar.persistence.PosloprimaocDAO.pronadji(PosloprimaocDAO.java:17)
at ba.fit.Tomo_seminar.services.servLogin.LoginPosloprimaoc(servLogin.java:31)
at ba.fit.imeprojekta.ui.gui.v1.FrmLogin.do_btnLogin_widgetSelected(FrmLogin.java:142)
at ba.fit.imeprojekta.ui.gui.v1.FrmLogin$1.widgetSelected(FrmLogin.java:92)
at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
at ba.fit.imeprojekta.ui.gui.v1.FrmLogin.main(FrmLogin.java:44)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(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)
... 20 more
20:52:46,015 ERROR SchemaUpdate:134 - could not get database 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:110)
at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:27)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:127)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:314)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1218)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)
at ba.fit.utilities.HibernateUtil.<clinit>(HibernateUtil.java:24)
at ba.fit.Tomo_seminar.persistence.PosloprimaocDAO.pronadji(PosloprimaocDAO.java:17)
at ba.fit.Tomo_seminar.services.servLogin.LoginPosloprimaoc(servLogin.java:31)
at ba.fit.imeprojekta.ui.gui.v1.FrmLogin.do_btnLogin_widgetSelected(FrmLogin.java:142)
at ba.fit.imeprojekta.ui.gui.v1.FrmLogin$1.widgetSelected(FrmLogin.java:92)
at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
at ba.fit.imeprojekta.ui.gui.v1.FrmLogin.main(FrmLogin.java:44)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(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)
... 21 more
20:52:46,015 ERROR SchemaUpdate:165 - could not complete schema update
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:110)
at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:27)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:127)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:314)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1218)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)
at ba.fit.utilities.HibernateUtil.<clinit>(HibernateUtil.java:24)
at ba.fit.Tomo_seminar.persistence.PosloprimaocDAO.pronadji(PosloprimaocDAO.java:17)
at ba.fit.Tomo_seminar.services.servLogin.LoginPosloprimaoc(servLogin.java:31)
at ba.fit.imeprojekta.ui.gui.v1.FrmLogin.do_btnLogin_widgetSelected(FrmLogin.java:142)
at ba.fit.imeprojekta.ui.gui.v1.FrmLogin$1.widgetSelected(FrmLogin.java:92)
at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
at ba.fit.imeprojekta.ui.gui.v1.FrmLogin.main(FrmLogin.java:44)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(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)
... 21 more
20:52:47,328 WARN JDBCExceptionReporter:71 - SQL Error: 0, SQLState: 08S01
20:52:47,328 ERROR JDBCExceptionReporter:72 - Network error IOException: Connection refused: connect
Seems connection.url has an issue. Correct url would be
<property name="hibernate.connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
<property name="hibernate.connection.url">jdbc:sqlserver://machine:1433;databaseName=databaseName;</property>