Win a copy of AWS Security this week in the Cloud/Virtualization forum!

Lucas Smith

Ranch Hand
+ Follow
since Apr 20, 2009
Lucas likes ...
Android Eclipse IDE Java
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
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.
5 years ago
StackTrace or nothing happened ;).
5 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

CommonsHTTPTransportSender utilizes HttpClient. Here you have some configuration description:


given that you use MultiThreadedHttpConnectionManager. Anyhow, make sure that Stale Connection check is activated: -> http.connection.stalecheck

You will probably need to configure HttpClient through Axis interface.
5 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

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

C:\test>java -cp c:\test\postgresql-8.1-404.jdbc3.jar;c:\test\
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:

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.