-----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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to