Re: hibernate not finding global resource datasource defined by tomcat

2010-06-15 Thread Mark Eggers
My bad.

Copy and paste laziness led to a stray localDataSource="true" attribute winding 
up in my server.xml Realm definition.

Fixed, and now everything works as expected. Back to writing.

/mde/

--- On Mon, 6/14/10, Mark Thomas  wrote:

> From: Mark Thomas 
> Subject: Re: hibernate not finding global resource datasource defined by 
> tomcat
> To: "Tomcat Users List" 
> Date: Monday, June 14, 2010, 11:31 PM
> On 15/06/2010 02:21, Mark Eggers
> wrote:
> > Sure, I can make an attempt at it. I'd like to finish
> the wiki entry first. What I'm writing though will have to
> be drastically shortened for the documentation page I
> think.
> >
> > I just ran into a bit of a puzzle though. I was trying
> to unravel what happens when you put everything into
> server.xml and use a CombinedRealm. Under Linux, I had to
> add a ResourceLink element to my context.xml in order to use
> the sub-Realm.
> >
> > I can understand that I need a ResourceLink when I put
> the Resource in GlobalNamingResources and the Realm in
> context.xml, but I was rather surprised that I needed the
> ResourceLink when both are in server.xml.
> >
> > I'll see if I can reproduce this on Windows/XP (make
> sure I've done everything in a reasonable order).
> >
> > If that is indeed the case, can someone explain:
> >
> > 1. Context.xml - everything
> >     no ResourceLink needed
> (obviously)
> > 2. Context.xml - Realm, server.xml Resource in
> GlobalNamingResources
> >     ResourceLink needed
> (obviously)
> > 3. Server.xml - CombinedRealm, Resource in
> GlobalNamingResources
> >     ResourceLink needed (??)
> 
> Should be no. If not, it is a bug.
> 
> Mark
> 
> 
> 
> -
> 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



Re: hibernate not finding global resource datasource defined by tomcat

2010-06-15 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Yucca Nel,

On 6/15/2010 1:23 AM, yucca...@live.co.za wrote:
> --
>> From: "Christopher Schultz" 
>> Subject: Re: hibernate not finding global resource datasource defined by
>> tomcat
>>
>> Maybe you need a  element in your web.xml?
> 
> Can you explain?

No, but you can read.

http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html

Search for .

>> Tomcat 6 doesn't have a common/lib by default. Did you add that?
> 
> No I was merely referring to the fact that I included driver in the lib
> directory of server

Okay, it's confusing to say you put it in common/lib when there's no
common/lib. Precision matters when you're trying to get things working.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwXsfUACgkQ9CaO5/Lv0PBesACdEKAqcQCTImUYiSmFgD3q2bW7
/ukAniXd3whUB11sa2M26vcO0d+ne3Ot
=SzZZ
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: hibernate not finding global resource datasource defined by tomcat

2010-06-15 Thread yuccanel
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" 
Sent: Monday, June 14, 2010 11:45 PM
To: "Tomcat Users List" 
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  element in META-INF/context.xml to 
make the resource in  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  will prevent you from 
using the manager and admin application.


You can place more than one  element in the 
 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  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:









  

with hibernate.cfg.xml:

http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd";>



jdbc:mysql://localhost:3306/yucca123_thejarbar

java:comp/env/jdbc/auth"

com.mysql.jdbc.Driver

yucca123_tom

thread

pookie123














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



Re: hibernate not finding global resource datasource defined by tomcat

2010-06-14 Thread Mark Thomas

On 15/06/2010 02:21, Mark Eggers wrote:

Sure, I can make an attempt at it. I'd like to finish the wiki entry first. 
What I'm writing though will have to be drastically shortened for the 
documentation page I think.

I just ran into a bit of a puzzle though. I was trying to unravel what happens 
when you put everything into server.xml and use a CombinedRealm. Under Linux, I 
had to add a ResourceLink element to my context.xml in order to use the 
sub-Realm.

I can understand that I need a ResourceLink when I put the Resource in 
GlobalNamingResources and the Realm in context.xml, but I was rather surprised 
that I needed the ResourceLink when both are in server.xml.

I'll see if I can reproduce this on Windows/XP (make sure I've done everything 
in a reasonable order).

If that is indeed the case, can someone explain:

1. Context.xml - everything
no ResourceLink needed (obviously)
2. Context.xml - Realm, server.xml Resource in GlobalNamingResources
ResourceLink needed (obviously)
3. Server.xml - CombinedRealm, Resource in GlobalNamingResources
ResourceLink needed (??)


Should be no. If not, it is a bug.

Mark



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: hibernate not finding global resource datasource defined by tomcat

2010-06-14 Thread yuccanel



--
From: "Christopher Schultz" 
Sent: Tuesday, June 15, 2010 12:03 AM
To: "Tomcat Users List" 
Subject: Re: hibernate not finding global resource datasource defined by 
tomcat



-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Yuccal Nel,

On 6/14/2010 4:26 PM, yucca...@live.co.za wrote:

Please advise as to why hibernate us unable to find jndi datasource
configured in tomcat?


