These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 
Author Message
 Post subject: Configure DataSource-Basic Datasource Not Found
PostPosted: Wed Dec 08, 2010 9:16 am 
Newbie

Joined: Wed Dec 08, 2010 8:56 am
Posts: 3
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-4.1-doc ... 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"
/>


IThanx a lot beforehand.Hope I can get my query resolved .


Top
 Profile  
 
 Post subject: Re: Configure DataSource-Basic Datasource Not Found
PostPosted: Thu Dec 09, 2010 11:02 am 
Newbie

Joined: Mon Nov 19, 2007 1:57 pm
Posts: 14
Doc for version Tomcat version 4.1. If you use later version, please check this link
http://www.teradata.com/DownloadCenter/Topic9364-98-1.aspx
Guess, this question more applied to Tomcat forum.


Top
 Profile  
 
 Post subject: Re: Configure DataSource-Basic Datasource Not Found
PostPosted: Thu Dec 09, 2010 12:41 pm 
Newbie

Joined: Wed Dec 08, 2010 8:56 am
Posts: 3
pasha701 wrote:
Doc for version Tomcat version 4.1. If you use later version, please check this link
http://www.teradata.com/DownloadCenter/Topic9364-98-1.aspx
Guess, this question more applied to Tomcat forum.


To be specific I'm using jdk6_13 Tomcat-6.0.24 Oracle 10g Hibernate 3.2
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 link for datasource in tomcat 6 =http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html
Sorry for not giving these vital info beforehand


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;
}





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;


Top
 Profile  
 
 Post subject: Re: Configure DataSource-Basic Datasource Not Found
PostPosted: Fri Dec 10, 2010 4:44 am 
Newbie

Joined: Mon Nov 19, 2007 1:57 pm
Posts: 14
Variant of cause can be:
Quote:
Note:Tomcat 5.5 and 6.0 both do not support the Datasource.getConnection(username,password) method.

Have you posted all hibernate config file? Maybe in real username and password specified?


Top
 Profile  
 
 Post subject: Re: Configure DataSource-Basic Datasource Not Found
PostPosted: Sun Dec 12, 2010 3:24 am 
Newbie

Joined: Tue Nov 16, 2010 9:43 am
Posts: 19
<?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">

<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>
<!-- a SessionFactory instance listed as /jndi/name -->
<session-factory name="java:hibernate/SessionFactory">
<!-- properties -->
<property name="connection.datasource">
java:/comp/env/jdbc/myoracle
</property>
<property name="dialect">
org.hibernate.dialect.Oracle9Dialect
</property>
<property name="show_sql">true</property>

<mapping resource="./Users1.hbm.xml" />
<mapping resource="./Phonenumber.hbm.xml" />

</session-factory>

</hibernate-configuration>
----------------------------
in web.xml

<resource-ref>
<description>Oracle Datasource example</description>
<res-ref-name>jdbc/myoracle</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>


in context.xml
whatever u did,.. is ok


Top
 Profile  
 
 Post subject: Re: Configure DataSource-Basic Datasource Not Found
PostPosted: Tue Dec 14, 2010 7:48 am 
Newbie

Joined: Wed Dec 08, 2010 8:56 am
Posts: 3
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. I'm configuring application specific requirements in the D:\apache-tomcat-6.0.26\conf\context.xml
4. If the data source works out then I will configure META-INF\context.xml for being project specific
5. I tried removing <property name="connection.pool_size">10</property>
6. The error still prevails-"Not supported by BasicDataSource"


Top
 Profile  
 
 Post subject: Re: Configure DataSource-Basic Datasource Not Found
PostPosted: Fri Dec 17, 2010 4:47 am 
Newbie

Joined: Mon Nov 19, 2007 1:57 pm
Posts: 14
Property
Code:
schema="xxxx"

is not supported by BasicDataSource.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.