JDBC Drivers not working in JBoss Fuse
Environment
- Red Hat JBoss Fuse
- 6.1.0
Issue
- Issue is with
JBoss Fuse 6.1.1. - We are trying to setup a
JDBC connectionto anInformix databasefrom aFuse Fabric container. I am able to get the connection to work from a Fabric container that is setup withJBoss Fuse 6.1.0-379, however from a Fabric container that is setup with aJBoss Fuse 6.1.1-412the same code fails. - I am having the exact same problem when trying to connect to a Progress
OpenEdge database. In aJBoss Fuse 412container we receive the following stack trace:-
org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (com.informix.asf.IfxASFException: Attempt to connect to database server (XXXXXXX) failed.)
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
at Proxy7ed1b10d_f524_460f_9109_df31ede50463.getConnection(Unknown Source)
at com.redacted.test.informix.Program.init(Program.java:14)
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:606)
at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:297)
at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:958)
at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:712)
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:824)
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)
at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)
at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:245)
at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:183)
at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:676)
at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:374)
at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:261)
at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:270)
at org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:233)
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)
at org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1103)
at org.apache.felix.framework.util.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:696)
at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:484)
at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4650)
at org.apache.felix.framework.Felix$4.run(Felix.java:2123)
at org.apache.felix.framework.Felix$5.run(Felix.java:2167)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.sql.SQLException: com.informix.asf.IfxASFException: Attempt to connect to database server (XXXXXXX) failed.
at com.informix.jdbc.IfxSqliConnect.<init>(IfxSqliConnect.java:1417)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at com.informix.jdbc.IfxDriver.connect(IfxDriver.java:254)
at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)
at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556)
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545)
... 39 more
Caused by: com.informix.asf.IfxASFException: Attempt to connect to database server (skuman_on) failed.
at com.informix.util.IfxErrMsg.getLocIfxASFException(IfxErrMsg.java:815)
at com.informix.asf.Connection.openSocket(Connection.java:1984)
at com.informix.asf.Connection.<init>(Connection.java:371)
at com.informix.jdbc.IfxSqliConnect.<init>(IfxSqliConnect.java:1054)
... 48 more
Caused by: java.lang.NullPointerException
at io.fabric8.git.internal.GitDataStore$FabricGitLocalHostProxySelector.isLocalHost(GitDataStore.java:1512)
at io.fabric8.git.internal.GitDataStore$FabricGitLocalHostProxySelector.select(GitDataStore.java:1473)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384)
at java.net.Socket.connect(Socket.java:579)
at java.net.Socket.connect(Socket.java:528)
at java.net.Socket.<init>(Socket.java:425)
at java.net.Socket.<init>(Socket.java:208)
at com.informix.asf.Connection.openSocket(Connection.java:1933)
... 50 more
Resolution
GitDataStoreisLocalHostfunction that doesn't check for a null parameter and throws theNullPointerExceptionwhenuri.getHost()return NULL i.ehostname=NULL.URIwhich contains an underscore in the host name will return null fromuri.getHost(). TheisLocalHostfunction then fails with aNullPointerException. According to the Java api doc
A domain name consisting of one or more labels separated by period characters ('.'), optionally followed by a period character. Each label consists of alphanum characters as well as hyphen characters ('-'), though hyphens never occur as the first or last characters in a label. The rightmost label of a domain name consisting of two or more labels, begins with an alpha character.
Diagnostic Steps
- To verify the
URI, enableTrace loggingto get the below log.
String nonProxy = System.getProperty("http.nonProxyHosts");
String host = uri.getHost();
String path = uri.getPath();
LOG.trace("ProxySelector: Uri {}", uri);
LOG.trace("ProxySelector: Configured http.nonProxyHosts {}", nonProxy);
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments