Weblogic 12c Database Connection Error

weblogic.common.resourceexception: unknown data source
database issues in weblogic
ons in fanmanager failed with oracle.ons.noserversavailable: subscription time out
weblogic database connection
connection test failed connection isvalid returned false weblogic
how to test datasource connection in weblogic 12c
weblogic database connection pool problem
weblogic jdbc wrapper resultset_oracle_jdbc_driver_forwardonlyresultset next unknown source

I have just completed a fresh new installation of Oracle Fusion Middleware 12c. This one came with a new version of Weblogic 12.2.1.3.0. Whenever I try to create a new JDBC connection I receive the below error.

<BEA-240003> <Administration Console encountered the following error: java.sql.SQLException: Could not establish a connection because of java.lang.IllegalArgumentException: ONS configuration failed
            at weblogic.jdbc.common.internal.DataSourceUtil.testConnection0(DataSourceUtil.java:423)
            at weblogic.jdbc.common.internal.DataSourceUtil.access$000(DataSourceUtil.java:24)
            at weblogic.jdbc.common.internal.DataSourceUtil$1.run(DataSourceUtil.java:285)
            at java.security.AccessController.doPrivileged(Native Method)
            at weblogic.jdbc.common.internal.DataSourceUtil.testConnection(DataSourceUtil.java:282)
            at com.bea.console.utils.jdbc.JDBCUtils.testConnection(JDBCUtils.java:937)
            at com.bea.console.actions.jdbc.datasources.creategridlinkdatasource.CreateGridLinkDataSource.testJDBCConnection(CreateGridLinkDataSource.java:615)
            at com.bea.console.actions.jdbc.datasources.creategridlinkdatasource.CreateGridLinkDataSource.testRACConnectionConfiguration(CreateGridLinkDataSource.java:437)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at org.apache.beehive.netui.pageflow.FlowController.invokeActionMethod(FlowController.java:870)
            at org.apache.beehive.netui.pageflow.FlowController.getActionMethodForward(FlowController.java:809)
            at org.apache.beehive.netui.pageflow.FlowController.internalExecute(FlowController.java:478)
            at org.apache.beehive.netui.pageflow.PageFlowController.internalExecute(PageFlowController.java:306)
            at org.apache.beehive.netui.pageflow.FlowController.execute(FlowController.java:336)
            at org.apache.beehive.netui.pageflow.internal.FlowControllerAction.execute(FlowControllerAction.java:52)
            at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
            at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.access$201(PageFlowRequestProcessor.java:97)
            at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor$ActionRunner.execute(PageFlowRequestProcessor.java:2044)
            at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors$WrapActionInterceptorChain.continueChain(ActionInterceptors.java:64)
            at org.apache.beehive.netui.pageflow.interceptor.action.ActionInterceptor.wrapAction(ActionInterceptor.java:184)
            at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors$WrapActionInterceptorChain.invoke(ActionInterceptors.java:50)
            at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors$WrapActionInterceptorChain.continueChain(ActionInterceptors.java:58)
            at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors.wrapAction(ActionInterceptors.java:87)
            at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processActionPerform(PageFlowRequestProcessor.java:2116)
            at com.bea.console.internal.ConsolePageFlowRequestProcessor.processActionPerform(ConsolePageFlowRequestProcessor.java:265)
            at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
            at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processInternal(PageFlowRequestProcessor.java:556)
            at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.process(PageFlowRequestProcessor.java:853)
            at org.apache.beehive.netui.pageflow.AutoRegisterActionServlet.process(AutoRegisterActionServlet.java:631)
            at org.apache.beehive.netui.pageflow.PageFlowActionServlet.process(PageFlowActionServlet.java:158)
            at com.bea.console.internal.ConsoleActionServlet.process(ConsoleActionServlet.java:262)
            at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
            at com.bea.console.internal.ConsoleActionServlet.doGet(ConsoleActionServlet.java:134)
            at org.apache.beehive.netui.pageflow.PageFlowUtils.strutsLookup(PageFlowUtils.java:1199)
            at org.apache.beehive.netui.pageflow.PageFlowUtils.strutsLookup(PageFlowUtils.java:1129)
            at com.bea.portlet.adapter.scopedcontent.framework.internal.PageFlowUtilsBeehiveDelegate.strutsLookupInternal(PageFlowUtilsBeehiveDelegate.java:43)
            at com.bea.portlet.adapter.scopedcontent.framework.PageFlowUtils.strutsLookup(PageFlowUtils.java:108)
            at com.bea.portlet.adapter.scopedcontent.ScopedContentCommonSupport.executeAction(ScopedContentCommonSupport.java:707)
            at com.bea.portlet.adapter.scopedcontent.ScopedContentCommonSupport.processActionInternal(ScopedContentCommonSupport.java:141)
            at com.bea.portlet.adapter.scopedcontent.PageFlowStubImpl.processAction(PageFlowStubImpl.java:108)
            at com.bea.portlet.adapter.NetuiActionHandler.raiseScopedAction(NetuiActionHandler.java:111)
            at com.bea.netuix.servlets.controls.content.NetuiContent.raiseScopedAction(NetuiContent.java:181)
            at com.bea.netuix.servlets.controls.content.NetuiContent.raiseScopedAction(NetuiContent.java:167)
            at com.bea.netuix.servlets.controls.content.NetuiContent.handlePostbackData(NetuiContent.java:225)
            at com.bea.netuix.nf.ControlLifecycle$2.visit(ControlLifecycle.java:180)
            at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:324)
            at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
            at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
            at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
            at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
            at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
            at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
            at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
            at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
            at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
            at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
            at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
            at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
            at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
            at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
            at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
            at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
            at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
            at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
            at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
            at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
            at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
            at com.bea.netuix.nf.ControlTreeWalker.walk(ControlTreeWalker.java:130)
            at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:399)
            at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:361)
            at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:352)
            at com.bea.netuix.nf.Lifecycle.runInbound(Lifecycle.java:184)
            at com.bea.netuix.nf.Lifecycle.run(Lifecycle.java:159)
            at com.bea.netuix.servlets.manager.UIServlet.runLifecycle(UIServlet.java:465)
            at com.bea.netuix.servlets.manager.UIServlet.doPost(UIServlet.java:291)
            at com.bea.netuix.servlets.manager.UIServlet.service(UIServlet.java:219)
            at com.bea.netuix.servlets.manager.SingleFileServlet.service(SingleFileServlet.java:275)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
            at com.bea.console.utils.MBeanUtilsInitSingleFileServlet.service(MBeanUtilsInitSingleFileServlet.java:64)
            at weblogic.servlet.AsyncInitServlet.service(AsyncInitServlet.java:125)
            at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:286)
            at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:260)
            at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:137)
            at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:350)
            at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)
            at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
            at com.bea.console.internal.ParamFilter.doFilter(ParamFilter.java:38)
            at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
            at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:32)
            at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
            at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3701)
            at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3667)
            at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:326)
            at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:197)
            at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203)
            at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71)
            at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2443)
            at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2291)
            at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2269)
            at weblogic.servlet.internal.ServletRequestImpl.runInternal(ServletRequestImpl.java:1703)
            at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1663)
            at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:272)
            at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:352)
            at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:337)
            at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:57)
            at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
            at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:644)
            at weblogic.work.ExecuteThread.execute(ExecuteThread.java:415)
            at weblogic.work.ExecuteThread.run(ExecuteThread.java:355)

