-
15. Re: How to configure Oracle with my application in jboss 5.0
peterj Feb 18, 2010 11:42 AM (in response to akstifr)Please post the code that is attempting to establish a connection to the datbase and is writing to stdout.
-
16. Re: How to configure Oracle with my application in jboss 5.0
akstifr Feb 19, 2010 7:19 AM (in response to peterj)Here is the Code for database Connection
package beans; import java.sql.*; import javax.sql.*; import javax.naming.*; public class OracleDatasource { private Connection con; public Connection getDbConnection() { try{ Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup("java:comp/env"); DataSource ds = (DataSource)envCtx.lookup("jdbc/datanet); if (ds == null) System.out.println("datasource not obtained.."); con= ds.getConnection(); if (con == null) System.out.println("connection not obtained.."); } catch( NamingException ne ) { throw new RuntimeException( "Unable to aquire data source", ne ); } catch (SQLException se) { System.out.println("Exception occured while obtaining connection..."); se.printStackTrace(); } return con; }//end getDbConnection() }//end class
-
17. Re: How to configure Oracle with my application in jboss 5.0
peterj Feb 19, 2010 2:37 PM (in response to akstifr)1 of 1 people found this helpfulSee if this helps:
-
18. Re: How to configure Oracle with my application in jboss 5.0
akstifr Feb 22, 2010 11:22 PM (in response to peterj)Still unable to connect even after changing the jboss-web.xml and connection file as said in the above link.
It is giving the same error message:
Unable to connect to the database
Now what to do ???
-
19. Re: How to configure Oracle with my application in jboss 5.0
peterj Feb 23, 2010 11:41 AM (in response to akstifr)Please post the jboss-web.xml file, the portion of the web.xml file that contains the resource-ref, and the oracle-ds.xml file. -
20. Re: How to configure Oracle with my application in jboss 5.0
akstifr Feb 24, 2010 12:27 AM (in response to peterj)Thanks once again for your reply
Here are the files which u have requested for...
The contents of jboss-web.xml is
<jboss-web> <resource-ref> <res-ref-name>jdbc/OracleDS</res-ref-name> <jndi-name>java:jdbc/OracleDS</jndi-name> </resource-ref> </jboss-web>
and the contents of web.xml is:
<resource-ref> <res-ref-name>jdbc/OracleDS</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> <res-sharing-scope>Shareable</res-sharing-scope> </resource-ref>
There are some more security-constraint also which i have already specified previously in the post here.
The contents of OracleDS.xm file are:
<?xml version="1.0" encoding="UTF-8"?> <!-- ===================================================================== --> <!-- --> <!-- JBoss Server Configuration --> <!-- --> <!-- ===================================================================== --> <!-- $Id: oracle-ds.xml,v 1.6 2004/09/15 14:37:40 loubyansky Exp $ --> <!-- ==================================================================== --> <!-- Datasource config for Oracle originally from Steven Coy --> <!-- ==================================================================== --> <datasources> <local-tx-datasource> <jndi-name>jdbc/OracleDS</jndi-name> <connection-url>jdbc:oracle:thin:@xxx.yyy.zzz.www:1521:dbatest</connection-url> <!-- See on WIKI page below how to use Oracle's thin JDBC driver to connect with enterprise RAC. --> <!-- Here are a couple of the possible OCI configurations. For more information, see http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/java.920/a96654/toc.htm <connection-url>jdbc:oracle:oci:@youroracle-tns-name</connection-url> or <connection-url>jdbc:oracle:oci:@(description=(address=(host=youroraclehost)(protocol=tcp)(port=1521))(connect_data=(SERVICE_NAME=yourservicename)))</connection-url> Clearly, its better to have TNS set up properly. --> <driver-class>oracle.jdbc.driver.OracleDriver</driver-class> <user-name>xxxxx</user-name> <password>yyyyy</password> <min-pool-size>5</min-pool-size> <max-pool-size>100</max-pool-size> <!-- Uses the pingDatabase method to check a connection is still valid before handing it out from the pool --> <!--valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name--> <!-- Checks the Oracle error codes and messages for fatal errors --> <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name> <!-- sql to call when connection is created <new-connection-sql>some arbitrary sql</new-connection-sql> --> <!-- sql to call on an existing pooled connection when it is obtained from pool - the OracleValidConnectionChecker is prefered <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql> --> <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) --> <metadata> <type-mapping>Oracle9i</type-mapping> </metadata> </local-tx-datasource> </datasources>
Now what should i have to do further ???
-
21. Re: How to configure Oracle with my application in jboss 5.0
jaikiran Feb 24, 2010 12:33 AM (in response to akstifr)All your configs are refering to jdbc/OracleDS, so why is your code looking up jdbc/datanet -
22. Re: How to configure Oracle with my application in jboss 5.0
akstifr Feb 24, 2010 2:18 AM (in response to jaikiran)Previously i used jdbc/datanet but after you have specified some changes in the previous post so that i have changed that thing in the code with new name. Here is Connection Code file:
package beans; import java.sql.*; import javax.sql.*; import javax.naming.*; public class OracleDatasource { private Connection con; public Connection getDbConnection() { try{ Context initCtx = new InitialContext(); //Context envCtx = (Context) initCtx.lookup("java:comp/env"); DataSource ds = (DataSource)initCtx.lookup("java:comp/env/jdbc/OracleDS"); if (ds == null) System.out.println("datasource not obtained.."); con= ds.getConnection(); if (con == null) System.out.println("connection not obtained.."); } catch( NamingException ne ) { throw new RuntimeException( "Unable to aquire data source", ne ); } catch (SQLException se) { System.out.println("Exception occured while obtaining connection..."); se.printStackTrace(); } return con; }//end getDbConnection() }//end class
-
23. Re: How to configure Oracle with my application in jboss 5.0
peterj Feb 24, 2010 12:42 PM (in response to akstifr)I do not see anything wrong offhand. Use JNDIView to get a list of names in JNDI and post that.
http://community.jboss.org/click.jspa?searchID=504038&objectType=102&objectID=9584
Just to double-check, the datasource lookup code that you posted is in a class in the WAR file, correct?
-
24. Re: How to configure Oracle with my application in jboss 5.0
ryildirim Feb 10, 2012 4:07 PM (in response to akstifr)[JmsActivation] Unable to reconnect org.jboss.resource.adapter.jms.inflow.JmsActivationSpec@7b682f(ra=org.jboss.resource.adapter.jms.JmsResourceAdapter@185cb87 destination=queue/JbpmCommandQueue destinationType=javax.jms.Queue tx=true durable=false reconnect=10 provider=DefaultJMSProvider user=null maxMessages=1 minSession=1 maxSession=15 keepAlive=30000 useDLQ=true DLQHandler=org.jboss.resource.adapter.jms.inflow.dlq.GenericDLQHandler DLQJndiName=queue/DLQ DLQUser=null DLQMaxResent=10)
javax.naming.NameNotFoundException: queue not boundThis is due to default oracle-persistence-service.xml . jboss.messaging:service=PostOffice bean can not be deployed. You have to remove the jgroups properties if you are not using it as clustered or deploy jgroups ChannelFactory...
<attribute name="Clustered">false</attribute> remove the lines below this line....