That is so fantastic! Well done. I was able to get it working. Perhaps
someone can explain the reasons for runtime exception complaining that the
jndi name was not bound in current context? The wiki is very good but I like
to understand the work behind the ecene a little too. My guess is that like
any resource we need to provide the jndi r tomcat resource in web.xml as
done on that wiki but this is certainly not clear from tomcat documentation.
Also, I am able to use that datasource in any webapp deployed with same
server, provided that I provide ach deployed webapp with the metadata
required? If so, there really is no point in tomcat documentation referring
to us putting the realm and datasource in server.xml if i won't work gobally
as the docs indicate it will.
--------------------------------------------------
From: "Mark Eggers" <its_toas...@yahoo.com>
Sent: Monday, June 14, 2010 11:45 PM
To: "Tomcat Users List" <users@tomcat.apache.org>
Subject: Re: hibernate not finding global resource datasource defined by
tomcat
Please read the following for a detailed description on how to configure
Hibernate to use JNDI resources supplied by Tomcat.
http://wiki.apache.org/tomcat/TomcatHibernate
Then you will need a <ResourceLink> element in META-INF/context.xml to
make the resource in <GlobalNamingResources> available to your
application.
The configuration for that information can be found here:
http://tomcat.apache.org/tomcat-6.0-doc/config/context.html#Resource%20Links
Finally, unless you place Tomcat's manager and admin application's
authentication and authorization information in your database, removing
the UserDatabaseRealm from <GlobalNamingResources> will prevent you from
using the manager and admin application.
You can place more than one <Resource> element in the
<GlobalNamingResources> element of your server.xml.
I'm trying to finish up a document on DataSourceRealms. Hopefully that
will get posted on Tomcat's Wiki today or tomorrow, depending on other
time constraints.
just my two cents . . . . .
/mde/
--- On Mon, 6/14/10, yucca...@live.co.za <yucca...@live.co.za> wrote:
Hello tomcats!!
Please advise as to why hibernate us unable to find jndi
datasource configured in tomcat?
Trying 2 different setups here:
1) server.xml resource as follows:
<GlobalNamingResources>
<!-- Editable user database that can also be used
by
UserDatabaseRealm to
authenticate users
-->
<Resource
name="jdbc/auth"
description="The
Jar Bar user authentication"
type="javax.sql.DataSource"
auth="Container"
driverClassName="com.mysql.jdbc.Driver"
maxActive="30" maxIdle="10"
maxWait="10000"
password="myPass"
url="jdbc:mysql://localhost:3306/yucca123_thejarbar"
validationQuery="/* ping */ SELECT
1"
username="yucca123_tom"/>
</GlobalNamingResources>
with hibernate.cfg.xml:
<?xml version='1.0'
encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property
name="connection.url">jdbc:mysql://localhost:3306/yucca123_thejarbar</property>
<property
name="hibernate.connection.datasource">java:comp/env/jdbc/auth"</property>
<property
name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property
name="connection.username">yucca123_tom</property>
<property
name="current_session_context_class">thread</property>
<property
name="connection.password">pookie123</property>
<mapping
resource="org/bar/jar/model/UserRolesEntity.hbm.xml"/>
<mapping
resource="org/bar/jar/model/UsercommentsEntity.hbm.xml"/>
<mapping
resource="org/bar/jar/model/UsersEntity.hbm.xml"/>
<!-- DB schema will be updated if needed -->
<!--
<property name="hbm2ddl.auto">update</property> -->
</session-factory>
</hibernate-configuration>
so I try
2) moving resource and realm element to context.xml with
adding localdatasource attribute to resource (true) and get same
exception?
What am I missing here?
tomcat is latest 6.0.26
mysql 5 with global connector (inside
common/lib)
Ideally I want the global(server.xml) config for the
resource as it WILL be shared among deployed applications, but because
this is
first application I am willing to use just contect configured
resource.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org