On IntelliJ, how to run JDBC connection on starting Glassfish - java

In Intellij Idea 12, i'm trying to start glassfish and deploy my application.
I got that error: rg.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Connection could not be allocated because: java.net.ConnectException. Port 1527 closed.
But when I run the same project in Netbeans, I see that Netbeans start the connection on 1527 before starting Glassfish. And the option is checked: "Enable JDBC Driver Deployment".
How can I do the same in Intellij?
Thanks in advance

That was due to the Apache derby server that wasn't running.
I need to run before the script "startNetworkServer" from derby driver to make it work

Related

Netbeans cannot establish a connection to jdbc

I'm trying to create a JDBC connection between a project in Netbeans and a MySQL database. In the Netbeans connection wizard I receive the following
error: Cannot establish a connection to jdbc:mysql://localhost:3306/murach using com.mysql.jdbc.Driver (Unable to load authentication plugin 'caching_sha2_password'.)
I'm running Netbeans 8.2, MySQL 8.0.15 and Java JDK 1.8.0_201. I am able to connect to the database using the credentials supplied in the wizard via the command prompt.
I also confirmed that port 3306 is open in Windows Firewall.
make the driver something like com.mysql5.jdbc.Driver

why i get Error running 'JBoss 11.0.0.Final': Unable to open debugger port (127.0.0.1:56884): java.net.SocketException "socket closed"?

I use latest intellij idea ultimate with wildfly 11 and i develop web application with maven and java 8.
when i run debug i get following error.
Error running 'JBoss 11.0.0.Final': Unable to open debugger port (127.0.0.1:56884): java.net.SocketException "socket closed"
when i run application i get
Error running 'JBoss 11.0.0.Final': Address 127.0.0.1:9990 is already in use
iI did changed the port to 9991 in standalone.xml and got the following error:
Application Server was not connected before run configuration stop, reason: Unable to ping server at localhost:8080
Does any one know what am i missing?

Java DB doesn't run without NetBean [duplicate]

I have a Java application, which uses Apache Derby. Using Eclipse Export option, I exported it as JAR file. When I am running Eclipse, and the server is connected to port 1527, the JAR executes correctly.
However when eclipse is closed, (and the server is not connected to 1527) on executing jar, i get this error
java.sql.SQLNonTransientConnectionException: java.net.ConnectException
: Error connecting to server localhost on port 1527 with message
Connection refused.
This is understandable. But i want to distribute the JAR. So is there a way to start the server programmatically, whenever JAR is executed?
You can start the NetworkServer programmatically:
NetworkServerControl serverControl = new NetworkServerControl(InetAddress.getByName("myhost"),1621)
serverControl.shutdown();
Simplest is to use embedded Derby
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
conn = DriverManager.getConnection("jdbc:derby:" + DATA_STORE + ";create=true");
You need to start the server programmatically.
How this is done is documented in the manual:
http://db.apache.org/derby/docs/10.8/adminguide/tadminconfig814963.html

Eclipse : Failed to connect to remote VM. Connection refused. [duplicate]

This question already has answers here:
Eclipse Error: "Failed to connect to remote VM"
(26 answers)
Closed 9 years ago.
When ever i tried to launch my eclipse debug(for server side code) i'm getting the following error Failed to connect to remote VM. Connection refused.
What's the problem may be? I already tried with most of the solutions out in the web but none of that solved my issue. Could any one can assist me to fix this? Advance thanks..
when you have Failed to connect to remote VM Connection refused error, restart your eclipse
Which server are you using?
Like already said:
In your debug configuration you'll have to define the right port of your server (GF:9009 / Tomcat:8000)
You'll have to set the JVM property of the server to debug
For Glassfish:
Log in to admin-console > Configurations > server-config > JVM-Settings > check DEBUG checkbox > restart server
For Tomcat:
create file debug.bat/.sh (depending on your OS) in %TOMCAT_HOME%/bin directory and write
set JPDA_ADDRESS=8000
set JPDA_TRANSPORT=dt_socket
catalina.bat jpda start
in it.
After you've created this file start server by executing debug.bat/.sh.
Now you should be able to debug remotely in Eclipse after you set the necessary properties in your debug configuration.
Hope this helped! Have Fun!
EDIT
If you're running tomcat in a Win environment as a service you don't have a catalina.bat file in the bin-directory of your tomcat installation.
To set your server into debug-mode please try the following:
Run the Configuration option in Windows Menu or run %catalina_home%/bin/tomcat6w.exe
In Java tab, add this line to Java:
options:-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
Sometimes the port which you are trying to access, gets occupied and won't be released.
Try some tools to find whether the port is in use or not.
I also faced the same issue. I tried giving different port numbers but unfortunately it didn't work. I tried restarting the system (not the application server), and it worked :)
I faced the same issue. But i resolved it by changing my port numbers to different one.
The port number in the Eclipse configuration and the port number of
your application might not be the same.
You might not have been started your application with the right
parameters.
Those are the simple problems when I have faced "Connection refused" error.
As suat said, most of the time the connection refused is due to the fact that the port you set up is in use or there is a difference between the port number in your remote application debugging configuration in Eclipse and the port number used in the address attribute in
-Xrunjdwp:transport=dt_socket,address=1044,server=y,suspend=n.
Check those things. Thanks!
If you need to debug an application working on Tomcat, make sure that your Tomcat-folder/bin/startup.bat (if using windows) contains the following lines:
set JPDA_TRANSPORT="dt_socket"
set JPDA_ADDRESS=8000
call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%
I ran into this problem debugging play framework version 2.x, turned out the server hadn't been started even though the play debug run command was issued. After a first request to the webserver which caused the play framework to really start the application at port 9000, I was able to connect properly to the debug port 9999 from eclipse.
[info] play - Application started (Dev)
The text above was shown in the console when the message above appeared, indicating why eclipse couldn't connect before first http request.

Could not connect to New SQL Server in eclipse

Connecting/pinging a database in eclipse gives me error:
My software is: MySql Server 5.5.12, Connector/J 5.1.17, Eclipse IDE for Java EE Developers v. 1.4.0.20110615-0550.
Logging from console or phpmyadmin works ok.
Here is also screenshot of connection settings:
Any suggestions about this error?
You are loading a MSSQL driver, but you are running a MySQL server.
http://www.mysql.com/products/connector/
change the driver to Mysql driver 5.0 and it will connect properly

Categories