I have banging my head into it for some time now and Google wasn't much help. Any help will be really appreciated.

Thanks

I have done some digging and found the solution. The cause of the problem was that for some reason the FAN service was implicitly enabled in the server configuration. I made it work by adding the below line to the JAVA_OPTIONS in setDomainEnv.sh file.

-Doracle.jdbc.fanEnabled=false

Now everything works like a charm.

tune the connection pool attributes in JDBC data sources in your WebLogic Server Calling a Stored Statement After a Database Change May Cause Errors​. Oracle® Fusion Middleware, Understanding the WebLogic Scripting Tool, 12c (12.2.1.3.0), E80279-01, August 2017. Chapter 3.7 Creating a Managed Server Domain on a Remote Machine. a database connection error is seen during writeDomain(). This worked as expected with WLS 12.2.1.2. Pack and unpack work as expected.

As someone pointed out, we need to add -Doracle.jdbc.fanEnabled=false in setDomainEnv file (.sh for UNIX and .cmd for windows).

For windows, replace the last occurrence of set JAVA_OPTIONS=%JAVA_OPTIONS% with set JAVA_OPTIONS=%JAVA_OPTIONS% -Doracle.jdbc.fanEnabled=false in setDomainEnv.cmd file located at the path "YOUR_USER\AppData\Roaming\JDeveloper\system12.2.1.3\DefaultDomain\bin

The connections are to an Oracle Database. Oracle WebLogic Server 12c (​12.1.1); Oracle Database 11.1 or 11.2. Note: In If the connection test fails, use the Back button to review the entries made for the data source and correct any errors. In WebLogic Server, you configure database connectivity by adding data sources to your WebLogic domain. Java Database Connectivity (JDBC) data sources provide database access and database connection management. Each data source contains a pool of database connections that are created when the data source is created and at server startup.

The error indicates that setting up the Oracle Notification Service (ONS) subscription(s) could not be set up. If you specified the ONS configuration explicitly, then check that the syntax is correct. It's documented at https://docs.oracle.com/middleware/12213/wls/JDBCA/gridlink_datasources.htm#JDBCA461 Alternatively, you can leave the ONS string blank and auto-ONS will take over.

This error occurs if an applications that uses a database connections from the DataSource/Pool and When the application checked out a connection that has been already “timed out” or has been “staled”, still the application uses it to connect to the database, this error occurs. If set and if the database is unavailable when the data source is created, WebLogic Server will attempt to create connections in the pool again after the number of seconds you specify, and will continue to attempt to create the connections until it succeeds. When set to 0, connection retry is disabled.' Learning all the time

WebLogic JDBC data sources support setting driver You can define fatal error codes that indicate that the back-end database with which cause a server to fail to boot and connection errors  Then I start the sqldeveloper and login to the database. I have Weblogic 12c server installed on the same RHEL 7 machine and I am configuring a Generic Datasource to connect to the database on the same RHEL 7 machine and getting the following error: Connection test failed. Listener refused the connection with the following error:

To make sure that the database connections in a data source WebLogic Server includes two basic types of testing: should prevent most DBMS connection problems. When an application is redeployed to the WebLogic (WLS) Managed Server, a restart fails with the following log error: Jun 28, 2015 5:58:04 AM oracle.security.jps.internal.policystore.rdbms.JpsDBDataManager init

Open a browser window and log on to the Oracle WebLogic Server Administration Console as a user In the URL box, type the new database connection URL. WebLogic Server 10.3.6/12.1.x with 11g drivers and Oracle Database 12c WebLogic Server 10.3.6/12.1.1 with 12c drivers and Oracle Database 11gR2 WebLogic Server 12.1.2 and later with 12c drivers and Oracle Database 11gR2 WebLogic Server 10.3.6/12.1.1 with 12c drivers and Oracle Database 12c

Comments
  • I did not add any specific configuration to the ONS. Anyway, I have found the cause and solved the problem. I will add an answer below.