Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!

Lucas Smith

Ranch Hand
+ Follow
since Apr 20, 2009
Lucas likes ...
Android Eclipse IDE Java
Poland
Cows and Likes
Cows
Total received
1
In last 30 days
0
Total given
0
Likes
Total received
9
Received in last 30 days
0
Total given
3
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Lucas Smith

Hi guys!

I started playing with Java8 and I encountered one interesting issue. Please look at the following code:



It compiles without any problem.

Now, let's consider that:



and the result is:



What is the reason for that?

I also tried:



but it gave me nothing.
4 years ago
StackTrace or nothing happened ;).
4 years ago
My guess is that the HTTP connections are pooled and reused and the software is not able to detect the broken connections.

According to https://axis.apache.org/axis2/java/core/docs/http-transport.html

CommonsHTTPTransportSender utilizes HttpClient. Here you have some configuration description:

http://hc.apache.org/httpclient-3.x/threading.html

connectionStaleCheckingEnabled
maxConnectionsPerHost
maxTotalConnections

given that you use MultiThreadedHttpConnectionManager. Anyhow, make sure that Stale Connection check is activated:

http://hc.apache.org/httpclient-3.x/preference-api.html -> http.connection.stalecheck

You will probably need to configure HttpClient through Axis interface.
4 years ago
OK, we are sure that your DB is accessible from the code.

You gave us the exception:
org.springframework.transaction.CannotCreateTransactionException : Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Cannot open connection
null

Please paste the full stack trace despite the fact that it can be very long.
You have typed:

java -cp c:\test\postgresql-8.1-404.jdbc3.jar;c:\testJDBCExample

You SHOULD type:

java -cp c:\test\postgresql-8.1-404.jdbc3.jar;c:\test JDBCExample


You have typed BAD command once again. Please, stay focused and type:

java -cp c:\test\postgresql-8.1-404.jdbc3.jar;c:\test JDBCExample

Pay attention to every single sign and space!
You should try this:
C:\test>java -cp c:\test\postgresql-8.1-404.jdbc3.jar;c:\test JDBCExample

NOT
C:\test>java -cp c:\test\postgresql-8.1-404.jdbc3.jar;c:\test\JDBCExample.java
AND NOT
C:\test>java -cp c:\test\postgresql-8.1-404.jdbc3.jar;c:\test\JDBCExample
No, because you do not have space between your classpath and Main class. You have just specified classpath.
You have executed it incorrectly. You should give the name of the Main class:

C:\test>java -cp c:\test\postgresql-8.3-603.jdbc4.jar;c:\test JDBCExample

Where JDBCExample is the class with main method.
Yes, I know, but we have to examine if there is any problem in the lower layer.

Please, include the whole stacktrace, not just selected pieces.
Try if you can create DB connection with plain JDBC:
http://www.mkyong.com/jdbc/how-do-connect-to-postgresql-with-jdbc-driver-java/

Please, include the whole stacktrace, not just selected pieces.
Post the code that tries to open hibernate session.
You should not create threads within EJBs. Instead you can inject EJB in your interceptor and invoke a method from injected EJB that is annotated with @Asynchronous.