Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

problem with datasource

  Asked By: Annie    Date: Feb 10    Category: Java    Views: 716
  

I write web App and use jsf,hibernate,tomcat 5.5
when deploy web app than read the hibernate properties than when
opening jdbc connection the error occured that So Exception and can
not create poolabe connection
why/
i set my datasource in config xml in tomcat and web.xml in web-app but
can not connect with it
what is the best solution framework for web app ?
please help me

Share: 

 

3 Answers Found

 
Answer #1    Answered By: Addison Campbell     Answered On: Feb 10

It is always good that post your code snippet and exception  that system throws.
here is what i can suggest based on your post.
In tomcat, we create datasource  in server.xml and also we can use context.xml inside meta-inf folder to define a datasource.
Then we create  a reference to that datasource in our web.xml and use it in our web  based application.

When we use hibernate, usually we create a describe session factory configuration inside hibernate.cfg.xml or whatever its name is.
in the session factory configuration we can use a datasource as connection  provider for the session factory. in this case we use full JNDI name of datasource in a property named connection.datasource .

Now, by what you are doing and what i explained you may explain your problem  better.
Do you have JDBC driver of your database in shared lib folder of tomcat  or in the classpath?
Do you have problem with defining session factory?
Do you have problem to define a datasource in your Tomcat (do you tried tomcat administration?)
Do you have the datasource and you have problem to accessing it?

 
Answer #2    Answered By: Aaleyah Khan     Answered On: Feb 10

you can use seam examples,
seam has some examples which are using JSF and Hibernate with Seam framework.
they are bundled with ant builds for JBoss and Tomcat.
you can start with that project and modify the codes.

 
Answer #3    Answered By: Marta Kim     Answered On: Feb 10

Just dont forget to put the jdbc  driver of your database at <tomcat_home>/common/lib it is because of the tomcat  class loader. (Though it is not a good idea to bump up <tomcat_home>/common/lib with not necessary jar files. keep all required jar files for a web  application in WEB-INF/lib)
and also as a second guideline do not mess up server.xml of tomcat; instead put the datasource  definitions into META-INF/context.xml

 
Didn't find what you were looking for? Find more on problem with datasource Or get search suggestion and latest updates.




Tagged: