Intermittent PersistenceException/GenericJDBCException in opening Connection (Hibernate, Oracle) - spring

In my Stand One Java Application, we are using Hibernate JPA based Pooled DataSource to connect with Oracle Database. We are intermittently getting the following exception. But on retry it often succeeds to create connection pool. Also, other service(s) which are also accessing same DB server, can create connection pool successfully.
How to address this problem?
Can there be any connection leakage and how to diagnose it?
Exception in thread "main" com.xyz.abc.inf.console.ConsoleException: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
at com.xyz.abc.inf.console.service.GatewayService.postStart(GatewayService.java:104)
at com.xyz.abc.inf.console.service.AbstractLaunchableService.start(AbstractLaunchableService.java:205)
at com.xyz.abc.inf.console.ConsoleLauncher.main(ConsoleLauncher.java:85)
Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1387)
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1310)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:273)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.orm.jpa.SharedEntityManagerCreator$DeferredQueryInvocationHandler.invoke(SharedEntityManagerCreator.java:311)
at $Proxy102.getResultList(Unknown Source)
at com.nrift.finch.inf.domain.repository.RepositoryBase.query(RepositoryBase.java:139)
at com.xyz.abc.inf.domain.dao.jpa.impl.ServiceRouteParticipantDaoImpl.findByServiceId(ServiceRouteParticipantDaoImpl.java:55)
at com.xyz.abc.inf.service.impl.RouteResolverServiceImpl.getRouteByService(RouteResolverServiceImpl.java:21)
at com.xyz.abc.inf.console.service.GatewayService.startCamelContextIfNotStarted(GatewayService.java:143)
at com.xyz.abc.inf.console.service.GatewayService.postStart(GatewayService.java:102)
... 2 more
Caused by: org.hibernate.exception.GenericJDBCException: Could not open connection
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110)
at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:304)
at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:169)
at org.hibernate.engine.jdbc.internal.proxy.ConnectionProxyHandler.extractPhysicalConnection(ConnectionProxyHandler.java:82)
at org.hibernate.engine.jdbc.internal.proxy.ConnectionProxyHandler.continueInvocation(ConnectionProxyHandler.java:138)
at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81)
at $Proxy103.prepareStatement(Unknown Source)
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:147)
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:166)
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:145)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1854)
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1831)
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1811)
at org.hibernate.loader.Loader.doQuery(Loader.java:899)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:341)
at org.hibernate.loader.Loader.doList(Loader.java:2516)
at org.hibernate.loader.Loader.doList(Loader.java:2502)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2332)
at org.hibernate.loader.Loader.list(Loader.java:2327)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:490)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:355)
at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:195)
at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1247)
at org.hibernate.internal.QueryImpl.list(QueryImpl.java:101)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:264)
... 13 more
Caused by: java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106)
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:65)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:527)
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)
at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:70)
at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:292)
Database Server : Oracle 11g
Client configuration :
[root#eighamq1 ~]# uname -a
Linux eighamq1.nrifintech.com 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:39 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
[root#eighamq1 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.5 (Tikanga)
[root#eighamq1 ~]# java -version
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)
[root#eighamq1 ~]# mvn -v
Apache Maven 3.0.4 (r1232337; 2012-01-17 14:14:56+0530)
Maven home: /usr/local/maven-3.0.4
Java version: 1.7.0, vendor: Oracle Corporation
Java home: /usr/java/jdk1.7.0/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.18-194.el5", arch: "amd64", family: "unix"
JDBC.properties
jdbc.database.driverClass = oracle.jdbc.OracleDriver
jdbc.database.url = jdbc:oracle:thin:#172.16.29.92:1521:d11gr21
jdbc.database.initialLimit = 1
jdbc.database.maxLimit = 5
jdbc.database.minLimit = 1
jpa.hibernate.dialectClass = org.hibernate.dialect.Oracle10gDialect
jdbc.database.initialPoolSize = 10
jdbc.database.minPoolSize = 5
jdbc.database.maxPoolSize = 20
jdbc.database.maxStatements = 0
jdbc.database.acquireIncrement = 5
jdbc.database.acquireRetryAttempts = 5
jdbc.database.checkoutTimeout = 1000
Artifacts used :
ojdbc16-11.2.0.1.0.jar
c3p0-0.9.1.1.jar
hibernate-entitymanager : 4.1.12.Final
hibernate-commons-annotations : 4.0.1.Final
hibernate-c3p0 : 4.1.12.Final
hibernate-commons-annotations : 4.0.1.Final
hibernate-jpa-2.0-api : 1.0.1.Final

The oracle thin driver use the Java Security api internally to connect to oracle. Java Security in linux use the /dev/random as Entropy Gathering device and this device in linux sometimes are very slow returning values. It is probable that this is the reason than the connection couldn't be opened fast.
You can change the devices putting this in the command line:
-Djava.security.egd=file:///dev/urandom
With this property you indicate that you can use the /dev/urandom to get random values and this device is very fast because it uses a pseudo random algorithm.
It is good to put this property when you use the Oracle Thin Driver to connect database to improve the performance to connect to database.

Related

Debezium Oracle Connector "No suitable driver found"

When using Oracle Instant Client 21.7 and using the below json being sent to the Debezium connector, the follow error is generated.
Error message:
Caused by: java.sql.SQLException: No suitable driver found for jdbc:oracle:oci:#//<database-host>:<port>/DB
at java.sql.DriverManager.getConnection(DriverManager.java:689)
at java.sql.DriverManager.getConnection(DriverManager.java:208)
at io.debezium.jdbc.JdbcConnection.lambda$patternBasedFactory$0(JdbcConnection.java:191)
at io.debezium.jdbc.JdbcConnection$ConnectionFactoryDecorator.connect(JdbcConnection.java:128)
at io.debezium.jdbc.JdbcConnection.connection(JdbcConnection.java:882)
at io.debezium.jdbc.JdbcConnection.connection(JdbcConnection.java:877)
at io.debezium.jdbc.JdbcConnection.queryAndMap(JdbcConnection.java:630)
at io.debezium.jdbc.JdbcConnection.queryAndMap(JdbcConnection.java:504)
at io.debezium.connector.oracle.OracleConnection.resolveOracleDatabaseVersion(OracleConnection.java:141)
... 71 more
openjdk version "1.8.0_332"
OpenJDK Runtime Environment (build 1.8.0_332-b09)
OpenJDK 64-Bit Server VM (build 25.332-b09, mixed mode)
Running a later version of Java, the driver worked, but the connector still throws that error.
I've moved the drivers into the correct location, as mentioned here but still no dice.

FileNet Configuration Manager fails to connect to WebSphere Application Server

I have an issue with FileNet configuration manager connecting to WAS when configuring CPE. Details are below
OS : Windows 10 Enterprise (This is where CPE 5.5 is installed)
WAS : 8.5.5.13
WAS Java : 1.8_64_bundled
FN Config Details
I'm able to login to WAS console and the SOAP port is also correct.
Things that I tried,
adding -Dhttps.protocols="TLSv1,TLSv1.1,TLSv1.2" in configmgr.ini of FileNet configuration manager
Verified SSL configuration on WAS
But noting seems to work. I see below error message on the FileNet configuration manager logs
!ENTRY com.ibm.ecm.configmgr.engine 4 0 2018-06-27 15:45:09.289
!MESSAGE An invalid profile path was specified. C:\IBM\FileNet\ContentEngine\tools\configure\profiles\dotnetclient does not contain any configuration information.
!SESSION 2018-06-27 16:05:40.995 -----------------------------------------------
eclipse.buildId=unknown
java.fullversion=JRE 1.7.0 IBM J9 2.6 Windows 8 x86-32 20170718_357001 (JIT disabled, AOT disabled)
J9VM - R26_Java726_SR10_20170718_1208_B357001
GC - R26_Java726_SR10_20170718_1208_B357001
J9CL - 20170718_357001
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Framework arguments: gui
Command-line arguments: -os win32 -ws win32 -arch x86 gui
!ENTRY com.ibm.ecm.configmgr.app.ce 4 0 2018-06-27 16:13:56.518
!MESSAGE Connection error: The connection to the application server cannot be established. Ensure the application server is running and that the SOAP connector port and host name are correct.
!STACK 0
com.ibm.ecm.configmgr.engine.ConfigurationManagerException: Connection error: The connection to the application server cannot be established. Ensure the application server is running and that the SOAP connector port and host name are correct.
at com.ibm.ecm.configmgr.engine.jmx.JMXInvoker.invokeConnectMethodAndMethods(JMXInvoker.java:243)
at com.ibm.ecm.configmgr.engine.jmx.JMXInvoker.invokeConnectMethodAndMethod(JMXInvoker.java:142)
at com.ibm.ecm.configmgr.engine.jmx.WebSphereJMXInvoker.connect(WebSphereJMXInvoker.java:86)
at com.ibm.ecm.configmgr.app.ce.applicationserver.WebsphereApplicationServer$TestActivity.testWork(WebsphereApplicationServer.java:371)
at com.ibm.ecm.configmgr.engine.profile.EnvironmentTestActivity.test(EnvironmentTestActivity.java:64)
at com.ibm.ecm.configmgr.ui.wizards.NewProfileWizardPageGetProfileEnvironmentProps$7.widgetSelected(NewProfileWizardPageGetProfileEnvironmentProps.java:604)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:240)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
at org.eclipse.jface.window.Window.open(Window.java:801)
at com.ibm.ecm.configmgr.app.ce.handlers.ProfileNewHandler.execute(ProfileNewHandler.java:67)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
at org.eclipse.ui.menus.CommandContributionItem.handleWidgetSelection(CommandContributionItem.java:829)
at org.eclipse.ui.menus.CommandContributionItem.access$19(CommandContributionItem.java:815)
at org.eclipse.ui.menus.CommandContributionItem$5.handleEvent(CommandContributionItem.java:805)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at com.ibm.ecm.configmgr.app.ce.rcp.Application.start(Application.java:86)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56)
at java.lang.reflect.Method.invoke(Method.java:620)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
Caused by: java.lang.Exception: The connection to the application server cannot be established. Ensure the application server is running and that the SOAP connector port and host name are correct.
at com.ibm.ecm.configmgr.utils.websphere.WebSphereJMXUtil.connect(WebSphereJMXUtil.java:227)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56)
at java.lang.reflect.Method.invoke(Method.java:620)
at com.ibm.ecm.configmgr.engine.jmx.JMXInvoker.invokeConnectMethodAndMethods(JMXInvoker.java:191)
... 45 more
*************************telenet response**************************
When did telenet and after a few seconds, I see the below error
HTTP/1.1 408 Request Timeout Content-Type: text/html Content-Length: 117 Connection: close <HTML><TITLE>408 - Request Timeout</TITLE><BODY><h1>408 Connection timed out while reading request</h1></BODY></HTML> Connection to host lost. C:\Windows\system32>
*****************************workaround*****************************
Ok once the profile is created and ran first steps, I disabled global security and restarted websphere. Configuration manager is able to connect to WAS now (looks like issue with security. I verified Quality of protection (QoP) settings
with ssl.client.properties and it was selected as TLSv2. Then I changed it to TSLv1.2 and modified ssl.client.properties also. Still it did not work) I will updated this topic later.
Check default path Webshere.
C:\Program Files\IBM\WebSphere\AppServer
C:\Program Files\IBM\WebSphere\AppServer\profiles\your_profile
VS
C:\Program Files (x86)\IBM\WebSphere\AppServer
C:\Program Files (x86)\IBM\WebSphere\AppServer\profiles\your_profile
The Configuration Manager right now seems to support only older protocols. If you specify TLSv1 in WebSphere console, as opposed to TLSv1.2 for example, Test Connection will work. That will create you another problem though. Newer browsers don't support older protocols and you will not be able to open your WebSphere console in say, Firefox. On Windows, you can use your old but still included IE configured to use these older protocols - Tools -> Internet Options -> Advanced -> Security -> Use * . You'll get your console back that way.

