5 Replies Latest reply: Aug 3, 2013 9:30 AM by dvohra21 RSS

    How can i create datasource on apache server for ADF application?

    Manish

      Hi All,

       

      i my use case i have created simple adf application using ADF BC and want to deploy on Apache server 6.x.

      So my question is that  how can i create Data Source i have goggling and find  two different way to do this.

       

      1. write following line of code on apache server conf/Context.xml file.

       

      <Resource name="jdbc/TestDB" auth="Container"

                    type="javax.sql.DataSource"

                     driverClassName="oracle.jdbc.OracleDriver"

                    url="jdbc:oracle:thin:@localhost:dst"

                    username="jagrandb" password="jagrantest" maxActive="20" maxIdle="10"

                    maxWait="-1"/>

       

      but when i have used this way i got following exception.

      org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper cannot be cast to oracle.jdbc.OracleConnection

       

      check link-

      https://forums.oracle.com/thread/2564233

       

      2. write following line of code apache conf/Server.xml file

      <GlobalNamingResources>

          <!-- Editable user database that can also be used by

               UserDatabaseRealm to authenticate users

          -->

          <Resource name="UserDatabase" auth="Container"

                    type="org.apache.catalina.UserDatabase"

                    description="User database that can be updated and saved"

                    factory="org.apache.catalina.users.MemoryUserDatabaseFactory"

                    pathname="conf/tomcat-users.xml" />

       

       

       

       

       

       

      <Resource name="jdbc/TestDB" auth="Container"

                    type="oracle.jdbc.pool.OracleDataSource"

                    description="User database that can be updated and saved"

                    driverClassName="oracle.jdbc.driver.OracleDriver"

                    factory="oracle.jdbc.pool.OracleDataSourceFactory"

                    url="jdbc:oracle:thin:@//172.31.43.207:1521:dst"

                    username="jagrandb" password="jagrantest" maxActive="20" maxIdle="10"

                    maxWait="-1"   />

       

       

       

       

        </GlobalNamingResources>

       

      and add this line in context.xml file inside <context> tag

      <ResourceLink global="jdbc/TestDB" name="jdbc/TestDB" type="oracle.jdbc.pool.OracleDataSource"/>

       

      but when i have run application i have got following error

      log-

      javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: invalid arguments in call"

        at org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:298)

        at org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:181)

        at org.apache.jsp.test_jsp._jspx_meth_sql_005fquery_005f0(test_jsp.java:110)

        at org.apache.jsp.test_jsp._jspService(test_jsp.java:63)

        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)

        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)

        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)

        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)

        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)

        at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:857)

        at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:565)

        at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1509)

        at java.lang.Thread.run(Thread.java:662)

      Aug 2, 2013 5:17:21 PM org.apache.catalina.core.StandardWrapperValve invoke

      SEVERE: Servlet.service() for servlet jsp threw exception

      javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: invalid arguments in call"

        at org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:298)

        at org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:181)

        at org.apache.jsp.test_jsp._jspx_meth_sql_005fquery_005f0(test_jsp.java:110)

        at org.apache.jsp.test_jsp._jspService(test_jsp.java:63)

        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)

        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)

        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)

        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)

        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)

        at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:857)

        at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:565)

        at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1509)

        at java.lang.Thread.run(Thread.java:662)

       

      so what is the solution how to create datasource on apche server which suitable for adf application?

       

      when i test data source using  following code used 1. way as i mentioned above  its running fine bt not for second.

      <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>

      <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

       

       

      <sql:query var="rs" dataSource="jdbc/TestDB">

      select empname from pay_emphdr where empcd='JK1306'

      </sql:query>

       

       

      <html>

        <head>

          <title>DB Test</title>

        </head>

        <body>

       

       

        <h2>Results</h2>

       

       

      <c:forEach var="row" items="${rs.rows}">

          Foo ${row.empname}<br/>

       

      </c:forEach>

       

       

        </body>

      </html>

       

      please help me. it is very urgent.

       

      thanks in Advance

       

      Manish