I have built a simple application which connects database made in derby(Netbeans) which binds with a jTable, using java persistence, entity manager. The problem is that when i run the .jar file on some other system it does not execute. Can anyone tell me why does it happen?
Error when running it on some other system:
C:\>java -jar persist.jar
[EL Info]: 2013-01-08 17:06:45.715--ServerSession(4597467)--EclipseLink, version
: Eclipse Persistence Services - 2.3.2.v20111125-r10461
[EL Severe]: 2013-01-08 17:06:48.24--ServerSession(4597467)--Exception [EclipseL
ink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.p
ersistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLNonTransientConnectionException: java.net.Connec
tException : Error connecting to server localhost on port 1527 with message Conn
ection refused: connect.
Error Code: 40000
Exception in thread "AWT-EventQueue-0" javax.persistence.PersistenceException: E
xception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r104
61): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLNonTransientConnectionException: java.net.Connec
tException : Error connecting to server localhost on port 1527 with message Conn
ection refused: connect.
Error Code: 40000
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(En
tityManagerSetupImpl.java:517)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.get
DatabaseSession(EntityManagerFactoryDelegate.java:188)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.cre
ateEntityManagerImpl(EntityManagerFactoryDelegate.java:277)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createE
ntityManagerImpl(EntityManagerFactoryImpl.java:294)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createE
ntityManager(EntityManagerFactoryImpl.java:272)
at persist.NewJFrame.initComponents(NewJFrame.java:30)
at persist.NewJFrame.<init>(NewJFrame.java:17)
at persist.NewJFrame$1.run(NewJFrame.java:101)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Sour
ce)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v2
0111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLNonTransientConnectionException: java.net.Connec
tException : Error connecting to server localhost on port 1527 with message Conn
ection refused: connect.
Error Code: 40000
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(Dat
abaseException.java:324)
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(Dat
abaseException.java:319)
at org.eclipse.persistence.sessions.DefaultConnector.connect(DefaultConn
ector.java:138)
at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(
DatasourceLogin.java:162)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAn
dDetectDatasource(DatabaseSessionImpl.java:584)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.log
in(EntityManagerFactoryProvider.java:206)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(En
tityManagerSetupImpl.java:488)
... 21 more
Caused by: java.sql.SQLNonTransientConnectionException: java.net.ConnectExceptio
n : Error connecting to server localhost on port 1527 with message Connection re
fused: connect.
at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unkn
own Source)
at org.apache.derby.client.am.SqlException.getSQLException(Unknown Sourc
e)
at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.eclipse.persistence.sessions.DefaultConnector.connect(DefaultConn
ector.java:98)
... 25 more
Caused by: org.apache.derby.client.am.DisconnectException: java.net.ConnectExcep
tion : Error connecting to server localhost on port 1527 with message Connection
refused: connect.
at org.apache.derby.client.net.NetAgent.<init>(Unknown Source)
at org.apache.derby.client.net.NetConnection.newAgent_(Unknown Source)
at org.apache.derby.client.am.Connection.<init>(Unknown Source)
at org.apache.derby.client.net.NetConnection.<init>(Unknown Source)
at org.apache.derby.client.net.NetConnection40.<init>(Unknown Source)
at org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConne
ction(Unknown Source)
... 29 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
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 java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at javax.net.DefaultSocketFactory.createSocket(Unknown Source)
at org.apache.derby.client.net.OpenSocketAction.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 35 more
Take a look at this SO question. Seems like a similar problem (namely, the dependency jar(s) are probably not on the classpath).
EDIT
Since you posted the stack trace, it's pretty obvious now that you have some DB connection problems:
java.net.ConnectException : Error connecting to server localhost on port 1527 with messageConnection refused: connect.
Did you check if the database is up & running properly on that other system?
Check the database url in your persistence.xml
<properties>
<property name="javax.persistence.jdbc.password" value="sa"/>
<property name="javax.persistence.jdbc.user" value="sa"/>
<property name="javax.persistence.jdbc.driver"
value="org.apache.derby.jdbc.ClientDriver"/>
<property name="javax.persistence.jdbc.url" value="jdbc:derby://??:1527/??"/>
</properties>
Netbeans assigns default location when you are running app inside netbeans where your db is created. I suggest you to pass url as parameter for creating entity manager factory or have it in a property file and load it.
java -jar project.jar persistence.properties
Related
So i have read up on similar questions but i haven't found anything that i fully understand yet.
http://www.coderanch.com/t/487650/java/java/java-rmi-ConnectException-Connection-refused
http://protegewiki.stanford.edu/wiki/Troubleshooting_Client_Server_Connections
what is RMI registry
http://docs.oracle.com/javase/7/docs/technotes/guides/rmi/faq.html#domain
I have a server which is crashing every few days and I am trying to work out where the problem lies. The software is running in an environment supplied by the customer and i need to know if we are the problem or windows/the network.
My question is... RMI registry, Is that something that java creates or is it something that exists in windows anyway? Why would a connection to localhost suddenly become unavailable or refused? Is there anything that i can do to troubleshoot immediately?
The RMI configuration is here:
<RMIService>
<class>com.s.i.system.RMIService</class>
<server name="Server">
<host>localhost</host>
<timeout>0</timeout>
</server>
</RMIService>
Here is the error that is created in the logs.
2015-04-02 16:52:10,057 ERROR [main] com...........gui.initialise.ClientInitialise - java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
at sun.rmi.server.UnicastRef.newCall(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Unknown Source)
at com.s.i.system.RMIService.lookup(RMIService.java:570)
at com.s.i.system.RMIService.lookupServer(RMIService.java:377)
at com.s.i.process.RemoteRequestHandler$Dispatcher.run(RemoteRequestHandler.java:282)
at com.s.i.process.RemoteRequestHandler$Dispatcher.start(RemoteRequestHandler.java:269)
at com.s.i.process.RemoteRequestHandler.handle(RemoteRequestHandler.java:96)
at com.s.i.process.RequestDispatcher.dispatch(RequestDispatcher.java:136)
at com.s.i.client.ClientInitialiser.initialiseEnvironment(ClientInitialiser.java:498)
at com.s.i.client.ClientInitialiser.performEnvironmentInit(ClientInitialiser.java:145)
at com.s.i.client.ClientInitialiser.initialise(ClientInitialiser.java:128)
at com.s.i.client.ClientInitialiser.initialise(ClientInitialiser.java:106)
at com.s.i.gui.initialise.ClientInitialise.createInitialiser(ClientInitialise.java:136)
at com.s.i.gui.initialise.ClientInitialise.<init>(ClientInitialise.java:155)
at com.s.i.client.Client.initialise(Client.java:118)
at com.s.i.client.Client.main(Client.java:147)
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 java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source)
... 20 more
The RMI Registry is a component of the JRE, not of Windows. Clearly it is crashing, or far more probably it is being closed down incorrectly for some reason. I've never seen an RMI Registry crash in 18 years.
To monitor and manage routes, we are trying to use JMX with camel.
Our jmxAgent configuration is as follows.
<camelContext xmlns="http://camel.apache.org/schema/spring">
<jmxAgent id="agent"
connectorPort="9999"
createConnector="false"
usePlatformMBeanServer="true"
serviceUrlPath="/jmxrmi/camel"
loadStatisticsEnabled="true"
statisticsLevel="All"/>
<route>
A simple java class is used to connect to the "jmxAgent"
try{
JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://localhost:9999/jndi/rmi://localhost:1099/jmxrmi/camel");
JMXConnector jmxc = JMXConnectorFactory.connect(url);
MBeanServerConnection server = jmxc.getMBeanServerConnection();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
But I'm getting the following exception
java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused: connect]
at javax.management.remote.rmi.RMIConnector.connect(Unknown Source)
at javax.management.remote.JMXConnectorFactory.connect(Unknown Source)
at javax.management.remote.JMXConnectorFactory.connect(Unknown Source)
at com.acme.jmx.bridgeJMXBridge.main(JMXBridge.java:19)
Caused by: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused: connect]
at com.sun.jndi.rmi.registry.RegistryContext.lookup(Unknown Source)
at com.sun.jndi.toolkit.url.GenericURLContext.lookup(Unknown Source)
at javax.naming.InitialContext.lookup(Unknown Source)
at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(Unknown Source)
at javax.management.remote.rmi.RMIConnector.findRMIServer(Unknown Source)
... 4 more
Caused by: java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
at sun.rmi.server.UnicastRef.newCall(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
... 9 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
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 java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source)
... 14 more
Please give me some pointers to solve this issue.
Thanks,
San
You need to set
createConnector="true"
And when you do that, then Camel should log at INFO level the service url you can use from java code or jconsole to connect to it.
I am trying to access a VM from an RMI client in my machine using VM DNS NAME and port 1099 after setting an endpoint with this port but I get a refused to connect to the VM. How can I tackle this problem?
this is the error I got
D:\Dropbox\client\xxxxxxx>java -Djava.rmi.server.hostname=xx.xx.xx.xx -cp . client
java.rmi.ConnectException: Connection refused to host: xx.xx.xx.xx; nested exception is: java.net.ConnectException:
Connection timed out: connect at
sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source) at
sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source) at
sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source) at
sun.rmi.server.UnicastRef.invoke(Unknown Source) at
HelloImpl_Stub.getHelloMessage(Unknown Source) at
client.main(client.java:18)
Caused by: java.net.ConnectException:
Connection timed out: connect at
java.net.DualStackPlainSocketImpl.connect0(Native Method) at
java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) 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
java.net.Socket.connect(Unknown Source) at
java.net.Socket.(Unknown Source) at
java.net.Socket.(Unknown Source) at
sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source) at
sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source) ... 6 more
I am not able to connect with SQL server 2008 R2 using java. The same code is working with SQL server 2005.
I have tried to find out the port and ip for the sqlserver service and it is giving me
ip - 0.0.0.0 and port 1434
I tried to use the same connection string that works in SQL Server 2005, but it won't work for me in SQL Server 2008. Here is my connection string:
conn=DriverManager.getConnection(jdbc:sqlserver://127.0.0.1:1434:DatabaseNameconnect?autoReconnect=true,user, password);
This is the Error:
jdbc:sqlserver://127.0.0.1:1434;DatabaseName=connect;user=falcon;Password=admin
Could not connect to database
com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host has failed. java.net.ConnectException: Connection refused: connect
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.dnb.discovery.connection.ConnectionBean.makeMsSqlConnection(ConnectionBean.java:62)
at com.dnb.discovery.factory.MssqlDAOFactory.<init>(MssqlDAOFactory.java:18)
at com.dnb.discovery.dao.mssqldao.MssqlCompanyDAO.<init>(MssqlCompanyDAO.java:8)
at com.dnb.discovery.relevance.Relevance.modifyRelevanceIndex(Relevance.java:67)
at com.dnb.discovery.relevance.Relevance.calulateRelevanceScore(Relevance.java:36)
at com.dnb.discovery.dao.SolrDAO.readDataFromSolr(SolrDAO.java:222)
at com.dnb.discovery.searchservice.SearchService.buyerTextSearchAnonymous(SearchService.java:124)
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.sun.xml.internal.ws.api.server.InstanceResolver$1.invoke(Unknown Source)
at com.sun.xml.internal.ws.server.InvokerTube$2.invoke(Unknown Source)
at com.sun.xml.internal.ws.server.sei.EndpointMethodHandler.invoke(Unknown Source)
at com.sun.xml.internal.ws.server.sei.SEIInvokerTube.processRequest(Unknown Source)
at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Unknown Source)
at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Unknown Source)
at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Unknown Source)
at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Unknown Source)
at com.sun.xml.internal.ws.server.WSEndpointImpl$2.process(Unknown Source)
at com.sun.xml.internal.ws.transport.http.HttpAdapter$HttpToolkit.handle(Unknown Source)
at com.sun.xml.internal.ws.transport.http.HttpAdapter.handle(Unknown Source)
at com.sun.xml.internal.ws.transport.http.server.WSHttpHandler.handleExchange(Unknown Source)
at com.sun.xml.internal.ws.transport.http.server.WSHttpHandler.handle(Unknown Source)
at com.sun.net.httpserver.Filter$Chain.doFilter(Unknown Source)
at sun.net.httpserver.AuthFilter.doFilter(Unknown Source)
at com.sun.net.httpserver.Filter$Chain.doFilter(Unknown Source)
at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(Unknown Source)
at com.sun.net.httpserver.Filter$Chain.doFilter(Unknown Source)
at sun.net.httpserver.ServerImpl$Exchange.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Any help ?
There are many possibilities for your problem:
Firewall
No TCP/IP connector
some services are not running
Try to connect with the SQL-management Studio to you database. If this works, try to connect with SQL-Authentification over TCP/IP.
update
Take a look at the Documentation at http://msdn.microsoft.com/en-en/library/ms143693(v=sql.90).aspx
One obvious problem is that SQL Server listens on port 1433, not 1434. I've already answered this question elsewhere, but I can't be sure if it's an exact match for your problem because you haven't told us what error message you get.
I have created an application using hibernate... It works fine with database when I run it through Netbeans. But when I build application (using Clean and Build tool) it does not work with database.
Error:
WARNING: SQL Error: 40000, SQLState: 08001
May 21, 2010 4:25:11 PM org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: java.net.ConnectException : Error connecting to server localhost on port
1527 with message Connection refused: connect.
Exception in thread "AWT-EventQueue-0"
org.hibernate.exception.JDBCConnectionException: **Cannot open connection**
at org.hibernate.exception.SQLStateConverter.convert( SQLStateConverter.java:74)
at org.hibernate.exception.JDBCExceptionHelper.conver t(JDBCExceptionHelper.java:43)
at org.hibernate.exception.JDBCExceptionHelper.conver t(JDBCExceptionHelper.java:29)
at org.hibernate.jdbc.ConnectionManager.openConnectio n(ConnectionManager.java:426)
at org.hibernate.jdbc.ConnectionManager.getConnection (ConnectionManager.java:144)
at org.hibernate.jdbc.AbstractBatcher.prepareQuerySta tement(AbstractBatcher.java:139)
at org.hibernate.loader.Loader.prepareQueryStatement( Loader.java:1547)
at org.hibernate.loader.Loader.doQuery(Loader.java:67 3)
at org.hibernate.loader.Loader.doQueryAndInitializeNo nLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:222 0)
at org.hibernate.loader.Loader.listIgnoreQueryCache(L oader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoa der.java:378)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(Que ryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performLis t(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.ja va:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:7 9)
at ajmalispatientdatamanager.StartPage.searchMethod(S tartPage.java:852)
at ajmalispatientdatamanager.StartPage.SearchBtnActio nPerformed(StartPage.java:599)
at ajmalispatientdatamanager.StartPage.access$900(Sta rtPage.java:33)
at ajmalispatientdatamanager.StartPage$8.actionPerfor med(StartPage.java:382)
at javax.swing.AbstractButton.fireActionPerformed(Unk nown Source)
at javax.swing.AbstractButton$Handler.actionPerformed (Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed (Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseRe leased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent( Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(U nknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unkno wn Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilter s(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(U nknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarch y(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.sql.SQLNonTransientConnectionException: java.net.ConnectException :
Error connecting to server localhost on port 1527 with message Connection refused:
connect.
at org.apache.derby.client.am.SQLExceptionFactory40.g etSQLException(Unknown Source)
at org.apache.derby.client.am.SqlException.getSQLExce ption(Unknown Source)
at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.hibernate.connection.DriverManagerConnectionPr
ovider.getConnection(DriverManagerConnectionProvid er.java:110)
at org.hibernate.jdbc.ConnectionManager.openConnectio n(ConnectionManager.java:423)
... 42 more
Caused by: org.apache.derby.client.am.DisconnectException: java.net.ConnectException :
Error connecting to server localhost on port 1527 with message Connection refused:
connect.
at org.apache.derby.client.net.NetAgent.<init>(Unknow n Source)
at org.apache.derby.client.net.NetConnection.newAgent _(Unknown Source)
at org.apache.derby.client.am.Connection.<init>(Unkno wn Source)
at org.apache.derby.client.net.NetConnection.<init>(U nknown Source)
at org.apache.derby.client.net.NetConnection40.<init> (Unknown Source)
at org.apache.derby.client.net.ClientJDBCObjectFactor yImpl40.newNetConnection(Unknown
Source)
... 47 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 java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at javax.net.DefaultSocketFactory.createSocket(Unknow n Source)
at org.apache.derby.client.net.OpenSocketAction.run(U nknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 53 more
Please Help Me.
Please Help Me.
This has no relationship to the jar - rather, it's a database connection privileges issue.
1) the address or account information in your hibernate configuration, which is packaged with the jar- is incorrect or incomplete compared to that used by your working netbeans code.... Are you using the same configration file in your jar as netbeans?
Or
2). You are running the jar from a machine which is not authorized to connect to the database - for example, maybe you are connecting as root from a non root authorized ip address.... Are you running the jar on the same machine which you use netbeans on?