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.
Related
I have a Java multithread application that connects to the web. After I start some number of threads, if I run it from an executable jar, the application hangs. If I run it from Eclipse it works perfectly.
This is the instruction that connects to the web:
Jsoup.connect(url).header("Cache-Control", "no-cache").header("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0").header("Connection", "keep-alive").get();
These are the exceptions I get when it's run from the jar:
Remote host closed connection during handshake
javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(Unknown Source)
at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:730)
at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:706)
at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:299)
at org.jsoup.helper.HttpConnection.get(HttpConnection.java:288)
at borsa.fetchers.FetcherThread.run(FetcherThread.java:23)
Caused by: java.io.EOFException: SSL peer shut down incorrectly
at sun.security.ssl.InputRecord.read(Unknown Source)
... 12 more
.
Software caused connection abort: socket write error
java.net.SocketException: Software caused connection abort: socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(Unknown Source)
at java.net.SocketOutputStream.write(Unknown Source)
at sun.security.ssl.OutputRecord.writeBuffer(Unknown Source)
at sun.security.ssl.OutputRecord.write(Unknown Source)
at sun.security.ssl.SSLSocketImpl.writeRecordInternal(Unknown Source)
at sun.security.ssl.SSLSocketImpl.writeRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.writeRecord(Unknown Source)
at sun.security.ssl.Handshaker.sendChangeCipherSpec(Unknown Source)
at sun.security.ssl.ClientHandshaker.sendChangeCipherAndFinish(Unknown Source)
at sun.security.ssl.ClientHandshaker.serverHelloDone(Unknown Source)
at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)
at sun.security.ssl.Handshaker.processLoop(Unknown Source)
at sun.security.ssl.Handshaker.process_record(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source)
at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:734)
at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:706)
at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:299)
at org.jsoup.helper.HttpConnection.get(HttpConnection.java:288)
at borsa.fetchers.FetcherThread.run(FetcherThread.java:23)
.
Software caused connection abort: recv failed
java.net.SocketException: Software caused connection abort: recv failed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at sun.security.ssl.InputRecord.readFully(Unknown Source)
at sun.security.ssl.InputRecord.read(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(Unknown Source)
at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:730)
at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:706)
at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:299)
at org.jsoup.helper.HttpConnection.get(HttpConnection.java:288)
at borsa.fetchers.FetcherThread.run(FetcherThread.java:23)
Why does it happen? How to solve it? Why this different behaviour between jar and IDE?
EDIT answer to #Wojciech Piotrowiak
Eclipse console output: https://text-share.com/view/22a1e492
Dos console output: https://text-share.com/view/a684f1bd They seem to do same things...?
Please run both ways with: -Djavax.net.debug=all flag to get more details.
Try to compare all JVM parameters of running application between eclipse and JAR.
There might be many reasons, maybe eclipse have specific configuration that is not set when running from Jar.
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 have a mysql database created on a raspberry pi, I want to access it through a java application running on a laptop in the same local network.
I tried connecting that same application with another database on another computer on the network and it worked. I don't know why it isn't working with the RPI.
i connect through the following command:
String URL = "jdbc:mysql://192.168.11.157/DB_name";
try {
connection = DriverManager.getConnection(URL, USER, PASSWORD);
} catch (SQLException e) {
e.printStackTrace();
}
However, an exception is thrown and ERROR: Unable to Connect to Database. is printed to the console.
Edit:
Knowing that:
* I can access the database through a local app running on the same raspberry pi (i used #local).
* Can Successfully ping & SSH with the raspberry pi, even run the program mentioned in the previous point through the SSH and it works fine.
The stack trace:
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.<init>(MysqlIO.java:358)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2489)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2526)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2311)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:834)
at com.mysql.jdbc.JDBC4Connection.<init>(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 java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.climacon.jdbc.db.JDBCMySQLConnection.createConnection(JDBCMySQLConnection.java:42)
at com.climacon.jdbc.db.JDBCMySQLConnection.getConnection(JDBCMySQLConnection.java:51)
at com.climacon.jdbc.main.ClimaConJDBC.get_Nodeinfo_From_DB(ClimaConJDBC.java:110)
at com.climacon.gui.ClimaCon2$5.actionPerformed(ClimaCon2.java:279)
at javax.swing.AbstractButton.fireActionPerformed(Unknown 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.mouseReleased(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(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown 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.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 Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
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)
I think the reason you can not access the remote mysql may be due to the remote access restriction in my.cnf
please check the line
bind-address: is set to 127.0.0.1
under this restriction, you can not connect remotely with that mysql server;
to solve this, you need to change this line to:
bind-address: 0.0.0.0
in addition you should specify the port for connection as below:
String URL = "jdbc:mysql://192.168.11.157:3306/DB_name";
because mysql will connect port 3306 in default.
wish my answer could help you!
You have to check the next things:
Is the database active? Does it respond to another application except yours?
Is the network connection OK (eg firewall)?
Check the connection strings (perhaps the port is necessairy but I am not sure).
I am not really familiar with the raspberry. It seems that it's using a linux operating system (correct me if I am wrong). In this post, instruction are given on how to disable firewall on the device. It says that the firewall is the usual iptables firewall used on linux systems. I find this iptables tutorial (based on ubuntu) very useful. Perhaps it would give you some guidance.
Hope I helped!
You may be able to ping the raspberry pi but I am not sure what the interface used is.
Why don't you use MySQL Ping and see if it is responding?
Else it must be a network issue. Get it resolved and then connect. No alternatives for this.
You can issue a light weight ping to your database server to check the connection availability.
Please read following discussion and articles:
Ping MySQL Server
Ping syntax and example
My answer to one of such Communication link failures.
Solved:
Go into the my.cnf file (sudo nano /etc/mysql/my.cnf) file and
look for "bind-address" and make it “bind-address = * “
Reload MySQL config (sudo service mysql reload)
Restart MySQL server (sudo service mysql restart)
The url "jdbc:mysql://localhost:3306/mydb".
You lost the port 3306.
you need to print the exception to the console ,rather than print a customer "error",If you do
as that ,you can't get the key of the problem
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?
I followed this step for configuration http://jmeter.apache.org/usermanual/remote-test.html
The 2 machines are on same subnet.
They can ping each other
Windows firewall is turned off
When I execute remote start its give a "Connection refused" exception.
error log
2011/12/07 13:39:37 ERROR - jmeter.gui.action.RemoteStart: Failed to initialise remote engine java.rmi.ConnectException: Connection refused to host: 198.168.137.4; 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.newCall(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Unknown Source)
at org.apache.jmeter.engine.ClientJMeterEngine.getEngine(ClientJMeterEngine.java:56)
at org.apache.jmeter.engine.ClientJMeterEngine.<init>(ClientJMeterEngine.java:69)
at org.apache.jmeter.gui.action.RemoteStart.doRemoteInit(RemoteStart.java:176)
at org.apache.jmeter.gui.action.RemoteStart.doAction(RemoteStart.java:79)
at org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:82)
at org.apache.jmeter.gui.action.ActionRouter.access$000(ActionRouter.java:42)
at org.apache.jmeter.gui.action.ActionRouter$1.run(ActionRouter.java:61)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(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 Source)
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: 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.<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)
... 27 more
Check whether your RMI port on your other machine(s) is closed? jMeter uses 1099 by default.
Use cmd and type:
telnet [ip-address] 1099
You, of course, started the jMeter server on all machines, right?
this problem is resolve
my computer is connected to the internet and when i start jmeter-server its start on public ip.
my ip is 192.168.137.1 but some how its start on my public ip when i check on google with my public ip is same
i stop internet and start jmeter-serrver again its working
thanks