1 2 Previous Next 19 Replies Latest reply: Apr 23, 2012 5:02 AM by Wolf-Dieter Fink RSS

Oracle Datasource configuration

Chandramohan Murugananthan Newbie

Hi

 

I would like to create the datasource for to connect oracle DB for my web application using JBoss 6.1. I have created datasource under (No Tx datasource) with user id and pwd and test connection shows as Successful. When I using same JNDI name to look up it is throwing naming exception. I have created datasource under Local tx datasource option also. But received same exception when I deploy and run the application. I am not sure why look up has not sucessful from application.

 

 

Any solution for the above issue ?

 

Regards

Mohan

  • 1. Re: Oracle Datasource configuration
    Wolf-Dieter Fink Master

    Do you try to use the datasource from the remote client? This is not active by default and also not recommended for production because of the overhead.

     

    See the <use-java-context> in the wiki here

  • 2. Re: Oracle Datasource configuration
    Chandramohan Murugananthan Newbie

    I am not very clear about your solution. Could you please explain step 1 to end for oracle data source configuration and how to get the connection in the java program. I am trying to use remote client and should be feasible solution for production system also. I have tried few steps like update the oracle-ds.xml and placed in%jboss_home%\server\default\deploy folder but not successful.

  • 3. Re: Oracle Datasource configuration
    Wolf-Dieter Fink Master

    If you deploy your oracle-ds.xml in the deploy folder, do you see a log message that the datasource is created?

    If yes everything is ok and you can use the datasource from your code inside the server.

     

    It is highly recommended that you not use this datasource from other clients in production, i.e. separate java applications.

  • 4. Re: Oracle Datasource configuration
    Chandramohan Murugananthan Newbie

    This datasource is going to use only one java application in the production.

     

    Data source is created in the as per the log message. When I try to look up using JNDI Name, I am getting following error message. I am using oracle 11g from windows server 2008. Is it because of ocijdbc9 in java.library.path? I am not sure abt the solution.

     

    17:38:37,023 WARN  [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Throwable while attempting to get a new connection: null: org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.lang.reflect.UndeclaredThrowableException)

        at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:261) [:6.1.0.Final]

        at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:215) [:6.1.0.Final]

        at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:648) [:6.1.0.Final]

        at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:272) [:6.1.0.Final]

        at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:690) [:6.1.0.Final]

        at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:403) [:6.1.0.Final]

        at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:414) [:6.1.0.Final]

        at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:496) [:6.1.0.Final]

        at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:941) [:6.1.0.Final]

        at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:89) [:6.1.0.Final]

        at ezpar.fairfax.user.TestDBConnection.getJNDIConnection(TestDBConnection.java:49) [:]

        at ezpar.fairfax.user.TestDBConnection.<init>(TestDBConnection.java:83) [:]

        at org.apache.jsp.jsp.LoginTestDB_jsp._jspService(LoginTestDB_jsp.java:78)

        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [:6.1.0.Final]

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [:1.0.0.Final]

        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) [:6.1.0.Final]

        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [:6.1.0.Final]

        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [:6.1.0.Final]

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [:1.0.0.Final]

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.1.0.Final]

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.1.0.Final]

        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [:6.1.0.Final]

        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [:6.1.0.Final]

        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181) [:6.1.0.Final]

        at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285) [:1.1.0.Final]

        at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261) [:1.1.0.Final]

        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88) [:6.1.0.Final]

        at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100) [:6.1.0.Final]

        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:159) [:6.1.0.Final]

        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [:6.1.0.Final]

        at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) [:6.1.0.Final]

        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [:6.1.0.Final]

        at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53) [:6.1.0.Final]

        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [:6.1.0.Final]

        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [:6.1.0.Final]

        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654) [:6.1.0.Final]

        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) [:6.1.0.Final]

        at java.lang.Thread.run(Thread.java:662) [:1.6.0_30]

    Caused by: java.lang.reflect.UndeclaredThrowableException

        at org.jboss.resource.JBossResourceException.process(JBossResourceException.java:207) [:6.1.0.Final]

        at org.jboss.resource.JBossResourceException.<init>(JBossResourceException.java:114) [:6.1.0.Final]

        ... 38 more

    Caused by: java.lang.UnsatisfiedLinkError: no ocijdbc9 in java.library.path

        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1738) [:1.6.0_30]

        at java.lang.Runtime.loadLibrary0(Runtime.java:823) [:1.6.0_30]

        at java.lang.System.loadLibrary(System.java:1028) [:1.6.0_30]

        at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:262) [:"Oracle JDBC Driver version - 9.0.2.0.0"]

        at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:346) [:"Oracle JDBC Driver version - 9.0.2.0.0"]

        at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:468) [:"Oracle JDBC Driver version - 9.0.2.0.0"]

        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314) [:"Oracle JDBC Driver version - 9.0.2.0.0"]

        at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:229) [:6.1.0.Final]

        ... 37 more

  • 5. Re: Oracle Datasource configuration
    Wolf-Dieter Fink Master

    Looks like that you configured the datasource with Oracles OCI connection (connect string 'jdbc:oracle:oci').

    In this case you have to install the Oracle client and set the library path for the JVM with the correct libs (see Oracle documentation)

     

    I prefer the thin driver, the only need is to have the ojdbc*.jar in the common or server's lib directory.

  • 7. Re: Oracle Datasource configuration
    Wolf-Dieter Fink Master

    No problem, you're welcome!

  • 8. Re: Oracle Datasource configuration
    abhi joshi Newbie

    Hi All,

     

    I have one concern .

    I am getting the exception as foloows.

    Caused by: java.sql.SQLException: Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=185599744)(ERR=12514)(ERROR_STACK=(ERROR=(CODE=12514)(EMFI=4))))

     

    Here i followed some of the steps to resolve the same.

    a.Have copied the jar file.

     

    Interesting thing is that

    I am able to connect to database with the help of the connectionn string that i have, but while running the jboss i am getting the exception as mentioned above.

     

    I am using same connection string specified in -ds xml file.

     

    Can any one help with some useful comments.

     

    Thanks in advance.

  • 9. Re: Oracle Datasource configuration
    abhi joshi Newbie

    The additional info is

    OS is WINDOWS 7

    DB ORACLE 11G

  • 10. Re: Oracle Datasource configuration
    Wolf-Dieter Fink Master

    Looks like a different issue.

    I suppose it will be a network or an OracleDB issue.

    When does it happen, how often and is the DB still accessible after that?

  • 11. Re: Oracle Datasource configuration
    abhi joshi Newbie

    org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=185599744)(ERR=12514)(ERROR_STACK=(ERROR=(CODE=12514)(EMFI=4)))))

     

    This is actual exception and the one specifed in the previous thhread is the root cause for the same.

     

    Every time when u start the boss this exception is get thrown.

     

    I have tested the connection by specifying connection string as custom jdbc url value in the oracle sql developer.It works fine every time.

     

    DB is still accessible  after that.

     

    Thanks,

    Abhi

  • 12. Re: Oracle Datasource configuration
    Wolf-Dieter Fink Master

    So as I understand you are able to connect via tool but not via JBoss, right?

    Please describe your configuration and what you have tested in a new thread and post the error also.

  • 13. Re: Oracle Datasource configuration
    abhi joshi Newbie

    Yes thats correct!

     

    1.the vesriosn of jboss is 4.0

    2.The test was to check whether connecion string specified in '-ds.xml ' is correct or not.

    3.Os in win 7.

    this is the error

     

    16:38:36,023 WARN  [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Throwable while attempting to get a new connection: null: org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.lang.reflect.UndeclaredThrowableException)

        at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:261) [:6.1.0.Final]

        at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:215) [:6.1.0.Final]

        at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:648) [:6.1.0.Final]

        at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:272) [:6.1.0.Final]

        at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:690) [:6.1.0.Final]

        at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:403) [:6.1.0.Final]

        at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:414) [:6.1.0.Final]

        at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:496) [:6.1.0.Final]

        at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:941) [:6.1.0.Final]

  • 14. Re: Oracle Datasource configuration
    abhi joshi Newbie

    This also might give an idea as well

     

     

    Caused by: java.sql.SQLException: Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=185599744)(ERR=12514)(ERROR_STACK=(ERROR=(CODE=12514)(EMFI=4))))

     

    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)

        at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)

        at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:334)

        at oracle.jdbc.ttc7.TTC7Protocol.handleIOException(TTC7Protocol.java:3695)

        at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:352)

        at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:362)

        at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:536)

        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:328)

        at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:154)

1 2 Previous Next