Enable DRCP in Weblogic 12c fails

I'm trying to create a data source enabled with DRCP in Weblogic 12c installed in Linux. After providing all required values & 'Test Configuration' there is an error (cited below ). I have tried the same on Windows and it worked for same port number (also included SERVER=POOLED in 'tnsnames.ora' for client purpose in Windows).
Configurations:
Linux machine : Weblogic 12c (12.1.2)
URL : jdbc:oracle:thin:#//10.125.158.115:1521/PERF01:POOLED
oracle.jdbc.DRCPConnectionClass = myDRCPClass
Error:
<AdminServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <weblogic> <> <> <1432019762569>
<BEA-240003> <Administration Console encountered the following error: java.sql.SQLRecoverableException:
IO Error: Invalid number format for port number
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:465)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:546)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:232)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:280)
at oracle.jdbc.xa.client.OracleXADataSource.getPooledConnection(OracleXADataSource.java:469)
at oracle.jdbc.xa.client.OracleXADataSource.getXAConnection(OracleXADataSource.java:156)
at oracle.jdbc.xa.client.OracleXADataSource.getXAConnection(OracleXADataSource.java:101)
at weblogic.jdbc.common.internal.DataSourceUtil.testConnection0(DataSourceUtil.java:356)
at weblogic.jdbc.common.internal.DataSourceUtil.access$000(DataSourceUtil.java:22)
at weblogic.jdbc.common.internal.DataSourceUtil$1.run(DataSourceUtil.java:254)
at java.security.AccessController.doPrivileged(Native Method)
at weblogic.jdbc.common.internal.DataSourceUtil.testConnection(DataSourceUtil.java:251)
.
.
at weblogic.work.ExecuteThread.run(ExecuteThread.java:254)
Caused by: oracle.net.ns.NetException: Invalid number format for port number
at oracle.net.resolver.AddrResolution.resolveSimple(AddrResolution.java:512)
at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:409)
Change of Weblogic version (from Weblogic 12.1.2 to 12.1.3) solved this problem. Both Weblogic 12.1.1 & Weblogic 12.1.3 supports DRCP.

Connecting Oracle to Play Framework 2.1.5

I am still new in Play! Framework universe I i'd like to ask you folk a question. I am trying to connect Oracle to my application. Thus, I added this in the application.conf file:
db.default.driver=oracle.jdbc.driver.OracleDriver
db.default.url="jdbc:oracle:thin:#localhost:1521/test"
db.default.user=scott
db.default.password="tiger"
And of course added the dependenies... But it still not working and throws me a beautiful exception :
"Configuration error : Cannot connect to database [default]"
Am I wrong in something ? Please I really need help.
Thanks.
#
#Frank Schmitt : nope I didn't tried this.
#wwkudu : by running my application, I get this :
[error] c.j.b.h.AbstractConnectionHook - Failed to obtain initial connection Sle
eping for 0ms and trying again. Attempts left: 0. Exception: null
[error] application -
! #6h70iggbo - Internal server error, for (GET) [/] ->
play.api.Configuration$$anon$1: Configuration error[Cannot connect to database [
default]]
at play.api.Configuration$.play$api$Configuration$$configError(Configura
tion.scala:81) ~[play_2.10.jar:2.1.5]
at play.api.Configuration.reportError(Configuration.scala:559) ~[play_2.
10.jar:2.1.5]
at play.api.db.BoneCPPlugin$$anonfun$onStart$1.apply(DB.scala:251) ~[pla
y-jdbc_2.10.jar:2.1.5]
at play.api.db.BoneCPPlugin$$anonfun$onStart$1.apply(DB.scala:242) ~[pla
y-jdbc_2.10.jar:2.1.5]
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike
.scala:244) ~[scala-library.jar:na]
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike
.scala:244) ~[scala-library.jar:na]
Caused by: java.sql.SQLException: Exception d'E/S: Got minus one from a read cal
l
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:112) ~[ojdbc14-10.2.0.2.jar:Oracle JDBC Driver version - "10.2.0.1.0"]
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:146) ~[ojdbc14-10.2.0.2.jar:Oracle JDBC Driver version - "10.2.0.1.0"]
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:255) ~[ojdbc14-10.2.0.2.jar:Oracle JDBC Driver version - "10.2.0.1.0"]
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387) ~[ojdb
c14-10.2.0.2.jar:Oracle JDBC Driver version - "10.2.0.1.0"]
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:
414) ~[ojdbc14-10.2.0.2.jar:Oracle JDBC Driver version - "10.2.0.1.0"]
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165) ~[ojd
bc14-10.2.0.2.jar:Oracle JDBC Driver version - "10.2.0.1.0"]
Check if the Database named test exists