I'm not sure why Hibernate can't find your JNDI resource, but...


jdbc:mysql://localhost:3306/yucca123_thejarbar
com.mysql.jdbc.Driver
yucca123_tom
  thread
pookie123


Why do you need these properties in your hibernate configuration? The
DataSource already knows all these things and you're just confusing
Hibernate (and yourself) by having them in here. :) No I was just trying 
to hurry to get working copy up :)



2) moving resource and realm element to context.xml with adding
localdatasource attribute to  resource (true) and get same exception?


IIRC, localDataSource is a  option, and has nothing to do with
the  or any Hibernate configuration.


What am I missing here?


Maybe you need a  element in your web.xml?


Can you explain?



tomcat is latest 6.0.26
mysql 5 with global connector (inside common/lib)


Tomcat 6 doesn't have a common/lib by default. Did you add that?


No I was merely referring to the fact that I included driver in the lib 
directory of server


- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwWpyYACgkQ9CaO5/Lv0PDoKwCgoVpt0TcF0EPX8yMhNH2JHivf
ce8AoK6T283631l+J1hWmxUpFpIyMC8y
=CZ3Y
-END PGP SIGNATURE-

-
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



Re: hibernate not finding global resource datasource defined by tomcat

2010-06-14 Thread Mark Eggers
Sure, I can make an attempt at it. I'd like to finish the wiki entry first. 
What I'm writing though will have to be drastically shortened for the 
documentation page I think.

I just ran into a bit of a puzzle though. I was trying to unravel what happens 
when you put everything into server.xml and use a CombinedRealm. Under Linux, I 
had to add a ResourceLink element to my context.xml in order to use the 
sub-Realm.

I can understand that I need a ResourceLink when I put the Resource in 
GlobalNamingResources and the Realm in context.xml, but I was rather surprised 
that I needed the ResourceLink when both are in server.xml.

I'll see if I can reproduce this on Windows/XP (make sure I've done everything 
in a reasonable order).

If that is indeed the case, can someone explain:

1. Context.xml - everything
   no ResourceLink needed (obviously)
2. Context.xml - Realm, server.xml Resource in GlobalNamingResources
   ResourceLink needed (obviously)
3. Server.xml - CombinedRealm, Resource in GlobalNamingResources
   ResourceLink needed (??)

thanks for clearing things up . . . .

/mde/



--- On Mon, 6/14/10, Mark Thomas  wrote:

> From: Mark Thomas 
> Subject: Re: hibernate not finding global resource datasource defined by 
> tomcat
> To: "Tomcat Users List" 
> Date: Monday, June 14, 2010, 2:59 PM
> On 14/06/2010 22:45, Mark Eggers
> wrote:
> > 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.
> 
> I don't suppose you fancy providing a patch for the Tomcat
> docs as well... (or instead of)
> 
> Mark



  


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: hibernate not finding global resource datasource defined by tomcat

2010-06-14 Thread Mark Thomas

On 14/06/2010 22:45, Mark Eggers wrote:

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.


I don't suppose you fancy providing a patch for the Tomcat docs as 
well... (or instead of)


Mark




-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: hibernate not finding global resource datasource defined by tomcat

2010-06-14 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Yuccal Nel,

On 6/14/2010 4:26 PM, yucca...@live.co.za wrote:
> Please advise as to why hibernate us unable to find jndi datasource
> configured in tomcat?

I'm not sure why Hibernate can't find your JNDI resource, but...

>  name="connection.url">jdbc:mysql://localhost:3306/yucca123_thejarbar
>  name="connection.driver_class">com.mysql.jdbc.Driver
> yucca123_tom
>   thread
> pookie123

Why do you need these properties in your hibernate configuration? The
DataSource already knows all these things and you're just confusing
Hibernate (and yourself) by having them in here.

> 2) moving resource and realm element to context.xml with adding
> localdatasource attribute to  resource (true) and get same exception?

IIRC, localDataSource is a  option, and has nothing to do with
the  or any Hibernate configuration.

> What am I missing here?

Maybe you need a  element in your web.xml?

> tomcat is latest 6.0.26
> mysql 5 with global connector (inside common/lib)

Tomcat 6 doesn't have a common/lib by default. Did you add that?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwWpyYACgkQ9CaO5/Lv0PDoKwCgoVpt0TcF0EPX8yMhNH2JHivf
ce8AoK6T283631l+J1hWmxUpFpIyMC8y
=CZ3Y
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: hibernate not finding global resource datasource defined by tomcat

2010-06-14 Thread Mark Eggers
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  element in META-INF/context.xml to make the 
resource in  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  will prevent you from using the 
manager and admin application.

You can place more than one  element in the  
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  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:
 

    

  

 
 
 
  
 
with hibernate.cfg.xml:

http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd";>

  

    jdbc:mysql://localhost:3306/yucca123_thejarbar
  
java:comp/env/jdbc/auth"
    
com.mysql.jdbc.Driver
    
yucca123_tom
  
thread
    
pookie123
  

  

  

  

    
  


 
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