You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by SOPANMISHRA <so...@gmail.com> on 2010/12/09 18:33:02 UTC
Not supported by Basic Datasource
jdk-1.6_13 Tomcat-6.0.26 Hibernate 3.2
I'm getting the error "Not supported by BasicDataSource" while running a
project based on java-hibernate-tomcat server.
The project works fine if I use the normal jdbc process.
For configuring datasource I strictly followed the process mentioned in
Tomcat reference docs in the link:-
http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html
ie I'm configuring the project specific hibernate.cfg.xml,web.xml(project
specific) and context.xml(inside tomcat/conf).
hib.cfg.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property
name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property
name="hibernate.connection.datasource">java:comp/env/jdbc/aardb</property>
<property name="show_sql">false</property>
<property name="connection.pool_size">10</property>
<property name="current_session_context_class">thread</property>
<mapping class="com.asas.assasa.asas." />
</session-factory>
</hibernate-configuration>
web.xml
<resource-ref>
<description>AAR DATABASE</description>
<res-ref-name>jdbc/aardb</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
context.xml
<Resource
name="jdbc/aardb"
auth="Container"
type="javax.sql.DataSource"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@00.000.00.000:1521:DB1"
schema="xxxx"
username="xxxx"
password="xxx"
maxActive="10"
maxIdle="2"
maxWait="5000"
validationQuery="select 1 from dual"
/>
My StackTrace in my customized html that calls web service is as follows is
as follows:-
STATUS: 500
<?xml version='1.0' encoding='UTF-8'?><S:Envelope
xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><S:Fault
xmlns:ns4="http://www.w3.org/2003/05/soap-envelope"><faultcode>S:Server</faultcode><faultstring>Not
supported by BasicDataSource</faultstring><detail><ns2:ApplicationException
xmlns:ns2="http://service.services.agentevaluation.care.xxxxxxxx.com/"><message>Not
supported by
BasicDataSource</message></ns2:ApplicationException><ns2:exception
xmlns:ns2="http://jax-ws.dev.java.net/"
class="com.xxxxxxxx.care.agentevaluation.exceptions.ApplicationException"
note="To disable this feature, set
com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptureStackTrace system
property to false"><message>Not supported by
BasicDataSource</message><ns2:stackTrace><ns2:frame
class="com.xxxxxxxx.care.agentevaluation.business.manager.xxxxxxxx"
file="xxxxxxxx.java" line="100" method="searchAgent"/><ns2:frame
class="com.xxxxxxxx.care.agentevaluation.services.service.xxxxxxxxxxxxxxxxServiceMaster"
file="xxxxxxxxxxxxxxxxServiceMaster.java" line="78"
method="searchAgent"/><ns2:frame
class="sun.reflect.NativeMethodAccessorImpl"
file="NativeMethodAccessorImpl.java" line="native"
method="invoke0"/><ns2:frame class="sun.reflect.NativeMethodAccessorImpl"
file="NativeMethodAccessorImpl.java" line="39" method="invoke"/><ns2:frame
class="sun.reflect.DelegatingMethodAccessorImpl"
file="DelegatingMethodAccessorImpl.java" line="25"
method="invoke"/><ns2:frame class="java.lang.reflect.Method"
file="Method.java" line="597" method="invoke"/><ns2:frame
class="com.sun.xml.ws.api.server.InstanceResolver$1"
file="InstanceResolver.java" line="246" method="invoke"/><ns2:frame
class="com.sun.xml.ws.server.InvokerTube$2" file="InvokerTube.java"
line="146" method="invoke"/><ns2:frame
class="com.sun.xml.ws.server.sei.EndpointMethodHandler"
file="EndpointMethodHandler.java" line="257" method="invoke"/><ns2:frame
class="com.sun.xml.ws.server.sei.SEIInvokerTube" file="SEIInvokerTube.java"
line="93" method="processRequest"/><ns2:frame
class="com.sun.xml.ws.api.pipe.Fiber" file="Fiber.java" line="598"
method="__doRun"/><ns2:frame class="com.sun.xml.ws.api.pipe.Fiber"
file="Fiber.java" line="557" method="_doRun"/><ns2:frame
class="com.sun.xml.ws.api.pipe.Fiber" file="Fiber.java" line="542"
method="doRun"/><ns2:frame class="com.sun.xml.ws.api.pipe.Fiber"
file="Fiber.java" line="439" method="runSync"/><ns2:frame
class="com.sun.xml.ws.server.WSEndpointImpl$2" file="WSEndpointImpl.java"
line="243" method="process"/><ns2:frame
class="com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit"
file="HttpAdapter.java" line="471" method="handle"/><ns2:frame
class="com.sun.xml.ws.transport.http.HttpAdapter" file="HttpAdapter.java"
line="244" method="handle"/><ns2:frame
class="com.sun.xml.ws.transport.http.servlet.ServletAdapter"
file="ServletAdapter.java" line="135" method="handle"/><ns2:frame
class="com.sun.xml.ws.transport.http.servlet.WSServletDelegate"
file="WSServletDelegate.java" line="129" method="doGet"/><ns2:frame
class="com.sun.xml.ws.transport.http.servlet.WSServletDelegate"
file="WSServletDelegate.java" line="160" method="doPost"/><ns2:frame
class="com.sun.xml.ws.transport.http.servlet.WSServlet"
file="WSServlet.java" line="75" method="doPost"/><ns2:frame
class="javax.servlet.http.HttpServlet" file="HttpServlet.java" line="637"
method="service"/><ns2:frame class="javax.servlet.http.HttpServlet"
file="HttpServlet.java" line="717" method="service"/><ns2:frame
class="org.apache.catalina.core.ApplicationFilterChain"
file="ApplicationFilterChain.java" line="290"
method="internalDoFilter"/><ns2:frame
class="org.apache.catalina.core.ApplicationFilterChain"
file="ApplicationFilterChain.java" line="206" method="doFilter"/><ns2:frame
class="org.apache.catalina.core.StandardWrapperValve"
file="StandardWrapperValve.java" line="233" method="invoke"/><ns2:frame
class="org.apache.catalina.core.StandardContextValve"
file="StandardContextValve.java" line="191" method="invoke"/><ns2:frame
class="org.apache.catalina.core.StandardHostValve"
file="StandardHostValve.java" line="128" method="invoke"/><ns2:frame
class="org.apache.catalina.valves.ErrorReportValve"
file="ErrorReportValve.java" line="102" method="invoke"/><ns2:frame
class="org.apache.catalina.core.StandardEngineValve"
file="StandardEngineValve.java" line="109" method="invoke"/><ns2:frame
class="org.apache.catalina.connector.CoyoteAdapter"
file="CoyoteAdapter.java" line="293" method="service"/><ns2:frame
class="org.apache.coyote.http11.Http11Processor" file="Http11Processor.java"
line="849" method="process"/><ns2:frame
class="org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler"
file="Http11Protocol.java" line="583" method="process"/><ns2:frame
class="org.apache.tomcat.util.net.JIoEndpoint$Worker"
file="JIoEndpoint.java" line="454" method="run"/><ns2:frame
class="java.lang.Thread" file="Thread.java" line="619"
method="run"/></ns2:stackTrace></ns2:exception></detail></S:Fault></S:Body></S:Envelope>
The print stack trace in tomcat catalina.log:-
Dec 9, 2010 9:40:06 PM
com.xxxxxxxx.xxxxxxxx.agentevaluation.services.service.xxxxxxxx searchAgent
INFO: Web Service called.
Dec 9, 2010 9:40:06 PM
com.xxxxxxxx.xxxxxxxx.agentevaluation.services.service.xxxxxxxx searchAgent
INFO: Translation of Service to Business object completed.
Dec 9, 2010 9:40:06 PM com.xxxxxxxx.xxxxxxxx.agentevaluation.db.dao.xxxxxxxx
getAgentDetails
INFO: Query:SELECT coalesce(M.iataNo,' ') AS iataNo,coalesce(M.pcc,' ') AS
pcc FROM xxxxxxxx AS M WHERE M.pcc IN (:lst) ORDER BY M.iataNo,M.pcc
Dec 9, 2010 9:40:06 PM com.xxxxxxxx.xxxxxxxx.agentevaluation.db.dao.xxxxxxxx
getAgentDetails
WARNING: Exception occured in method:getAgentDetails:Message:Not supported
by BasicDataSource
Dec 9, 2010 9:40:07 PM
com.xxxxxxxx.xxxxxxxx.agentevaluation.business.manager.xxxxxxxxManager
searchAgent
WARNING: Exception occured in method:searchAgent:Message:Not supported by
BasicDataSource
Dec 9, 2010 9:40:07 PM
com.xxxxxxxx.xxxxxxxx.agentevaluation.services.service.xxxxxxxx searchAgent
WARNING: Exception occured in method:searchAgent:Message:Not supported by
BasicDataSource
I just want to enquire wether the coalesce query that i have written is
supported by basic data source or there is some other error
I'm referring to the tomcat link
=http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html
Sorry for not giving these vital info beforehand
I used the "javax.sql.ConnectionPoolDataSource" but it is giving the error
:-
INFO: Server startup in 2925 ms
Dec 9, 2010 9:59:21 PM
com.xxxxxxxx.care.agentevaluation.services.service.xxxxxxxx searchAgent
INFO: Web Service called.
Dec 9, 2010 9:59:21 PM
com.xxxxxxxx.care.agentevaluation.services.service.xxxxxxxx searchAgent
INFO: Translation of Service to Business object completed.
Dec 9, 2010 9:59:22 PM
com.xxxxxxxx.care.agentevaluation.db.dao.HibernateUtil <clinit>
WARNING: Exception building SessionFactory
Dec 9, 2010 9:59:22 PM com.sun.xml.ws.server.sei.EndpointMethodHandler
invoke
SEVERE: null
java.lang.ExceptionInInitializerError
at
com.xxxxxxxx.care.agentevaluation.db.dao.xxxxxxxx.getAgentDetails(xxxxxxxx.java:98)
at
com.xxxxxxxx.care.agentevaluation.business.manager.xxxxxxxx.searchAgent(xxxxxxxx.java:63)
at
com.xxxxxxxx.care.agentevaluation.services.service.xxxxxxxx.searchAgent(xxxxxxxx.java:78)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:246)
at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)
at
com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257)
at
com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:93)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:557)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:542)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:439)
at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:243)
at
com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:471)
at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
at
com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)
at
com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:129)
at
com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:160)
at com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
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:293)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.RuntimeException: Exception building SessionFactory:
Could not find datasource
at
com.xxxxxxxx.care.agentevaluation.db.dao.HibernateUtil.<clinit>(HibernateUtil.java:50)
... 36 more
My sriptlet
try {
sessionAar = HibernateUtil.currentAARSession();
// Forming the Array containing the Search Key Values
str = new ArrayList<String>();
str.add("");// adding a default value
str.addAll(agencyInformation.getSearchCriteria()
.getSearchKeyValues().getSearchKeyValue());
// Fetching the Required Fields and Order By sequence
retStr = formReqFieldStr(agencyInformation.getRequiredFields());
if (Validation.validate(retStr)) {
// Required Fields
reqFieldStr = retStr[0];
// Order By sequence
orderByStr = retStr[1];
}
// Forming the query
searchKey =
Validation.valid(agencyInformation.getSearchCriteria().getSearchKey());
tempQuery = new StringBuilder();
tempQuery.append("SELECT " + reqFieldStr
+ " FROM AgencyRegistrar AS M WHERE M."
+ representorMap.get(searchKey) + " IN (:lst) ORDER BY "
+ orderByStr);
LOGGER.info("Query:" + tempQuery.toString());
query = sessionAar.createSQLQuery(tempQuery.toString());
query.setParameterList("lst", str);
tempList = query.setResultTransformer(
Transformers.aliasToBean(AgencyRegistrar.class)).list();
} catch (Exception ex) {
ex.printStackTrace();
LOGGER.warning("Exception occured in method:getAgentDetails:Message:"
+ ex.getMessage());
ApplicationException apEx = new ApplicationException();
apEx.setMessage(ex.getMessage());
throw apEx;
} finally {
if (Validation.validate(sessionAar)) {
sessionAar.close();
}
}
return tempList;
}
Thanx a lot beforehand.Hope I can get my query resolved .
--
View this message in context: http://old.nabble.com/Not-supported-by-Basic-Datasource-tp30418811p30418811.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Not supported by Basic Datasource
Posted by Mark Eggers <it...@yahoo.com>.
>From a quick glance it looks like you're mixing Hibernate-controlled database
pooling with Tomcat-managed pooling.
Read this and see if that helps.
http://wiki.apache.org/tomcat/TomcatHibernate
. . . . just my two cents.
/mde/
----- Original Message ----
From: SOPANMISHRA <so...@gmail.com>
To: users@tomcat.apache.org
Sent: Thu, December 9, 2010 9:33:02 AM
Subject: Not supported by Basic Datasource
jdk-1.6_13 Tomcat-6.0.26 Hibernate 3.2
I'm getting the error "Not supported by BasicDataSource" while running a
project based on java-hibernate-tomcat server.
The project works fine if I use the normal jdbc process.
For configuring datasource I strictly followed the process mentioned in
Tomcat reference docs in the link:-
http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html
ie I'm configuring the project specific hibernate.cfg.xml,web.xml(project
specific) and context.xml(inside tomcat/conf).
hib.cfg.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property
name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property
name="hibernate.connection.datasource">java:comp/env/jdbc/aardb</property>
<property name="show_sql">false</property>
<property name="connection.pool_size">10</property>
<property name="current_session_context_class">thread</property>
<mapping class="com.asas.assasa.asas." />
</session-factory>
</hibernate-configuration>
web.xml
<resource-ref>
<description>AAR DATABASE</description>
<res-ref-name>jdbc/aardb</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
context.xml
<Resource
name="jdbc/aardb"
auth="Container"
type="javax.sql.DataSource"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@00.000.00.000:1521:DB1"
schema="xxxx"
username="xxxx"
password="xxx"
maxActive="10"
maxIdle="2"
maxWait="5000"
validationQuery="select 1 from dual"
/>
My StackTrace in my customized html that calls web service is as follows is
as follows:-
STATUS: 500
<?xml version='1.0' encoding='UTF-8'?><S:Envelope
xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><S:Fault
xmlns:ns4="http://www.w3.org/2003/05/soap-envelope"><faultcode>S:Server</faultcode><faultstring>Not
supported by BasicDataSource</faultstring><detail><ns2:ApplicationException
xmlns:ns2="http://service.services.agentevaluation.care.xxxxxxxx.com/"><message>Not
supported by
BasicDataSource</message></ns2:ApplicationException><ns2:exception
xmlns:ns2="http://jax-ws.dev.java.net/"
class="com.xxxxxxxx.care.agentevaluation.exceptions.ApplicationException"
note="To disable this feature, set
com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptureStackTrace system
property to false"><message>Not supported by
BasicDataSource</message><ns2:stackTrace><ns2:frame
class="com.xxxxxxxx.care.agentevaluation.business.manager.xxxxxxxx"
file="xxxxxxxx.java" line="100" method="searchAgent"/><ns2:frame
class="com.xxxxxxxx.care.agentevaluation.services.service.xxxxxxxxxxxxxxxxServiceMaster"
file="xxxxxxxxxxxxxxxxServiceMaster.java" line="78"
method="searchAgent"/><ns2:frame
class="sun.reflect.NativeMethodAccessorImpl"
file="NativeMethodAccessorImpl.java" line="native"
method="invoke0"/><ns2:frame class="sun.reflect.NativeMethodAccessorImpl"
file="NativeMethodAccessorImpl.java" line="39" method="invoke"/><ns2:frame
class="sun.reflect.DelegatingMethodAccessorImpl"
file="DelegatingMethodAccessorImpl.java" line="25"
method="invoke"/><ns2:frame class="java.lang.reflect.Method"
file="Method.java" line="597" method="invoke"/><ns2:frame
class="com.sun.xml.ws.api.server.InstanceResolver$1"
file="InstanceResolver.java" line="246" method="invoke"/><ns2:frame
class="com.sun.xml.ws.server.InvokerTube$2" file="InvokerTube.java"
line="146" method="invoke"/><ns2:frame
class="com.sun.xml.ws.server.sei.EndpointMethodHandler"
file="EndpointMethodHandler.java" line="257" method="invoke"/><ns2:frame
class="com.sun.xml.ws.server.sei.SEIInvokerTube" file="SEIInvokerTube.java"
line="93" method="processRequest"/><ns2:frame
class="com.sun.xml.ws.api.pipe.Fiber" file="Fiber.java" line="598"
method="__doRun"/><ns2:frame class="com.sun.xml.ws.api.pipe.Fiber"
file="Fiber.java" line="557" method="_doRun"/><ns2:frame
class="com.sun.xml.ws.api.pipe.Fiber" file="Fiber.java" line="542"
method="doRun"/><ns2:frame class="com.sun.xml.ws.api.pipe.Fiber"
file="Fiber.java" line="439" method="runSync"/><ns2:frame
class="com.sun.xml.ws.server.WSEndpointImpl$2" file="WSEndpointImpl.java"
line="243" method="process"/><ns2:frame
class="com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit"
file="HttpAdapter.java" line="471" method="handle"/><ns2:frame
class="com.sun.xml.ws.transport.http.HttpAdapter" file="HttpAdapter.java"
line="244" method="handle"/><ns2:frame
class="com.sun.xml.ws.transport.http.servlet.ServletAdapter"
file="ServletAdapter.java" line="135" method="handle"/><ns2:frame
class="com.sun.xml.ws.transport.http.servlet.WSServletDelegate"
file="WSServletDelegate.java" line="129" method="doGet"/><ns2:frame
class="com.sun.xml.ws.transport.http.servlet.WSServletDelegate"
file="WSServletDelegate.java" line="160" method="doPost"/><ns2:frame
class="com.sun.xml.ws.transport.http.servlet.WSServlet"
file="WSServlet.java" line="75" method="doPost"/><ns2:frame
class="javax.servlet.http.HttpServlet" file="HttpServlet.java" line="637"
method="service"/><ns2:frame class="javax.servlet.http.HttpServlet"
file="HttpServlet.java" line="717" method="service"/><ns2:frame
class="org.apache.catalina.core.ApplicationFilterChain"
file="ApplicationFilterChain.java" line="290"
method="internalDoFilter"/><ns2:frame
class="org.apache.catalina.core.ApplicationFilterChain"
file="ApplicationFilterChain.java" line="206" method="doFilter"/><ns2:frame
class="org.apache.catalina.core.StandardWrapperValve"
file="StandardWrapperValve.java" line="233" method="invoke"/><ns2:frame
class="org.apache.catalina.core.StandardContextValve"
file="StandardContextValve.java" line="191" method="invoke"/><ns2:frame
class="org.apache.catalina.core.StandardHostValve"
file="StandardHostValve.java" line="128" method="invoke"/><ns2:frame
class="org.apache.catalina.valves.ErrorReportValve"
file="ErrorReportValve.java" line="102" method="invoke"/><ns2:frame
class="org.apache.catalina.core.StandardEngineValve"
file="StandardEngineValve.java" line="109" method="invoke"/><ns2:frame
class="org.apache.catalina.connector.CoyoteAdapter"
file="CoyoteAdapter.java" line="293" method="service"/><ns2:frame
class="org.apache.coyote.http11.Http11Processor" file="Http11Processor.java"
line="849" method="process"/><ns2:frame
class="org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler"
file="Http11Protocol.java" line="583" method="process"/><ns2:frame
class="org.apache.tomcat.util.net.JIoEndpoint$Worker"
file="JIoEndpoint.java" line="454" method="run"/><ns2:frame
class="java.lang.Thread" file="Thread.java" line="619"
method="run"/></ns2:stackTrace></ns2:exception></detail></S:Fault></S:Body></S:Envelope>
The print stack trace in tomcat catalina.log:-
Dec 9, 2010 9:40:06 PM
com.xxxxxxxx.xxxxxxxx.agentevaluation.services.service.xxxxxxxx searchAgent
INFO: Web Service called.
Dec 9, 2010 9:40:06 PM
com.xxxxxxxx.xxxxxxxx.agentevaluation.services.service.xxxxxxxx searchAgent
INFO: Translation of Service to Business object completed.
Dec 9, 2010 9:40:06 PM com.xxxxxxxx.xxxxxxxx.agentevaluation.db.dao.xxxxxxxx
getAgentDetails
INFO: Query:SELECT coalesce(M.iataNo,' ') AS iataNo,coalesce(M.pcc,' ') AS
pcc FROM xxxxxxxx AS M WHERE M.pcc IN (:lst) ORDER BY M.iataNo,M.pcc
Dec 9, 2010 9:40:06 PM com.xxxxxxxx.xxxxxxxx.agentevaluation.db.dao.xxxxxxxx
getAgentDetails
WARNING: Exception occured in method:getAgentDetails:Message:Not supported
by BasicDataSource
Dec 9, 2010 9:40:07 PM
com.xxxxxxxx.xxxxxxxx.agentevaluation.business.manager.xxxxxxxxManager
searchAgent
WARNING: Exception occured in method:searchAgent:Message:Not supported by
BasicDataSource
Dec 9, 2010 9:40:07 PM
com.xxxxxxxx.xxxxxxxx.agentevaluation.services.service.xxxxxxxx searchAgent
WARNING: Exception occured in method:searchAgent:Message:Not supported by
BasicDataSource
I just want to enquire wether the coalesce query that i have written is
supported by basic data source or there is some other error
I'm referring to the tomcat link
=http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html
Sorry for not giving these vital info beforehand
I used the "javax.sql.ConnectionPoolDataSource" but it is giving the error
:-
INFO: Server startup in 2925 ms
Dec 9, 2010 9:59:21 PM
com.xxxxxxxx.care.agentevaluation.services.service.xxxxxxxx searchAgent
INFO: Web Service called.
Dec 9, 2010 9:59:21 PM
com.xxxxxxxx.care.agentevaluation.services.service.xxxxxxxx searchAgent
INFO: Translation of Service to Business object completed.
Dec 9, 2010 9:59:22 PM
com.xxxxxxxx.care.agentevaluation.db.dao.HibernateUtil <clinit>
WARNING: Exception building SessionFactory
Dec 9, 2010 9:59:22 PM com.sun.xml.ws.server.sei.EndpointMethodHandler
invoke
SEVERE: null
java.lang.ExceptionInInitializerError
at
com.xxxxxxxx.care.agentevaluation.db.dao.xxxxxxxx.getAgentDetails(xxxxxxxx.java:98)
at
com.xxxxxxxx.care.agentevaluation.business.manager.xxxxxxxx.searchAgent(xxxxxxxx.java:63)
at
com.xxxxxxxx.care.agentevaluation.services.service.xxxxxxxx.searchAgent(xxxxxxxx.java:78)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:246)
at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)
at
com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257)
at
com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:93)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:557)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:542)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:439)
at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:243)
at
com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:471)
at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
at
com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)
at
com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:129)
at
com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:160)
at com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
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:293)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.RuntimeException: Exception building SessionFactory:
Could not find datasource
at
com.xxxxxxxx.care.agentevaluation.db.dao.HibernateUtil.<clinit>(HibernateUtil.java:50)
... 36 more
My sriptlet
try {
sessionAar = HibernateUtil.currentAARSession();
// Forming the Array containing the Search Key Values
str = new ArrayList<String>();
str.add("");// adding a default value
str.addAll(agencyInformation.getSearchCriteria()
.getSearchKeyValues().getSearchKeyValue());
// Fetching the Required Fields and Order By sequence
retStr = formReqFieldStr(agencyInformation.getRequiredFields());
if (Validation.validate(retStr)) {
// Required Fields
reqFieldStr = retStr[0];
// Order By sequence
orderByStr = retStr[1];
}
// Forming the query
searchKey =
Validation.valid(agencyInformation.getSearchCriteria().getSearchKey());
tempQuery = new StringBuilder();
tempQuery.append("SELECT " + reqFieldStr
+ " FROM AgencyRegistrar AS M WHERE M."
+ representorMap.get(searchKey) + " IN (:lst) ORDER BY "
+ orderByStr);
LOGGER.info("Query:" + tempQuery.toString());
query = sessionAar.createSQLQuery(tempQuery.toString());
query.setParameterList("lst", str);
tempList = query.setResultTransformer(
Transformers.aliasToBean(AgencyRegistrar.class)).list();
} catch (Exception ex) {
ex.printStackTrace();
LOGGER.warning("Exception occured in method:getAgentDetails:Message:"
+ ex.getMessage());
ApplicationException apEx = new ApplicationException();
apEx.setMessage(ex.getMessage());
throw apEx;
} finally {
if (Validation.validate(sessionAar)) {
sessionAar.close();
}
}
return tempList;
}
Thanx a lot beforehand.Hope I can get my query resolved .
--
View this message in context:
http://old.nabble.com/Not-supported-by-Basic-Datasource-tp30418811p30418811.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Not supported by Basic Datasource
Posted by Mark Eggers <it...@yahoo.com>.
In your first message, did you post your complete hibernate configuration file?
I'm asking because of two issues.
1. You don't need the following line if you're using Tomcat's database pooling:
<property name="connection.pool_size">10</property>
2. From a quick google search on Tomcat, Hibernate, Oracle, and "Not supported
by BasicDataSource", I find the following:
java.lang.UnsupportedOperationException: Not supported by BasicDataSource at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:899)
which is caused by trying to use Datasource.getConnection(username,password).
This is not supported.
The underlying cause for using that method signature is the following two lines
in a hibernate configuration file (which is why I asked if you posted your
complete configuration file):
<property name="hibernate.connection.username" value="xxxx"/>
<property name="hibernate.connection.password" value="xxxx"/>
Remove the above two lines if they exist in your hibernate configuration file.
The user name and password exist in the META-INF/context.xml file.
. . . . hope that helps.
/mde/
----- Original Message ----
From: SOPANMISHRA <so...@gmail.com>
To: users@tomcat.apache.org
Sent: Fri, December 10, 2010 6:51:43 AM
Subject: Re: Not supported by Basic Datasource
1.By normal jdbc process means without implementing any datasource concept in
tomcat for my project evrything is working fine.It is just when i do
datasource config I'm facing "not supported by basic data source" against a
method that uses a stringbuilder to form a query by retrieving values from a
jsp page dynamically
if (Validation.validate(defRetrivalFields)) {
defRetrivalFieldsArr = defRetrivalFields.split(",");
int defRetrivalFieldsArrLen = defRetrivalFieldsArr.length;
for (int i = 0; i < defRetrivalFieldsArrLen; i++) {
tempRepresentData = representorMap
.get(defRetrivalFieldsArr[i]);
if ("gaGrpCd".equalsIgnoreCase(tempRepresentData)
|| "taCd".equalsIgnoreCase(tempRepresentData)) {
formedReqField.append("coalesce(M." + tempRepresentData
+ ",'-1') AS " + tempRepresentData);
} else if (("pccDteCreate"
.equalsIgnoreCase(tempRepresentData)
|| "pccDteUpdated"
.equalsIgnoreCase(tempRepresentData) ||
("lastUpdate"
.equalsIgnoreCase(tempRepresentData)))) {
formedReqField.append("M." + tempRepresentData + " AS "
+ tempRepresentData);
} else {
formedReqField.append("coalesce(M." + tempRepresentData
+ ",' ') AS " + tempRepresentData);
}
orderByField.append("M." + tempRepresentData);
if (i != (defRetrivalFieldsArrLen - 1)) {
formedReqField.append(",");
orderByField.append(",");
}
tempRepresentData = null;
}
}
retStr[0] = formedReqField.toString();
retStr[1] = orderByField.toString();
}
return retStr;
2.I tried various data source possible - <resource
type=javax.sql.DataSource/javax.sql.ConnectionPoolDataSource but to no avail
3.driverClassName="oracle.jdbc.driver.OracleDriver"/"oracle.jdbc.OracleDriver"
4.The complete java stack trace is while processing the soap message
request:-
Dec 10, 2010 8:13:46 PM com.xxxxxxxx.care.agentevaluation.db.dao.xxxxxxxx
getAgentDetails
INFO: Query:SELECT coalesce(M.iataNo,' ') AS iataNo,coalesce(M.pcc,' ') AS
pcc FROM xxxxxxxx AS M WHERE M.pcc IN (:lst) ORDER BY M.iataNo,M.pcc
java.lang.UnsupportedOperationException: Not supported by BasicDataSource
at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:899)
at
org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:89)
at
org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
at
org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
at
org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1573)
at org.hibernate.loader.Loader.doQuery(Loader.java:696)
at
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
at org.hibernate.loader.Loader.doList(Loader.java:2228)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
at org.hibernate.loader.Loader.list(Loader.java:2120)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:312)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1722)
at
org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:175)
at
com.xxxxxxxx.care.agentevaluation.db.dao.xxxxxxxx.getAgentDetails(xxxxxxxx.java:131)
at
com.xxxxxxxx.care.agentevaluation.business.manager.xxxxxxxxManager.searchAgent(xxxxxxxxManager.java:64)
at
com.xxxxxxxx.care.agentevaluation.services.service.xxxxxxxxServiceMaster.searchAgent(xxxxxxxxServiceMaster.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:246)
at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)
at
com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257)
at
com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:93)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:557)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:542)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:439)
at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:243)
at
com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:471)
at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
at
com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)
at
com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:129)
at
com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:160)
at
com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
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:293)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Thread.java:619)
Dec 10, 2010 8:13:46 PM com.xxxxxxxx.care.agentevaluation.db.dao.xxxxxxxx
getAgentDetails
WARNING: Exception occured in method:getAgentDetails:Message:Not supported
by BasicDataSource
Dec 10, 2010 8:13:46 PM
com.xxxxxxxx.care.agentevaluation.business.manager.xxxxxxxxManager
searchAgent
WARNING: Exception occured in method:searchAgent:Message:Not supported by
BasicDataSource
com.xxxxxxxx.care.agentevaluation.exceptions.ApplicationException: Not
supported by BasicDataSource
at
com.xxxxxxxx.care.agentevaluation.business.manager.xxxxxxxxManager.searchAgent(xxxxxxxxManager.java:100)
at
com.xxxxxxxx.care.agentevaluation.services.service.xxxxxxxxServiceMaster.searchAgent(xxxxxxxxServiceMaster.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:246)
at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)
at
com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257)
at
com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:93)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:557)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:542)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:439)
at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:243)
at
com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:471)
at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
at
com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)
at
com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:129)
at
com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:160)
at
com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
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:293)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Thread.java:619)
Dec 10, 2010 8:13:46 PM
com.xxxxxxxx.care.agentevaluation.services.service.xxxxxxxxServiceMaster
searchAgent
WARNING: Exception occured in method:searchAgent:Message:Not supported by
BasicDataSource
5.I understand that datasource configuration is a separate entity and does
not depend on the SQL query i have written in my .java file that is fetched
using hibernate but still I want to enquire whether "coalesce" that i'm
using in the dynamic query creation is the culprit because the exception is
occurring when the method returning this processed query is returned as you
can see in the scriptlet
6.the <reqfieldtype,colHeaderRequired etc> and other are values saved into
session from user input page and then requested wherever required
7.I understand u are stressing on code optimization as
(stringbuilder,finally) but my main problem is the functionality that i have
to meet using data source and only after that I can stress upon code
enhancement.i have noted and will implement it.The fact is the project is in
testing environment and i have to implement the datasource and verify again
including final code optimization without which it cannot be tested and put
into production.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Not supported by Basic Datasource
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
SOPANMISHRA,
On 12/10/2010 9:51 AM, SOPANMISHRA wrote:
> 1.By normal jdbc process means without implementing any datasource concept in
> tomcat for my project evrything is working fine.
Glad to hear it.
> It is just when i do
> datasource config I'm facing "not supported by basic data source" against a
> method that uses a stringbuilder to form a query by retrieving values from a
> jsp page dynamically
The source of the query is not relevant: whether you use a StringBuilder
or a plain-old String (which is what you get, anyway), it's just a query
to the JDBC driver.
> if (Validation.validate(defRetrivalFields)) {
>
> [snip]
>
> }
> return retStr;
None of that code had anything to do with Hibernate or a DataSource.
> 2.I tried various data source possible - <resource
> type=javax.sql.DataSource/javax.sql.ConnectionPoolDataSource but to no avail
Case matters: you need to have <Resource> in your configuration. You
need to have type="javax.sql.DataSource", otherwise the DataSource won't
be created at all (and you should get an error message in catalina.out).
> 3.driverClassName="oracle.jdbc.driver.OracleDriver"/"oracle.jdbc.OracleDriver"
You might want to determine which one of these is more appropriate for
you to use and stick with it.
> 4.The complete java stack trace is while processing the soap message
> request:-
>
> Dec 10, 2010 8:13:46 PM com.xxxxxxxx.care.agentevaluation.db.dao.xxxxxxxx
> getAgentDetails
> INFO: Query:SELECT coalesce(M.iataNo,' ') AS iataNo,coalesce(M.pcc,' ') AS
> pcc FROM xxxxxxxx AS M WHERE M.pcc IN (:lst) ORDER BY M.iataNo,M.pcc
> java.lang.UnsupportedOperationException: Not supported by BasicDataSource
> at
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:899)
A call to getConnection will occur /before/ the query is executed. I
suspect that if you were to issue the query "SELECT 1 FROM DUAL" you'd
get the same error. I think this has nothing to do with your query at all.
BasicDataSource.getConnection in DBCP-1.2.2 only throws
UnsupportedOperationException when you call getConnection(String
username, String password) on the DataSource. Does your Hibernate
configuration specify a username and password? If so, you should remove
those and allow Hibernate to use the pool without specifying
credentials. I suspect this will clear-up your problem.
> 5.I understand that datasource configuration is a separate entity and does
> not depend on the SQL query i have written in my .java file that is fetched
> using hibernate but still I want to enquire whether "coalesce" that i'm
> using in the dynamic query creation is the culprit because the exception is
> occurring when the method returning this processed query is returned as you
> can see in the scriptlet
No. No part of the query here is a problem.
> 6.the <reqfieldtype,colHeaderRequired etc> and other are values saved into
> session from user input page and then requested wherever required
That doesn't make them trusted.
> 7.I understand u are stressing on code optimization as
> (stringbuilder,finally) but my main problem is the functionality that i have
> to meet using data source and only after that I can stress upon code
> enhancement.i have noted and will implement it.The fact is the project is in
> testing environment and i have to implement the datasource and verify again
> including final code optimization without which it cannot be tested and put
> into production.
Certainly correctness is key, but security is a part of correctness.
Good luck,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk0CdyUACgkQ9CaO5/Lv0PCWTQCffTCmaueprea8cJbwN8xPz1FB
8b4AoIS93YHsnB9vHZ1hSynNfNVl/h4e
=NE93
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Not supported by Basic Datasource
Posted by SOPANMISHRA <so...@gmail.com>.
1.By normal jdbc process means without implementing any datasource concept in
tomcat for my project evrything is working fine.It is just when i do
datasource config I'm facing "not supported by basic data source" against a
method that uses a stringbuilder to form a query by retrieving values from a
jsp page dynamically
if (Validation.validate(defRetrivalFields)) {
defRetrivalFieldsArr = defRetrivalFields.split(",");
int defRetrivalFieldsArrLen = defRetrivalFieldsArr.length;
for (int i = 0; i < defRetrivalFieldsArrLen; i++) {
tempRepresentData = representorMap
.get(defRetrivalFieldsArr[i]);
if ("gaGrpCd".equalsIgnoreCase(tempRepresentData)
|| "taCd".equalsIgnoreCase(tempRepresentData)) {
formedReqField.append("coalesce(M." + tempRepresentData
+ ",'-1') AS " + tempRepresentData);
} else if (("pccDteCreate"
.equalsIgnoreCase(tempRepresentData)
|| "pccDteUpdated"
.equalsIgnoreCase(tempRepresentData) || ("lastUpdate"
.equalsIgnoreCase(tempRepresentData)))) {
formedReqField.append("M." + tempRepresentData + " AS "
+ tempRepresentData);
} else {
formedReqField.append("coalesce(M." + tempRepresentData
+ ",' ') AS " + tempRepresentData);
}
orderByField.append("M." + tempRepresentData);
if (i != (defRetrivalFieldsArrLen - 1)) {
formedReqField.append(",");
orderByField.append(",");
}
tempRepresentData = null;
}
}
retStr[0] = formedReqField.toString();
retStr[1] = orderByField.toString();
}
return retStr;
2.I tried various data source possible - <resource
type=javax.sql.DataSource/javax.sql.ConnectionPoolDataSource but to no avail
3.driverClassName="oracle.jdbc.driver.OracleDriver"/"oracle.jdbc.OracleDriver"
4.The complete java stack trace is while processing the soap message
request:-
Dec 10, 2010 8:13:46 PM com.xxxxxxxx.care.agentevaluation.db.dao.xxxxxxxx
getAgentDetails
INFO: Query:SELECT coalesce(M.iataNo,' ') AS iataNo,coalesce(M.pcc,' ') AS
pcc FROM xxxxxxxx AS M WHERE M.pcc IN (:lst) ORDER BY M.iataNo,M.pcc
java.lang.UnsupportedOperationException: Not supported by BasicDataSource
at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:899)
at
org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:89)
at
org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
at
org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
at
org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1573)
at org.hibernate.loader.Loader.doQuery(Loader.java:696)
at
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
at org.hibernate.loader.Loader.doList(Loader.java:2228)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
at org.hibernate.loader.Loader.list(Loader.java:2120)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:312)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1722)
at
org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:175)
at
com.xxxxxxxx.care.agentevaluation.db.dao.xxxxxxxx.getAgentDetails(xxxxxxxx.java:131)
at
com.xxxxxxxx.care.agentevaluation.business.manager.xxxxxxxxManager.searchAgent(xxxxxxxxManager.java:64)
at
com.xxxxxxxx.care.agentevaluation.services.service.xxxxxxxxServiceMaster.searchAgent(xxxxxxxxServiceMaster.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:246)
at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)
at
com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257)
at
com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:93)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:557)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:542)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:439)
at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:243)
at
com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:471)
at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
at
com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)
at
com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:129)
at
com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:160)
at
com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
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:293)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Thread.java:619)
Dec 10, 2010 8:13:46 PM com.xxxxxxxx.care.agentevaluation.db.dao.xxxxxxxx
getAgentDetails
WARNING: Exception occured in method:getAgentDetails:Message:Not supported
by BasicDataSource
Dec 10, 2010 8:13:46 PM
com.xxxxxxxx.care.agentevaluation.business.manager.xxxxxxxxManager
searchAgent
WARNING: Exception occured in method:searchAgent:Message:Not supported by
BasicDataSource
com.xxxxxxxx.care.agentevaluation.exceptions.ApplicationException: Not
supported by BasicDataSource
at
com.xxxxxxxx.care.agentevaluation.business.manager.xxxxxxxxManager.searchAgent(xxxxxxxxManager.java:100)
at
com.xxxxxxxx.care.agentevaluation.services.service.xxxxxxxxServiceMaster.searchAgent(xxxxxxxxServiceMaster.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:246)
at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)
at
com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257)
at
com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:93)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:557)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:542)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:439)
at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:243)
at
com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:471)
at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
at
com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)
at
com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:129)
at
com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:160)
at
com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
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:293)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Thread.java:619)
Dec 10, 2010 8:13:46 PM
com.xxxxxxxx.care.agentevaluation.services.service.xxxxxxxxServiceMaster
searchAgent
WARNING: Exception occured in method:searchAgent:Message:Not supported by
BasicDataSource
5.I understand that datasource configuration is a separate entity and does
not depend on the SQL query i have written in my .java file that is fetched
using hibernate but still I want to enquire whether "coalesce" that i'm
using in the dynamic query creation is the culprit because the exception is
occurring when the method returning this processed query is returned as you
can see in the scriptlet
6.the <reqfieldtype,colHeaderRequired etc> and other are values saved into
session from user input page and then requested wherever required
7.I understand u are stressing on code optimization as
(stringbuilder,finally) but my main problem is the functionality that i have
to meet using data source and only after that I can stress upon code
enhancement.i have noted and will implement it.The fact is the project is in
testing environment and i have to implement the datasource and verify again
including final code optimization without which it cannot be tested and put
into production.
--
View this message in context: http://old.nabble.com/Not-supported-by-Basic-Datasource-tp30418811p30426773.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Not supported by Basic Datasource
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
SOPANMISHRA,
On 12/9/2010 12:33 PM, SOPANMISHRA wrote:
> I'm getting the error "Not supported by BasicDataSource" while running a
> project based on java-hibernate-tomcat server.
> The project works fine if I use the normal jdbc process.
What is the "normal JDBC process"?
> For configuring datasource I strictly followed the process mentioned in
> Tomcat reference docs in the link:-
> http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html
Is the above not "normal"?
> ie I'm configuring the project specific hibernate.cfg.xml,web.xml(project
> specific) and context.xml(inside tomcat/conf).
Specifying your <Resource> in conf/context.xml will define the
datasource for all deployed webapps. Is that what you meant to do?
Perhaps you meant to use WEB-INF/context.xml within your webapp.
> My StackTrace in my customized html that calls web service is as follows is
> as follows:-
> STATUS: 500
> <?xml version='1.0' encoding='UTF-8'?><S:Envelope
> xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><S:Fault
> xmlns:ns4="http://www.w3.org/2003/05/soap-envelope"><faultcode>S:Server</faultcode><faultstring>Not
> supported by BasicDataSource</faultstring><detail><ns2:ApplicationException
> xmlns:ns2="http://service.services.agentevaluation.care.xxxxxxxx.com/"><message>Not
> supported by
> BasicDataSource</message></ns2:ApplicationException><ns2:exception
> xmlns:ns2="http://jax-ws.dev.java.net/"
> class="com.xxxxxxxx.care.agentevaluation.exceptions.ApplicationException"
> note="To disable this feature, set
> com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptureStackTrace system
> property to false"><message>Not supported by
> BasicDataSource</message>
This is completely unreadable. Could you post this as plain-text please?
> I just want to enquire wether the coalesce query that i have written is
> supported by basic data source or there is some other error
The query should have nothing to do with the DataSource itself -- it
only manages database connections... it should pass-through your queries
to the database.
> I used the "javax.sql.ConnectionPoolDataSource" but it is giving the error
> :-
Where did you "use" javax.sql.ConnectionPoolDataSource?
> tempQuery = new StringBuilder();
> tempQuery.append("SELECT " + reqFieldStr
> + " FROM AgencyRegistrar AS M WHERE M."
> + representorMap.get(searchKey) + " IN (:lst) ORDER BY "
> + orderByStr);
Two comments:
1. It's kind of silly to use a StringBuilder and then use the String
concatenation operator (+) because you're then creating /two/
StringBuilder objects instead of just one. I recommend removing your use
of StringBuilder altogether and let the compiler handle things.
2. I'm not sure where the "reqFieldStr" comes from, but is it trusted?
If it's not completely trusted, you have a SQL injection vulnerability,
here. Same with "representorMap.get(searchKey)" and "orderByStr"
> } catch (Exception ex) {
> ex.printStackTrace();
> LOGGER.warning("Exception occured in method:getAgentDetails:Message:"
> + ex.getMessage());
Consider logging the exception itself, not just the message:
LOGGER.warning("Exception occured in method:getAgentDetails:Message:"
+ ex.getMessage(), ex);
> ApplicationException apEx = new ApplicationException();
> apEx.setMessage(ex.getMessage());
> throw apEx;
Note that you are swallowing the /real/ exception and replacing it with
only the message it generated.
> } finally {
> if (Validation.validate(sessionAar)) {
> sessionAar.close();
> }
> }
You might want to use a different predicate, here: I would close
sessionAar if it needs to be closed, not only if the validation
succeeds. Remember: someone else might modify your code and not look at
the finally block.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk0BPa8ACgkQ9CaO5/Lv0PBsvwCbBBEQzjO+Z0wGWIxnQx6gmOf+
/DEAn1BiUWow1G/AtqTSgBtHwuEeeBWQ
=I642
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Not supported by Basic Datasource
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Phil,
On 12/14/2010 7:10 AM, Phil Steitz wrote:
> On Tue, Dec 14, 2010 at 6:42 AM, SOPANMISHRA <so...@gmail.com> wrote:
>> 1. I have posted the exact tags that i'm using in my hibernate.cfg.xml
>> 2. regarding the BasicDataSource.getConnection in DBCP-1.2.2 ,I have not
>> mentioned username,password tag in my hibernate.cfg.xml so is there any
>> other bug?
>>
>
> I am not a hibernate expert, but the DBCP exception that you are getting is
> the result of the hibernate code calling getConnection(username,password),
> as opposed to getConnectio().
Yup. Seems like this is a question for the Hibernate forum, since the
problem is triggered somehow by their code:
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:899)
> at
> org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:89)
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk0HgxQACgkQ9CaO5/Lv0PA+lQCgscVOh/IDQgTy5r/b7n81seDV
xVsAoL9Oklgz7CRdsWUIDV8xAQeguntg
=OEBB
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Not supported by Basic Datasource
Posted by Phil Steitz <ph...@gmail.com>.
On Tue, Dec 14, 2010 at 6:42 AM, SOPANMISHRA <so...@gmail.com> wrote:
>
> 1. I have posted the exact tags that i'm using in my hibernate.cfg.xml
> 2. regarding the BasicDataSource.getConnection in DBCP-1.2.2 ,I have not
> mentioned username,password tag in my hibernate.cfg.xml so is there any
> other bug?
>
I am not a hibernate expert, but the DBCP exception that you are getting is
the result of the hibernate code calling getConnection(username,password),
as opposed to getConnectio(). The former is not supported by DBCP. The
pool creates connections using credentials provided in its configuration.
These credentials, and the other JDBC connection properties, apply to all
connections managed by the pool. You can't override them on individual
getConnection requests and they must be provided in the conifg.
Phil
3. Till now I have configured my files as asked by Chris & Mark
> 4. I'm configuring application specific requirements in the
> D:\apache-tomcat-6.0.26\conf\context.xml
> 5. If the data source works out then I will configure META-INF\context.xml
> for being project specific
> 6. I tried removing <property name="connection.pool_size">10</property>
> 7. The error still prevails-"Not supported by BasicDataSource"
>
> --
> View this message in context:
> http://old.nabble.com/Not-supported-by-Basic-Datasource-tp30418811p30453889.html
> Sent from the Tomcat - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: Not supported by Basic Datasource
Posted by SOPANMISHRA <so...@gmail.com>.
1. I have posted the exact tags that i'm using in my hibernate.cfg.xml
2. regarding the BasicDataSource.getConnection in DBCP-1.2.2 ,I have not
mentioned username,password tag in my hibernate.cfg.xml so is there any
other bug?
3. Till now I have configured my files as asked by Chris & Mark
4. I'm configuring application specific requirements in the
D:\apache-tomcat-6.0.26\conf\context.xml
5. If the data source works out then I will configure META-INF\context.xml
for being project specific
6. I tried removing <property name="connection.pool_size">10</property>
7. The error still prevails-"Not supported by BasicDataSource"
--
View this message in context: http://old.nabble.com/Not-supported-by-Basic-Datasource-tp30418811p30453889.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org