Tomcat 7 with Java 7 JRE_HOME not handling Java 7 beans

I've set-up my Tomcat 7 on Ubuntu 12 with a Java 7 JRE_HOME:
$ /usr/share/tomcat7/bin/version.sh
Using CATALINA_BASE: /usr/share/tomcat7
Using CATALINA_HOME: /usr/share/tomcat7
Using CATALINA_TMPDIR: /usr/share/tomcat7/temp
Using JRE_HOME: /usr/lib/jvm/java-7-openjdk-i386
Using CLASSPATH: /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar
Server version: Apache Tomcat/7.0.26
Server built: Apr 11 2012 12:24:08
Server number: 7.0.26.0
OS Name: Linux
OS Version: 3.2.0-24-generic-pae
Architecture: i386
JVM Version: 1.7.0_03-b147
JVM Vendor: Oracle Corporation
But when deploying a simple JSF application compiled to 1.7 Tomcat complains with
SEVERE: Critical error during deployment:
com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! java.util.concurrent.ExecutionException: java.lang.UnsupportedClassVersionError: com/corejsf/UserBean : Unsupported major.minor version 51.0 (unable to load class com.corejsf.UserBean)
When I change my Ant build.xml to compile to "1.6" the application deploys fine. Is this incompatibility with Java 7 to be expected? There is a 6-months-old related question on Tomcat 7 / Java 7 compatibility but the answers there seem to suggest that Java 7 is supported.
I encountered exactly the same issue.
Here are my steps:
Edit file:
/etc/default/tomcat7
Replace JAVA_HOME
From
JAVA_HOME=/usr/lib/jvm/openjdk-6-jdk
to
JAVA_HOME=/usr/lib/jvm/jdk1.7.0_09
Restart Tomcat.

Resources