JDBC not working on production server [closed] - java

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I have jdbc and hibernate working just fine on my local web app, but when I deploy it to a remote server, I get this error:
HTTP Status 401 - Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.JDBCConnectionException: Could not open connection
The server is on the same machine as the mysql database. Could that be a problem? If not, what could it be?

It is no problem to have application and database on one machine. Check the connection string of the database for IP/hostname, user name, password and database port in related configuration file or JNDI resource. There is more information needed to put specific answer. The driver may also be the problem here.

Related

Access Denied (authentication_falied) Issue in Java web application [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 days ago.
Improve this question
Your credentials could not be authenticated: "Credentials are missing.
You will not be permitted access until your credentials can be
verified.
This is typically caused by an incorrect username and/or password; but
could also be caused by network problems.
Above error is intermittently appearing in a Java web application hosted in Tomcat on a Windows 10 machine that communicates to a internet server through a proxy server. The proxy server requires authentication which is passed by the application code. The Windows machine is in an Active Directory domain.
The surprising part is that whenever such error occurs logging into the Windows machine resolves the issue.
Looking for a permanent solution where the application runs without having to log into the Windows machine.
I tried keeping the machine power mode active, so that it doesn't go into sleep mode, but still issue not resolved.

HTTP Proxy - upstream connect error or disconnect/reset before headers. reset reason: protocol error [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 months ago.
Improve this question
I created two spring boot application one serving APIs and another acting as a HTTP proxy to that API (which internally uses CloseableHttpClient to bounce on the another url, fetches the data adds cors and pushes back the response.)
I deployed both into GCP cloud run but when I run it locally it works but not when using the cloud run endpoint.
It resulting in error like this -
upstream connect error or disconnect/reset before headers. reset reason: protocol error
What it is I am messing up ?

RMI Remote connection fails [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
I have a very simple RMI server/client that works fine on the same machine. I'm trying to now execute the server on one machine and client on another both are on the same network. I've set the property to network ip using:
System.getProperty("java.rmi.server.hostname", "192.168.x.x");
& disabled firewall on both machines but connection still fails.
Client code uses this to connect to server (the server uses createRegistry on 8888):
Registry registry = LocateRegistry.getRegistry("192.168.x.x",8888);
ITest stub = (ITest) registry.lookup("ITest");
However the execption being caught seems to show an IP not the same as the one given eg 192.168.x.x vs 169.254.x.x:
Client exception: java.rmi.ConnectionException: Connection refused to host: 169.254.x.x; nested exception is ...
As dave_thompson_085 said I was calling System.getProperty which was a typo that I completely missed. Calling System.setProperty corrects this problem and now works.
There could be couple of reasons for this exception:
You have not started your rmiregistry in background.
You are trying to connect to the wrong port number.
Your firewall maybe blocking the connections.
Also make sure to check and disable any routers firewall restriction if any.

mySQL server and Java application [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Ok, so I am a little bit stuck with this problem and could really use some guidance...I have a java application that I have written in Java on eclipse and I also have a database created in mySQL on the same computer, now say I want to copy my java application to another computer on a different network but connect to that same database on my original computer on mySQL, what modifications do I have to make so I can connect to my database on different networks and areas? any guidance or help would be greatly appreciated. Beginner in Java and Databases so please try to explain thoroughly.
Since you use a pure JDBC application you simply need to set the JDBC URL to match with your requirements knowing that the format is something like:
jdbc:mysql://[host1][:port1][,[host2][:port2]]...[/[database]][?propertyName1=propertyValue1[&propertyName2=propertyValue2]...]
So assuming that your hostname is foo and the port is 3306, the first thing that you will have to do is to change the current JDBC URL of your application for something like jdbc:mysql://foo:3306 (assuming that your host is accessible from the other computer and you configured your firewall to accept connections on the port of your database).
More info here
For the second part of the job to do (assuming that you have a static IP address), you will need to configure a port forwarding rule at your internet modem level such that any access to your public IP on a given port will be directly routed to the local IP address of your machine on the mysql port. Check the documentation of your modem to know how to do such thing. Here is more info about port forwarding

Does HttpsURLConnection support IPv6? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I cannot connect to a IPv6 server through HttpsURLConnection, getInputStream() returns null when I sent a request.
I didn't find any useful information: Android developer guide said HttpURLConnection can transparent support IPv6, but didn't mention HttpsURLConnection can support IPv6 or not. Does anyone have experience about this?
Update - 1:
On server side I found a error log when connection failed:
[error] Hostname [xxxx:xxxx:x:xx::xxx] provided via SNI and
hostname xxxx:xxxx:x:xx::xxx provided via HTTP are different
To connect to same IPv6 Apache server (version 2.2.27), Apache HttpClient works without any problem, but HttpsURLConnection doesn't. So it may not be a server side issue. Does anyone see this error before when using HttpsURLConnection?
Java supports IPv6, and has done for many years. HttpsURLConnection supports whatever Java supports.
You might also have noticed that HttpsURLConnection extends HttpURLConnection.

Categories