Scenario with Tomcat cluster session management

2013-01-29 Thread Josh Gooding
As usual, I am always working with Tomcat to tweak every ounce of "oomph"
out of it and I ran across this scenario in my configuration trials.

At present, I have a small 3 server tomcat cluster running 7.0.30 64-bit on
CentOS, and jdk6.  I want to move the project from having to use kill -9
(for session persistence) during an update and manual intervention, to
automated parallel deployment's and war farming.

>From the testing I have done, if I use the manager to undeploy and then
redeploy the context, it seems to call destroySession on all the sessions
across the cluster, not just the node that is being "worked on".  Is this
correct or am I missing something?

Is there presently a way to undeploy a context WITHOUT tomcat destroying
the sessions and not use kill -9?  IMO, using kill -9 seems a bit hacky.

- Josh


Re: LDAP on TOMCAT 7.0.30

2013-01-29 Thread André Warnier

chris derham wrote:

Does that mean that Tomcat treats WIA similar to HTTP BASIC (or maybe
DIGEST) unless you've approved a particular domain/host? That's
interesting. Can you just enter anything you'd like? For instance, can
I authenticate to a server that is expecting WIA from a Linux
workstation just by entering my domain credentials into the dialog?
That certainly sounds nice: the Microsoft Windows crowd doesn't have
to authenticate (explicitly, that is... their credentials are that
they are currently logged-into a machine on the network) but everyone
else can also get in.



If tomcat is setup to work with SPNEGO authentication, then when a new
session requires authentication, the server asks the client for a
kerberos token. Under IE this will be passed silently. Under FF if you
have configured the "network.automatic-ntlm-auth.trusted-uris" to the
url of the server, this will be passed silently. If you setup your
*nix machines to login to active directory they will have a kerberos
token. If you also make the FF setting change, they to will then be
able to silently login by sending through the kerberos token.

I think as you configure the server, you can specify what to do it
SPNEGO fails. I guess one option would be to fail back to http basic.
If you didn't want to get the *nix machines to login to active
directory, then I guess that would be a way to go. Guess that it all
depends on the security requirements



I believe that you both are close to the correct understanding, but that it helps to 
clearly distinguish the various parts of the process, and be very clear about the 
terminology (which unfortunately is quite confusing, because many people are using terms 
like SPNEGO, GSSAPI, "Active Directory authentication", NTLM, "Windows Integrated 
Authentication" etc. all over the place without .. really knowing precisely what they are 
talking about).


The first few paragraphs here : http://en.wikipedia.org/wiki/SPNEGO
explain what SPNEGO is, and that SPNEGO in itself is not an authentication mechanism. It 
is kind of the "preliminary" layer which allow a browser and a server to negociate which 
real authentication mechanism they both support and are going to use in the real 
authentication which happens next.
And what happens next can be based on /either/ Kerberos or NTLM (or Basic for that 
matter), which are different mechanisms.


I know little about Kerberos, but in the context of workstations belonging to a Windows 
Domain environment, running web-based applications and desiring to use a Windows-based 
form of authentication and SSO for these web-based applications, most organisations which 
I have come in contact with until now (including some large multinational ones) do not use 
Kerberos as an authentication mechanism; most of them still use NTLM (v2 nowadays).


In summary  and approximately, this is how WIA/NTLM works :
- the browser picks up the user-id which the user used to login onto his Windows 
workstation when he started Windows
- the browser transmits this user-id to the webserver it is communicating with, in some 
form (it actually takes several coded message exchanges for that)

- the webserver verifies this user-id with a back-end Windows Domain Controller
- the Windows Domain Controller in turn uses a back-end to check this user-id (this 
back-end being generally an Active Directory server)
- if all of the above works as it should, the webserver accepts this user-id, and makes it 
available to the web applications that run on this webserver on behalf of that browser, 
for as long as this browser-server connection persists.

(and if a new connection is established, the cycle is repeated)

Now as long as the workstation runs Windows, the browser is IE, the webserver is IIS, both 
the workstation and the webserver are in the same "intranet", the IIS webserver has access 
to a Windows Domain Controller, the user-id is valid etc.. then all of this happens 
automatically behind the scenes and without the user noticing anything.


And if any of these conditions is not true, then you will need to put together alternative 
pieces of the puzzle to make "Windows Integrated Authentication" work.

The good news is that in most cases these pieces exist.
The bad news is that you really need to know where to find the needed pieces, how to set 
them up, and to know that sometimes the behaviour is a bit different from the basic one above.
(Such as the fact that FF by default displays a dialog, where IE does not; and that this 
FF dialog looks just like a Basic Authentication dialog, but it isn't. The authentication 
taking place is still NTLM, not Basic; but the popup looks the same).
(And just to make things a bit more confusing : in about 50% of the cases that I have come 
across - either as a conscious decision or as an oversight of the domain admins, if NTLM 
fails then Basic authentication will take place, both in IE and in FF, and provided the 
user enters the correct user-id and passwor

Re: Latest-version TomEE 1.5.2-SNAPSHOT (Tomcat 7.0.34?) just died on me, nothing in server logs

2013-01-29 Thread Howard W. Smith, Jr.
On Tue, Jan 29, 2013 at 6:08 PM, Konstantin Kolinko
wrote:

> 2013/1/30 Caldarale, Charles R :
> >> From: Howard W. Smith, Jr. [mailto:smithh032...@gmail.com]
> >> Subject: Latest-version TomEE 1.5.2-SNAPSHOT (Tomcat 7.0.34?) just died
> on me, nothing in server logs
> >
> >> Sending this to tomee/openejb and tomcat user mailing lists.
> >
> > Cross-posting is really frowned upon.
> >
> >> Jan 29, 2013 10:27:25 AM org.apache.catalina.core.StandardWrapperValve
> event
> >> SEVERE: Servlet.service() for servlet [Push Servlet] in context with
> path
> >> [/mcmsweb] threw exception
> >> java.lang.NumberFormatException: For input string: "(TomEE)/7"
> >> at java.lang.NumberFormatException.forInputString(Unknown Source)
> >> at java.lang.Integer.parseInt(Unknown Source)
> >> at java.lang.Integer.valueOf(Unknown Source)
> >> at
> org.atmosphere.container.Tomcat7CometSupport.bz51881(Tomcat7CometSupport.java:141)
> >
> > Sure looks like an Atmosphere problem from here...
> >
>
> +1.
>
>
> https://github.com/Atmosphere/atmosphere/blob/master/modules/cpr/src/main/java/org/atmosphere/container/Tomcat7CometSupport.java#L129
>
> That "bz51881" method... an example of what you should never do...
>
> It tries to parse a version string to "workaround" a bug that was
> properly fixed more than a year ago, and fails horribly.
>
> It is a normal practice to modify the "server info" value, e.g. [1].
> It is useless to rely on it. It is no wonder that the one used by
> TomEE is different from Tomcat.
>
> [1] http://tomcat.apache.org/tomcat-7.0-doc/security-howto.html#Valves
>
>
Interesting, thanks for the response, Konstantin.


Re: Latest-version TomEE 1.5.2-SNAPSHOT (Tomcat 7.0.34?) just died on me, nothing in server logs

2013-01-29 Thread Howard W. Smith, Jr.
On Tue, Jan 29, 2013 at 6:00 PM, Caldarale, Charles R <
chuck.caldar...@unisys.com> wrote:

> > From: Howard W. Smith, Jr. [mailto:smithh032...@gmail.com]
> > Subject: Re: Latest-version TomEE 1.5.2-SNAPSHOT (Tomcat 7.0.34?) just
> died on me, nothing in server logs
>
> > I was hoping to get a response from tomcat committers/users, and I
> > was assuming the same, an Atmosphere issue.
>
> The other possibility is that TomEE (not supported on this mailing list)
> has set some value to a non-numeric string, whereas a true Tomcat only uses
> numeric values in that location.  Without looking at the Atmosphere code,
> it's really impossible to tell.
>
>
>
Understood about TomEE not supported on this list. Prior to using latest
Atmosphere version (1.0.9) along with latest version of TomEE, I reached
out to Jeanfrancois, and he confirmed that Atmosphere 1.0.10 is targeted
for PrimeFaces Push users (like myself), and from what I understand, 1.0.9
fixed a simple software/typo mistake in 1.0.8, and I'm assuming that 1.0.9
should not be used to replace 1.0.8 by PrimeFaces Push users like myself.

for now, i have reverted to Atmosphere 1.0.6, which was the recommended
(and most applicable/appropriate version), weeks ago, to use with my
PrimeFaces web app. I informed the tomee list that I will monitor this
behavior for the meanwhile, and I'm looking forward to using/testing
Atmosphere 1.0.10 when it is released.


Re: Latest-version TomEE 1.5.2-SNAPSHOT (Tomcat 7.0.34?) just died on me, nothing in server logs

2013-01-29 Thread Konstantin Kolinko
2013/1/30 Caldarale, Charles R :
>> From: Howard W. Smith, Jr. [mailto:smithh032...@gmail.com]
>> Subject: Latest-version TomEE 1.5.2-SNAPSHOT (Tomcat 7.0.34?) just died on 
>> me, nothing in server logs
>
>> Sending this to tomee/openejb and tomcat user mailing lists.
>
> Cross-posting is really frowned upon.
>
>> Jan 29, 2013 10:27:25 AM org.apache.catalina.core.StandardWrapperValve event
>> SEVERE: Servlet.service() for servlet [Push Servlet] in context with path
>> [/mcmsweb] threw exception
>> java.lang.NumberFormatException: For input string: "(TomEE)/7"
>> at java.lang.NumberFormatException.forInputString(Unknown Source)
>> at java.lang.Integer.parseInt(Unknown Source)
>> at java.lang.Integer.valueOf(Unknown Source)
>> at 
>> org.atmosphere.container.Tomcat7CometSupport.bz51881(Tomcat7CometSupport.java:141)
>
> Sure looks like an Atmosphere problem from here...
>

+1.

https://github.com/Atmosphere/atmosphere/blob/master/modules/cpr/src/main/java/org/atmosphere/container/Tomcat7CometSupport.java#L129

That "bz51881" method... an example of what you should never do...

It tries to parse a version string to "workaround" a bug that was
properly fixed more than a year ago, and fails horribly.

It is a normal practice to modify the "server info" value, e.g. [1].
It is useless to rely on it. It is no wonder that the one used by
TomEE is different from Tomcat.

[1] http://tomcat.apache.org/tomcat-7.0-doc/security-howto.html#Valves


Best regards,
Konstantin Kolinko

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



RE: Latest-version TomEE 1.5.2-SNAPSHOT (Tomcat 7.0.34?) just died on me, nothing in server logs

2013-01-29 Thread Caldarale, Charles R
> From: Howard W. Smith, Jr. [mailto:smithh032...@gmail.com] 
> Subject: Re: Latest-version TomEE 1.5.2-SNAPSHOT (Tomcat 7.0.34?) just died 
> on me, nothing in server logs

> I was hoping to get a response from tomcat committers/users, and I 
> was assuming the same, an Atmosphere issue.

The other possibility is that TomEE (not supported on this mailing list) has 
set some value to a non-numeric string, whereas a true Tomcat only uses numeric 
values in that location.  Without looking at the Atmosphere code, it's really 
impossible to tell.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


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



Re: Embedded Tomcat how to use addContext for docBase

2013-01-29 Thread Jimmy Johnson
Ah, Okay, so I should use the addWebapp method to add a path to an external
folder?

e.g tomcat.addWebapp("/MyWebApp/images", "/tmp/images");

Thanks,
Jimmy


On Tue, Jan 29, 2013 at 2:06 PM, Konstantin Kolinko
wrote:

> 2013/1/29 Jimmy Johnson :
> > System: Mac OS X 10.8
> > Tomcat Version: 7.0.30
> > Language: Java
> >
> > I'm trying to set up the context in an embedded Tomcat instance to serve
> > files from a local directory not within the deployed folder.
> >
> > In the standard server.xml when using the standard Tomcat configuration I
> > have this:
> >
> >  > reloadable="false"/>
> >
> > and it works great.
> >
> > I have tried different variations on the following tomcat embedded call
> > without success:
> >
> > tomcat.addContext(tomcat.getHost(), "/MyWebApp/images",
> > "/documents/images/");
> >
> > I also tried:
> >
> > tomcat.addContext("/MyWebApp/images", "/documents/images/");
> >
> > It seems that Tomcat does see the external docBase folder I have
> specified
> > because if I specify a path that doesn't exist it complains.  It also
> see's
> > the context mapping because hitting the "/MyWebApp/images" filters out
> the
> > request before it hits the spring security filters I have in place and
> > reports a 404 file not found.
> >
> > I am planning on looking at the source this evening and seeing if I can
> > track down the file path it is looking at, but I thought someone here
> might
> > know of a solution.
> >
> > It looks like this grails question was along the same lines:
> >
> >
> http://stackoverflow.com/questions/8332851/grails-add-context-to-embedded-tomcat-in-development
> >
> > But im not using grails.
> >
> > Here is the full startup code I am using:
> >
> > package launch;
> >  import java.io.File;
> > import org.apache.catalina.startup.Tomcat;
> >  public class Main {
> >  public static void main(String[] args) throws Exception {
> >  String webappDirLocation = "/src/main/webapp/";
> > Tomcat tomcat = new Tomcat();
> >  //The port that we should run on can be set into an environment variable
> > //Look for that variable and default to 8080 if it isn't there.
> > String webPort = System.getenv("PORT");
> > if(webPort == null || webPort.isEmpty()) {
> > webPort = "8080";
> > }
> >  tomcat.setPort(Integer.valueOf(webPort));
> >  tomcat.addWebapp("/MyWebApp", new
> > File(webappDirLocation).getAbsolutePath());
> > tomcat.addContext("/MyWebApp/images", "/tmp/images/");
>
> The above two lines. You already know the "addWebapp" method, so why
> are you trying to use "addContext"?
>
> >  tomcat.start();
> > tomcat.getServer().await();
> > }
> > }
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: Latest-version TomEE 1.5.2-SNAPSHOT (Tomcat 7.0.34?) just died on me, nothing in server logs

2013-01-29 Thread Howard W. Smith, Jr.
> > Sending this to tomee/openejb and tomcat user mailing lists.
>
> Cross-posting is really frowned upon.
>
> > Jan 29, 2013 10:27:25 AM org.apache.catalina.core.StandardWrapperValve
> event
> > SEVERE: Servlet.service() for servlet [Push Servlet] in context with path
> > [/mcmsweb] threw exception
> > java.lang.NumberFormatException: For input string: "(TomEE)/7"
> > at java.lang.NumberFormatException.forInputString(Unknown Source)
> > at java.lang.Integer.parseInt(Unknown Source)
> > at java.lang.Integer.valueOf(Unknown Source)
> > at
> org.atmosphere.container.Tomcat7CometSupport.bz51881(Tomcat7CometSupport.java:141)
>
> Sure looks like an Atmosphere problem from here...
>
>  - Chuck
>
>
Thanks Chuck for the response, my apologies for cross-posting, and that
part of the question, I was hoping to get a response from tomcat
committers/users, and I was assuming the same, an Atmosphere issue.


RE: Latest-version TomEE 1.5.2-SNAPSHOT (Tomcat 7.0.34?) just died on me, nothing in server logs

2013-01-29 Thread Caldarale, Charles R
> From: Howard W. Smith, Jr. [mailto:smithh032...@gmail.com] 
> Subject: Latest-version TomEE 1.5.2-SNAPSHOT (Tomcat 7.0.34?) just died on 
> me, nothing in server logs

> Sending this to tomee/openejb and tomcat user mailing lists.

Cross-posting is really frowned upon.

> Jan 29, 2013 10:27:25 AM org.apache.catalina.core.StandardWrapperValve event
> SEVERE: Servlet.service() for servlet [Push Servlet] in context with path
> [/mcmsweb] threw exception
> java.lang.NumberFormatException: For input string: "(TomEE)/7"
> at java.lang.NumberFormatException.forInputString(Unknown Source)
> at java.lang.Integer.parseInt(Unknown Source)
> at java.lang.Integer.valueOf(Unknown Source)
> at 
> org.atmosphere.container.Tomcat7CometSupport.bz51881(Tomcat7CometSupport.java:141)

Sure looks like an Atmosphere problem from here...

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


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



Re: html page can not present an java Applet embedded in the page

2013-01-29 Thread André Warnier

qingtao peng wrote:

  I have built the apache-tomcat-7.0.32 server on my computer.My operating 
system is Windows7.I place a html page named DbApplet.html under the directory 
of DbServlet in the webapps of the apache-tomcat-7.0.32 server .My DbApplet.htm 
code is as follow :

 
 
 
  
 http://localhost:8080/DbServlet/build/classes/servlet/"; classid = 
"DbApplet.class"  width = "600" height = "600" name = "DbApplet">
 
  
  


I have started the apache-tomcat-7.0.32 server.Then i type 
http://localhost:8080/DbServlet/DbApplet.html in the field of the address on 
the browser.I can open the page on the browser,but the html page can not 
present the java Applet embedded in the page.I have encoded the java Applet and 
compiled it into the class named DbApplet.class.I
place it under  the directory of DbServlet/build/classes/servlet in the 
directory of the webapps of the apache-tomcat-7.0.32 server .Why can the page 
not present my java Applet.
I thank you for helping


You may want to open the Java error console on your workstation, and look at any messages 
shown there.



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



Re: Embedded Tomcat how to use addContext for docBase

2013-01-29 Thread Konstantin Kolinko
2013/1/29 Jimmy Johnson :
> System: Mac OS X 10.8
> Tomcat Version: 7.0.30
> Language: Java
>
> I'm trying to set up the context in an embedded Tomcat instance to serve
> files from a local directory not within the deployed folder.
>
> In the standard server.xml when using the standard Tomcat configuration I
> have this:
>
>  reloadable="false"/>
>
> and it works great.
>
> I have tried different variations on the following tomcat embedded call
> without success:
>
> tomcat.addContext(tomcat.getHost(), "/MyWebApp/images",
> "/documents/images/");
>
> I also tried:
>
> tomcat.addContext("/MyWebApp/images", "/documents/images/");
>
> It seems that Tomcat does see the external docBase folder I have specified
> because if I specify a path that doesn't exist it complains.  It also see's
> the context mapping because hitting the "/MyWebApp/images" filters out the
> request before it hits the spring security filters I have in place and
> reports a 404 file not found.
>
> I am planning on looking at the source this evening and seeing if I can
> track down the file path it is looking at, but I thought someone here might
> know of a solution.
>
> It looks like this grails question was along the same lines:
>
> http://stackoverflow.com/questions/8332851/grails-add-context-to-embedded-tomcat-in-development
>
> But im not using grails.
>
> Here is the full startup code I am using:
>
> package launch;
>  import java.io.File;
> import org.apache.catalina.startup.Tomcat;
>  public class Main {
>  public static void main(String[] args) throws Exception {
>  String webappDirLocation = "/src/main/webapp/";
> Tomcat tomcat = new Tomcat();
>  //The port that we should run on can be set into an environment variable
> //Look for that variable and default to 8080 if it isn't there.
> String webPort = System.getenv("PORT");
> if(webPort == null || webPort.isEmpty()) {
> webPort = "8080";
> }
>  tomcat.setPort(Integer.valueOf(webPort));
>  tomcat.addWebapp("/MyWebApp", new
> File(webappDirLocation).getAbsolutePath());
> tomcat.addContext("/MyWebApp/images", "/tmp/images/");

The above two lines. You already know the "addWebapp" method, so why
are you trying to use "addContext"?

>  tomcat.start();
> tomcat.getServer().await();
> }
> }

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



Re: LDAP on TOMCAT 7.0.30

2013-01-29 Thread chris derham
> Does that mean that Tomcat treats WIA similar to HTTP BASIC (or maybe
> DIGEST) unless you've approved a particular domain/host? That's
> interesting. Can you just enter anything you'd like? For instance, can
> I authenticate to a server that is expecting WIA from a Linux
> workstation just by entering my domain credentials into the dialog?
> That certainly sounds nice: the Microsoft Windows crowd doesn't have
> to authenticate (explicitly, that is... their credentials are that
> they are currently logged-into a machine on the network) but everyone
> else can also get in.
>

If tomcat is setup to work with SPNEGO authentication, then when a new
session requires authentication, the server asks the client for a
kerberos token. Under IE this will be passed silently. Under FF if you
have configured the "network.automatic-ntlm-auth.trusted-uris" to the
url of the server, this will be passed silently. If you setup your
*nix machines to login to active directory they will have a kerberos
token. If you also make the FF setting change, they to will then be
able to silently login by sending through the kerberos token.

I think as you configure the server, you can specify what to do it
SPNEGO fails. I guess one option would be to fail back to http basic.
If you didn't want to get the *nix machines to login to active
directory, then I guess that would be a way to go. Guess that it all
depends on the security requirements

HTH

Chris

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



RE: html page can not present an java Applet embedded in the page

2013-01-29 Thread Konstantin Preißer
Hi,

> -Original Message-
> From: Christopher Schultz [mailto:ch...@christopherschultz.net]
> Sent: Tuesday, January 29, 2013 6:38 PM
> To: Tomcat Users List
> Subject: Re: html page can not present an java Applet embedded in the
> page
> 
> Also, Oracle says this only works with Microsoft Internet Explorer. An
> online HOW-TO[2] (a bit dated) says that you can still use  in
> other browsers, but the syntax is a little different:
> 
>type="application/x-java-applet">
>   
> [...]
> 
> 
> I'm not sure why you have to specify the class name twice in there.
> That page also shows you how to embed Java applets in such a way that
> they will work in both MSIE and everywhere else. Oracle has similar
> documentation in their page I referenced, though using a different
> technique. You'll have to test in your target environment to see what
> actually works for you.


I don't know why Oracle says that you need different syntaxes for IE and other 
browsers (that probably applied to old versions of the HTML spec and browsers), 
since e.g. the following syntax works for me with IE, Firefox and Chrome (which 
is also given as a example in the current HTML5 spec [1]):

  




Your don't have the Java plugin installed...
  


However, I would recommend the  element because it allows Browsers to 
display a specific error message when the Java plugin is not installed:

  


Regards,
Konstantin Preißer


[1] http://www.w3.org/TR/html51/embedded-content-0.html#the-object-element


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



Re: JNDI Feedback

2013-01-29 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Alan,

On 1/29/13 12:24 PM, alan.farr...@renfrewshire.gov.uk wrote:
> Thanks for feedback.  If a SQLException can be returned then I
> could probably use that in the Java application to determine if an
> exception occurred.  Can you provide any guidance?

Er.. not sure what guidance I could provide. You have to catch that
kind of exception somewhere that makes sense and then do something
about it. I can't tell you where that would be or what to do when you
caught it... it's up to your individual webapp's requirements.

Sorry...

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEICU4ACgkQ9CaO5/Lv0PDjnQCeMJwH5aiHBguGueakQZN26HT/
w+QAn3Eu+c5cwR0z3TuiLj3+jdayqKnZ
=6nd5
-END PGP SIGNATURE-

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



Re: html page can not present an java Applet embedded in the page

2013-01-29 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Gingtao,

On 1/29/13 7:45 AM, qingtao peng wrote:
> I have built the apache-tomcat-7.0.32 server on my computer.My 
> operating system is Windows7.I place a html page named
> DbApplet.html under the directory of DbServlet in the webapps of
> the apache-tomcat-7.0.32 server .My DbApplet.htm code is as follow
> :
> 
>   codebase="http://localhost:8080/DbServlet/build/classes/servlet/";
> classid = "DbApplet.class"  width = "600" height = "600" name =
> "DbApplet">
> 
> I have started the apache-tomcat-7.0.32 server.Then i type 
> http://localhost:8080/DbServlet/DbApplet.html in the field of the 
> address on the browser.I can open the page on the browser,but the 
> html page can not present the java Applet embedded in the page.I
> have encoded the java Applet and compiled it into the class named 
> DbApplet.class.I place it under  the directory of 
> DbServlet/build/classes/servlet in the directory of the webapps of 
> the apache-tomcat-7.0.32 server .Why can the page not present my
> java Applet.

The available online documentation is a bit murky these days. Oracle's
own documentation[1] does not explain how to tell the browser where
your code is (e.g. in a JAR file on the server). I suspect it should
be done this way:


  http://localhost:8080/DbServlet/build/classes/servlet/"; />
  


You should ensure that the URL
http://localhost:8080/DbServlet/build/classes/servlet/DbApplet.class
actually returns something. If Tomcat refuses to serve that request,
you'll get nothing.

Also, Oracle says this only works with Microsoft Internet Explorer. An
online HOW-TO[2] (a bit dated) says that you can still use  in
other browsers, but the syntax is a little different:


  
[...]


I'm not sure why you have to specify the class name twice in there.
That page also shows you how to embed Java applets in such a way that
they will work in both MSIE and everywhere else. Oracle has similar
documentation in their page I referenced, though using a different
technique. You'll have to test in your target environment to see what
actually works for you.

Good luck,
- -chris

[1]
http://download.java.net/jdk8/docs/technotes/guides/jweb/applet/using_tags.html
[2]
http://depth-first.com/articles/2008/02/20/demystifying-java-applets-part-1-cross-browser-standards-compliant-pure-html-deployment-using-the-object-tag/
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEICO0ACgkQ9CaO5/Lv0PAa3gCcD0QN+PjtpI5gWBulGW0A2kJu
5VAAoJJ1E/7o356crfZw5h3eAS6BZTw3
=Rftp
-END PGP SIGNATURE-

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



Re: JNDI Feedback

2013-01-29 Thread Daniel Mikusa
On Jan 29, 2013, at 12:18 PM, alan.farr...@renfrewshire.gov.uk wrote:

> Hi,
> 
> As requested, the resource tags from the Context file.  Although I was 
> asked by my boss to change password value to password and username value 
> to username.
> 
>  driverClassName="oracle.jdbc.driver.OracleDriver" 
> factory="org.moss.jdj.dbcp.EncryptedDataSourceFactory" maxActive="100" 
> maxIdle="30" maxWait="1" name="jdbc/authentication" 
> password="password" type="javax.sql.DataSource" 
> url="jdbc:oracle:thin:@swtest:1523:TRNG" username="username" 
> validationQuery="select 1 from dual" />
> 
>  driverClassName="oracle.jdbc.driver.OracleDriver" 
> factory="org.moss.jdj.dbcp.EncryptedDataSourceFactory" maxActive="100" 
> maxIdle="30" maxWait="1" name="jdbc/swift" password="password" 
> type="javax.sql.DataSource" url="jdbc:oracle:thin:@swtest:1523:TRNG" 
> username="username" validationQuery="select 1 from dual" />
> 
>  driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" 
> factory="org.moss.jdj.dbcp.EncryptedDataSourceFactory" maxActive="100" 
> maxIdle="30" maxWait="1" name="jdbc/edrms" password="password" 
> type="javax.sql.DataSource" 
> url="jdbc:sqlserver://hqdcsqlc2\ngedm:2369;databaseName=ImagesTrainDM" 
> username="username" />

These three are using a custom "factory", so you'll want to check with the 
author of "org.moss.jdj.dbcp.EncryptedDataSourceFactory" to determine exactly 
what properties it supports.  I'm assuming that because the first two take a 
"validationQuery", the third should work with it as well.  You just need to 
adjust the query so that it works on MSSQL.  I think "SELECT 1" should work, 
but you'll want to double-check that.

> 
>  driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" 
> maxActive="100" maxIdle="30" maxWait="1" name="jdbc/audit" 
> password="password" type="javax.sql.DataSource" 
> url="jdbc:sqlserver://egovsql2005\p40010:1433;databaseName=AuditDEV" 
> username="username" />

This doesn't have a factory, so it'll use the default DBCP connection pool.  
See Chris' email for a link to the docs for DBCP.

Dan

> 
> 
> Thank you
> 
> Regards
> 
> Alan Farroll
> Analyst Programmer
> Finance and Corporate Services
> Renfrewshire House
> Cotton Street
> Paisley
> PA1 1HY
> 
> 0141 618 7961
> alan.farr...@renfrewshire.gov.uk
> www.renfrewshire.gov.uk
> 
> 
> 
> From:   Daniel Mikusa 
> To: "Tomcat Users List" 
> Date:   29/01/2013 17:06
> Subject:Re: JNDI Feedback
> 
> 
> 
> On Jan 29, 2013, at 11:54 AM, alan.farr...@renfrewshire.gov.uk wrote:
> 
>> Hello,
>> 
>> Running Tomcat 7.0.29 on Windows XP Professional Service Pack 3
>> 
>> I have been handed a project developed by a former colleague and I am 
>> still learning Java and Tomcat.
>> 
>> The project has 4 JNDI's set up, 2 Oracle and 2 SQL Server with 
> validation 
>> queries set up for the Oracle databases. 
> 
> Please include the configuration for your data sources.  The  
> tag, minus passwords should be sufficient.
> 
> Dan
> 
>> I want to set up validation 
>> queries on the JNDI's for SQL server and also have the JNDI provide 
>> feedback to the Java application if the database is down.
>> 
>> Can you advise how to do this please?  If not possible, then what is an 
>> alternative?
>> 
>> Thank you in advance for any assistance.
>> 
>> Regards
>> 
>> Alan Farroll
>> Analyst Programmer
>> Finance and Corporate Services
>> Renfrewshire House
>> Cotton Street
>> Paisley
>> PA1 1HY
>> 
>> 0141 618 7961
>> alan.farr...@renfrewshire.gov.uk
>> www.renfrewshire.gov.uk
>> 
>> **
>> 
>> Renfrewshire Council Website - http://www.renfrewshire.gov.uk
>> 
>> This email and any files transmitted with it are confidential and 
> intended solely for the use of the individual or entity to whom they  are 
> addressed. If you have received this email in error please notify the 
> system manager.
>> 
>> Renfrewshire Council may, in accordance with  the 
> Telecommunications(Lawful Business Practice) (Interception of 
> Communications) Regulations 2000, intercept e-mail messages for the 
> purpose of monitoring or keeping a record of communications on the 
> Council's system. If a message contains inappropriate dialogue it will 
> automatically be intercepted by the Council's Internal Audit section who 
> will decide whether or not the e-mail should be onwardly transmitted to 
> the intended recipient(s).
>> 
>> This footnote also confirms that this email message has been swept by 
> Sophos for the presence of computer viruses.
>> 
>> **
>> 
>> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
> 
> 
> 
> **
> 
> Renfrewshire Council Webs

Re: JNDI Feedback

2013-01-29 Thread alan . farroll
Hi,

Thanks for feedback.  If a SQLException can be returned then I could 
probably use that in the Java application to determine if an exception 
occurred.  Can you provide any guidance?

Thank you

Regards

Alan Farroll
Analyst Programmer
Finance and Corporate Services
Renfrewshire House
Cotton Street
Paisley
PA1 1HY

0141 618 7961
alan.farr...@renfrewshire.gov.uk
www.renfrewshire.gov.uk



From:   Christopher Schultz 
To: Tomcat Users List 
Date:   29/01/2013 17:11
Subject:Re: JNDI Feedback



-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Alan,

On 1/29/13 11:54 AM, alan.farr...@renfrewshire.gov.uk wrote:
> Running Tomcat 7.0.29 on Windows XP Professional Service Pack 3

Ready for a Microsoft upgrade cycle? The clock is ticking...

> I have been handed a project developed by a former colleague and I
> am still learning Java and Tomcat.

Welcome to the community!

> The project has 4 JNDI's set up

Nomenclature nit: that's "has 4 JNDI /resources/". JNDI itself is just
a directory interface where you stash stuff.

> 2 Oracle and 2 SQL Server with validation queries set up for the
> Oracle databases.  I want to set up validation queries on the
> JNDI's for SQL server and also have the JNDI provide feedback to
> the Java application if the database is down.

The only feedback you are going to get is (eventual) SQLExceptions.

> Can you advise how to do this please?  If not possible, then what
> is an alternative?

Obviously, you can set up a validationQuery in the 2 MS SQL Server
resources by just adding an appropriate query (e.g. "SELECT 1 FROM
DUAL" or whatever is appropriate in MS SQL Server) to the 
attributes.

Were you hoping to get some other behavior than just what
validationQuery already provides?

FYI if you are using Tomcat's default connection pool, then you are
using Apache commons-dbcp, whose configuration guide can be found
here: http://commons.apache.org/dbcp/configuration.html

That will explain all the configuration attributes you can use (right
in the XML) and what they all do.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEIAq0ACgkQ9CaO5/Lv0PBwvgCfd/QXbOkTEsCA4+dVG3GkhcYu
dOQAn0lAOIdxaok55TJCE5pu7jb+aR4t
=izRU
-END PGP SIGNATURE-

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




**

Renfrewshire Council Website - http://www.renfrewshire.gov.uk

This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they  are addressed. If 
you have received this email in error please notify the system manager.

Renfrewshire Council may, in accordance with  the Telecommunications(Lawful 
Business Practice) (Interception of Communications) Regulations 2000, intercept 
e-mail messages for the purpose of monitoring or keeping a record of 
communications on the Council's system. If a message contains inappropriate 
dialogue it will automatically be intercepted by the Council's Internal Audit 
section who will decide whether or not the e-mail should be onwardly 
transmitted to the intended recipient(s).

This footnote also confirms that this email message has been swept by Sophos 
for the presence of computer viruses.

**




Re: JNDI Feedback

2013-01-29 Thread alan . farroll
Hi,

As requested, the resource tags from the Context file.  Although I was 
asked by my boss to change password value to password and username value 
to username.










Thank you

Regards

Alan Farroll
Analyst Programmer
Finance and Corporate Services
Renfrewshire House
Cotton Street
Paisley
PA1 1HY

0141 618 7961
alan.farr...@renfrewshire.gov.uk
www.renfrewshire.gov.uk



From:   Daniel Mikusa 
To: "Tomcat Users List" 
Date:   29/01/2013 17:06
Subject:Re: JNDI Feedback



On Jan 29, 2013, at 11:54 AM, alan.farr...@renfrewshire.gov.uk wrote:

> Hello,
> 
> Running Tomcat 7.0.29 on Windows XP Professional Service Pack 3
> 
> I have been handed a project developed by a former colleague and I am 
> still learning Java and Tomcat.
> 
> The project has 4 JNDI's set up, 2 Oracle and 2 SQL Server with 
validation 
> queries set up for the Oracle databases. 

Please include the configuration for your data sources.  The  
tag, minus passwords should be sufficient.

Dan

> I want to set up validation 
> queries on the JNDI's for SQL server and also have the JNDI provide 
> feedback to the Java application if the database is down.
> 
> Can you advise how to do this please?  If not possible, then what is an 
> alternative?
> 
> Thank you in advance for any assistance.
> 
> Regards
> 
> Alan Farroll
> Analyst Programmer
> Finance and Corporate Services
> Renfrewshire House
> Cotton Street
> Paisley
> PA1 1HY
> 
> 0141 618 7961
> alan.farr...@renfrewshire.gov.uk
> www.renfrewshire.gov.uk
> 
> **
> 
> Renfrewshire Council Website - http://www.renfrewshire.gov.uk
> 
> This email and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom they  are 
addressed. If you have received this email in error please notify the 
system manager.
> 
> Renfrewshire Council may, in accordance with  the 
Telecommunications(Lawful Business Practice) (Interception of 
Communications) Regulations 2000, intercept e-mail messages for the 
purpose of monitoring or keeping a record of communications on the 
Council's system. If a message contains inappropriate dialogue it will 
automatically be intercepted by the Council's Internal Audit section who 
will decide whether or not the e-mail should be onwardly transmitted to 
the intended recipient(s).
> 
> This footnote also confirms that this email message has been swept by 
Sophos for the presence of computer viruses.
> 
> **
> 
> 

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




**

Renfrewshire Council Website - http://www.renfrewshire.gov.uk

This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they  are addressed. If 
you have received this email in error please notify the system manager.

Renfrewshire Council may, in accordance with  the Telecommunications(Lawful 
Business Practice) (Interception of Communications) Regulations 2000, intercept 
e-mail messages for the purpose of monitoring or keeping a record of 
communications on the Council's system. If a message contains inappropriate 
dialogue it will automatically be intercepted by the Council's Internal Audit 
section who will decide whether or not the e-mail should be onwardly 
transmitted to the intended recipient(s).

This footnote also confirms that this email message has been swept by Sophos 
for the presence of computer viruses.

**




Re: LDAP on TOMCAT 7.0.30

2013-01-29 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

André,

On 1/29/13 4:19 AM, André Warnier wrote:
> Christopher Schultz wrote:
>> -BEGIN PGP SIGNED MESSAGE- Hash: SHA256
>> 
>> André,
>> 
>> On 1/28/13 12:32 PM, André Warnier wrote:
>>> Christopher Schultz wrote:
 -BEGIN PGP SIGNED MESSAGE- Hash: SHA256
 
 Chris,
 
 On 1/28/13 7:47 AM, chris derham wrote:
>> 1) All 3 applications  are browser compatible  and users
>> may use other then IE hence IE alone can be ruled out
> Do you mean "multiple browsers access these web
> applications, so we can't use anything that is IE
> specific"? Assuming that you do, I don't believe that
> anybody suggested anything that is IE specific, e.g. the
> SSO solutions so far posted will work in other browsers as
> well. Can you elaborate on what you mean exactly please?
 I think auto-forwarding credentials from the client system 
 through the browser generally requires MSIE. I've never done 
 anything like that and have no idea what I'm talking about,
 so I may be completely wrong.
 
>>> You are. Firefox supports "Windows Integrated Authentication"
>>> fine too, and I believe most usual current browsers do.
>> 
>> Do you need a plug-in or anything like that? Does it need to be 
>> specifically enabled?
>> 
> 
> This may provide more details : 
> http://markmonica.com/2007/11/20/firefox-and-integrated-windows-authentication/
>
>  or search Google for : windows integrated authentication support
> in firefox
> 
> I am using currently Firefox v 17.0.1, and it seems to do fine
> right out of the box. By default, Firefox will prompt for id/pw in
> a dialog box anyway, even for WIA. But you can change this
> specifically for a list of sites, for which no prompt will be
> issued. (That's all under Windows of course).

Does that mean that Tomcat treats WIA similar to HTTP BASIC (or maybe
DIGEST) unless you've approved a particular domain/host? That's
interesting. Can you just enter anything you'd like? For instance, can
I authenticate to a server that is expecting WIA from a Linux
workstation just by entering my domain credentials into the dialog?
That certainly sounds nice: the Microsoft Windows crowd doesn't have
to authenticate (explicitly, that is... their credentials are that
they are currently logged-into a machine on the network) but everyone
else can also get in.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEIA1kACgkQ9CaO5/Lv0PBipACePGDkZmoUz7G6KSuPlw/gvI0t
PzkAn08vYiDxbbOeJziPp/lLwyMpawh5
=kWQJ
-END PGP SIGNATURE-

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



Re: JNDI Feedback

2013-01-29 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Alan,

On 1/29/13 11:54 AM, alan.farr...@renfrewshire.gov.uk wrote:
> Running Tomcat 7.0.29 on Windows XP Professional Service Pack 3

Ready for a Microsoft upgrade cycle? The clock is ticking...

> I have been handed a project developed by a former colleague and I
> am still learning Java and Tomcat.

Welcome to the community!

> The project has 4 JNDI's set up

Nomenclature nit: that's "has 4 JNDI /resources/". JNDI itself is just
a directory interface where you stash stuff.

> 2 Oracle and 2 SQL Server with validation queries set up for the
> Oracle databases.  I want to set up validation queries on the
> JNDI's for SQL server and also have the JNDI provide feedback to
> the Java application if the database is down.

The only feedback you are going to get is (eventual) SQLExceptions.

> Can you advise how to do this please?  If not possible, then what
> is an alternative?

Obviously, you can set up a validationQuery in the 2 MS SQL Server
resources by just adding an appropriate query (e.g. "SELECT 1 FROM
DUAL" or whatever is appropriate in MS SQL Server) to the 
attributes.

Were you hoping to get some other behavior than just what
validationQuery already provides?

FYI if you are using Tomcat's default connection pool, then you are
using Apache commons-dbcp, whose configuration guide can be found
here: http://commons.apache.org/dbcp/configuration.html

That will explain all the configuration attributes you can use (right
in the XML) and what they all do.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEIAq0ACgkQ9CaO5/Lv0PBwvgCfd/QXbOkTEsCA4+dVG3GkhcYu
dOQAn0lAOIdxaok55TJCE5pu7jb+aR4t
=izRU
-END PGP SIGNATURE-

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



Re: JNDI Feedback

2013-01-29 Thread Daniel Mikusa
On Jan 29, 2013, at 11:54 AM, alan.farr...@renfrewshire.gov.uk wrote:

> Hello,
> 
> Running Tomcat 7.0.29 on Windows XP Professional Service Pack 3
> 
> I have been handed a project developed by a former colleague and I am 
> still learning Java and Tomcat.
> 
> The project has 4 JNDI's set up, 2 Oracle and 2 SQL Server with validation 
> queries set up for the Oracle databases.  

Please include the configuration for your data sources.  The  tag, 
minus passwords should be sufficient.

Dan

> I want to set up validation 
> queries on the JNDI's for SQL server and also have the JNDI provide 
> feedback to the Java application if the database is down.
> 
> Can you advise how to do this please?  If not possible, then what is an 
> alternative?
> 
> Thank you in advance for any assistance.
> 
> Regards
> 
> Alan Farroll
> Analyst Programmer
> Finance and Corporate Services
> Renfrewshire House
> Cotton Street
> Paisley
> PA1 1HY
> 
> 0141 618 7961
> alan.farr...@renfrewshire.gov.uk
> www.renfrewshire.gov.uk
> 
> **
> 
> Renfrewshire Council Website - http://www.renfrewshire.gov.uk
> 
> This email and any files transmitted with it are confidential and intended 
> solely for the use of the individual or entity to whom they  are addressed. 
> If you have received this email in error please notify the system manager.
> 
> Renfrewshire Council may, in accordance with  the Telecommunications(Lawful 
> Business Practice) (Interception of Communications) Regulations 2000, 
> intercept e-mail messages for the purpose of monitoring or keeping a record 
> of communications on the Council's system. If a message contains 
> inappropriate dialogue it will automatically be intercepted by the Council's 
> Internal Audit section who will decide whether or not the e-mail should be 
> onwardly transmitted to the intended recipient(s).
> 
> This footnote also confirms that this email message has been swept by Sophos 
> for the presence of computer viruses.
> 
> **
> 
> 

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



Re: Unexpected poller error

2013-01-29 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Vishal,

On 1/29/13 5:34 AM, Vishal-sh Sharma wrote:
> Hi Christopher,
> 
> It worked!! Thanks a ton!!
> 
> We were trying to use(compile) the java code in the tcnative 
> distribution and hence the issue. Everything worked to a T , i.e
> the http calls that were failing earlier, when we ignored the java
> code provided with the native distribution.
> 
> Thanks once again..you saved me (my team as well ) lot of pain..

Glad to help... I'm sorry that the Java code in the tcnative
distribution was confusing. There is a discussion on the development
list right now about removing that Java code to prevent such confusion.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEIAWUACgkQ9CaO5/Lv0PCigwCfZDB7gT4HSJ39yotX00HeIo7o
GbgAnRPI3ERqPK9+lXSOJdIDP/PVuXOR
=WBR+
-END PGP SIGNATURE-

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



Re: Destroying resources created with a custom ObjectFactory

2013-01-29 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Xavier,

On 1/29/13 5:35 AM, Xavier Dury wrote:
> Ok nevermind, I just found the closeMethod attribute on Resource 
> (http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Resource_Definitions)

Glad
> 
you found that -- it's what I was going to suggest.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEIASoACgkQ9CaO5/Lv0PCWIgCfd6Y9WXYBRW3H4f7whFrfls86
5TEAnj1sOnoSIwAhIgi7Hy3TKWd/2I7v
=VSxP
-END PGP SIGNATURE-

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



JNDI Feedback

2013-01-29 Thread alan . farroll
Hello,

Running Tomcat 7.0.29 on Windows XP Professional Service Pack 3

I have been handed a project developed by a former colleague and I am 
still learning Java and Tomcat.

The project has 4 JNDI's set up, 2 Oracle and 2 SQL Server with validation 
queries set up for the Oracle databases.  I want to set up validation 
queries on the JNDI's for SQL server and also have the JNDI provide 
feedback to the Java application if the database is down.

Can you advise how to do this please?  If not possible, then what is an 
alternative?

Thank you in advance for any assistance.

Regards

Alan Farroll
Analyst Programmer
Finance and Corporate Services
Renfrewshire House
Cotton Street
Paisley
PA1 1HY

0141 618 7961
alan.farr...@renfrewshire.gov.uk
www.renfrewshire.gov.uk

**

Renfrewshire Council Website - http://www.renfrewshire.gov.uk

This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they  are addressed. If 
you have received this email in error please notify the system manager.

Renfrewshire Council may, in accordance with  the Telecommunications(Lawful 
Business Practice) (Interception of Communications) Regulations 2000, intercept 
e-mail messages for the purpose of monitoring or keeping a record of 
communications on the Council's system. If a message contains inappropriate 
dialogue it will automatically be intercepted by the Council's Internal Audit 
section who will decide whether or not the e-mail should be onwardly 
transmitted to the intended recipient(s).

This footnote also confirms that this email message has been swept by Sophos 
for the presence of computer viruses.

**




Re: Tomcat6+webapps+log4j

2013-01-29 Thread Mark Eggers

On 1/29/2013 2:40 AM, Tiago Sousa wrote:

Em 28/01/2013 18:51, Mark Eggers escreveu:

On 1/28/2013 10:06 AM, Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Tiago,

On 1/28/13 11:25 AM, Tiago Sousa wrote:

Em 28/01/2013 16:16, Christopher Schultz escreveu: Tiago,

On 1/28/13 11:02 AM, Tiago Sousa wrote:

Em 28/01/2013 15:41, Christopher Schultz escreveu: Tiago,

On 1/28/13 8:49 AM, Tiago Sousa wrote:

Thanks, one more time, for your reply. The problem with
log4j 1.x is that it outputs the following error:
log4j:WARN No appenders could be found for logger
(org.apache.catalina.startup.Embedded). log4j:WARN
Please initialize the log4j system properly.

I know that this is a common error, usually related
with classpath problems. In my case, the configuration
i'm using doesn´t seem to be have those sort of
problems

This is a symptom of having your log4j.properties in the
wrong place.

You never said anything about using Tomcat Embedded. If you
are using Embedded Tomcat, you'll have to make sure that
your log4j.properties file is in the CLASSPATH of the JVM
when it starts.

-chris

-




To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org

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


Hi. Thanks for your reply. Isn´t that assured (log4j in
classpath) putting the log4j.properties in apache lib folder
since i'm using tomcat 6.x?

If you are using Tomcat Embedded, you are entirely responsible for
your own CLASSPATH. The "Embedded" class causes the logger to be
initialized before any real code gets executed (it's in the first
static initializer in the class), so "Embedded" can't change the
CLASSPATH or launch a new ClassLoader for that purpose.

Can you please describe your environment? It's been tough to get
details from you.

-chris

-



To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org

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


Hi,

Sorry, i am a newbie in tomcat issues. I'm just "following
orders"... :-) My configuration is the most standard i could find:

1 step: download apache-tomcat-6.0.36.zip from apache.org 2 -
unzip 3 - erase logging.properties from conf folder 4 - copy jar
files (juli and juli-adapters)from extras to bin and lib
directories, respectively. 5 - create a logging.properties file
(standard definitions as in apache.org) and put it in lib folder.
6- download log4j.1.2.7.jar and put it in lib folder.

And that's it. I'm using tomcat in windows.

Hope this helps you to help me...

So where does the Embedded class come in? How do you launch Tomcat?

- -chris

I just tried this - finally upgraded to 6.0.36 on this machine (been
using 7.0.x, so I haven't thought much about it).

OS: Windows 7 Home Premium 64 bit
JRE:1.7.0_11 64 bit
Tomcat: 6.0.36
Editor: jEdit

I normally use Cygwin to unpack the zip file and edit stuff, but that
can leave ownership / permissions in strange states. So this time I did
the following.

1. Unpack the zip file in C:\Users\\Apache\apache-6.0.36 (IZArc)
2. Make the appropriate edits to %CATALINA_HOME%\conf\tomcat-users.xml
3. Add setenv.bat to %CATALINA_HOME%\bin for JMX
4. Add URIEncoding=UTF-8 to Connector elements
5. Enable AccessLogValve
6. Add MySQL and mail jars to %CATALINA_HOME%\lib for some applications

Double-clicking on startup.bat from Windows Explorer results in the
expected execution. I get entries in the appropriate log files.

Now I do the following:

1. back up tomcat-juli.jar
2. replace it with the tomcat-juli.jar from Extras
3. add log4j-1.2.17.jar to %CATALINA_HOME%\lib
4. add tomcat-juli-adapters.jar to %CATALINA_HOME%\lib
5. Create log4j.properties
 a. Copy from Tomcat web site
 b. Save in %CATALINA_HOME%\conf
6. Remove logging.properties from %CATALINA_HOME%\conf

Start Tomcat by double-clicking startup.bat in %CATALINA_HOME%\bin from
Windows Explorer.

The result:

I get the same warning (No appenders could be found for logger
(org.apache.catalina.startup.Embedded). I get no log files in
%CATALINA_HOME%\logs other than the access log.

I also verified that I have no web applications with log4j-1.2.17.jar in
a WEB-INF/lib, nor do I have log4j.xml floating around in
%CATALINA_HOME%\webapps.

I'm not a Windows person and normally just use JULI logging for Tomcat.
So maybe I've done something wrong . . . dunno.

Hmm. Maybe I'll try rewriting the log4j.properties as log4j.xml.

. . . . just my two cents.
/mde/

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


Hi.

I guess that in your case you just have to put your log4j.properties in
the lib folder, not the conf folder.

Tiago

-
To unsubscribe, e-mail

Re: Tomcat6+webapps+log4j

2013-01-29 Thread Tiago Sousa

Em 28/01/2013 18:51, Mark Eggers escreveu:

On 1/28/2013 10:06 AM, Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Tiago,

On 1/28/13 11:25 AM, Tiago Sousa wrote:

Em 28/01/2013 16:16, Christopher Schultz escreveu: Tiago,

On 1/28/13 11:02 AM, Tiago Sousa wrote:

Em 28/01/2013 15:41, Christopher Schultz escreveu: Tiago,

On 1/28/13 8:49 AM, Tiago Sousa wrote:

Thanks, one more time, for your reply. The problem with
log4j 1.x is that it outputs the following error:
log4j:WARN No appenders could be found for logger
(org.apache.catalina.startup.Embedded). log4j:WARN
Please initialize the log4j system properly.

I know that this is a common error, usually related
with classpath problems. In my case, the configuration
i'm using doesn´t seem to be have those sort of
problems

This is a symptom of having your log4j.properties in the
wrong place.

You never said anything about using Tomcat Embedded. If you
are using Embedded Tomcat, you'll have to make sure that
your log4j.properties file is in the CLASSPATH of the JVM
when it starts.

-chris

-



To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org

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


Hi. Thanks for your reply. Isn´t that assured (log4j in
classpath) putting the log4j.properties in apache lib folder
since i'm using tomcat 6.x?

If you are using Tomcat Embedded, you are entirely responsible for
your own CLASSPATH. The "Embedded" class causes the logger to be
initialized before any real code gets executed (it's in the first
static initializer in the class), so "Embedded" can't change the
CLASSPATH or launch a new ClassLoader for that purpose.

Can you please describe your environment? It's been tough to get
details from you.

-chris

-



To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org

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


Hi,

Sorry, i am a newbie in tomcat issues. I'm just "following
orders"... :-) My configuration is the most standard i could find:

1 step: download apache-tomcat-6.0.36.zip from apache.org 2 -
unzip 3 - erase logging.properties from conf folder 4 - copy jar
files (juli and juli-adapters)from extras to bin and lib
directories, respectively. 5 - create a logging.properties file
(standard definitions as in apache.org) and put it in lib folder.
6- download log4j.1.2.7.jar and put it in lib folder.

And that's it. I'm using tomcat in windows.

Hope this helps you to help me...

So where does the Embedded class come in? How do you launch Tomcat?

- -chris

I just tried this - finally upgraded to 6.0.36 on this machine (been
using 7.0.x, so I haven't thought much about it).

OS: Windows 7 Home Premium 64 bit
JRE:1.7.0_11 64 bit
Tomcat: 6.0.36
Editor: jEdit

I normally use Cygwin to unpack the zip file and edit stuff, but that
can leave ownership / permissions in strange states. So this time I did
the following.

1. Unpack the zip file in C:\Users\\Apache\apache-6.0.36 (IZArc)
2. Make the appropriate edits to %CATALINA_HOME%\conf\tomcat-users.xml
3. Add setenv.bat to %CATALINA_HOME%\bin for JMX
4. Add URIEncoding=UTF-8 to Connector elements
5. Enable AccessLogValve
6. Add MySQL and mail jars to %CATALINA_HOME%\lib for some applications

Double-clicking on startup.bat from Windows Explorer results in the
expected execution. I get entries in the appropriate log files.

Now I do the following:

1. back up tomcat-juli.jar
2. replace it with the tomcat-juli.jar from Extras
3. add log4j-1.2.17.jar to %CATALINA_HOME%\lib
4. add tomcat-juli-adapters.jar to %CATALINA_HOME%\lib
5. Create log4j.properties
 a. Copy from Tomcat web site
 b. Save in %CATALINA_HOME%\conf
6. Remove logging.properties from %CATALINA_HOME%\conf

Start Tomcat by double-clicking startup.bat in %CATALINA_HOME%\bin from
Windows Explorer.

The result:

I get the same warning (No appenders could be found for logger
(org.apache.catalina.startup.Embedded). I get no log files in
%CATALINA_HOME%\logs other than the access log.

I also verified that I have no web applications with log4j-1.2.17.jar in
a WEB-INF/lib, nor do I have log4j.xml floating around in
%CATALINA_HOME%\webapps.

I'm not a Windows person and normally just use JULI logging for Tomcat.
So maybe I've done something wrong . . . dunno.

Hmm. Maybe I'll try rewriting the log4j.properties as log4j.xml.

. . . . just my two cents.
/mde/

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


Hi.

I guess that in your case you just have to put your log4j.properties in 
the lib folder, not the conf folder.


Tiago

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

RE: Unexpected poller error

2013-01-29 Thread Vishal-sh Sharma
Hi Christopher,

It worked!! Thanks a ton!!

We were trying to use(compile) the java code in the tcnative distribution and 
hence the issue.
Everything worked to a T , i.e the http calls that were failing earlier, when 
we ignored the java code provided with the native distribution.

Thanks once again..you saved me (my team as well ) lot of pain..

Thanks,
Vishal



From: Christopher Schultz [ch...@christopherschultz.net]
Sent: Friday, January 25, 2013 7:36 PM
To: Tomcat Users List
Subject: Re: Unexpected poller error

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Vishal,

On 1/25/13 6:11 AM, Vishal-sh Sharma wrote:
> Thanks for prompt reply. I am no java developer so gave me good
> lead.
>
> I compared the Poll.java in  tomcat source ( 7.0.35 src ) with
> tomcat-native-1.1.24-src
>
> diff apache-tomcat-7.0.35-src/java/org/apache/tomcat/jni/Poll.java
> tomcat-native-1.1.24-src/jni/java/org/apache/tomcat/jni/Poll.java

That's not a valid comparison, unfortunately. For some reason, Java code
remains tucked-away in the tcnative project but it is no longer used (or
shouldn't be). Tomcat includes in its standard distribution everything
you need to use tcnative.

Did you manually compile the Java portion of tcnative? If so, please
remove whatever JAR file you produced from that procedure and re-run
your tests.

> Looks like that in latest version of  native library , the
> "addWithTimeout" function is missing. The "C" counterpart indeed
> is present in the native library.
>
> Does it make sense to copy the Poll.java from the tomcat src to
> native library and build the native library??

No, you should simply ignore all the Java code in the tcnative
distribution.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEC3tcACgkQ9CaO5/Lv0PDiZACfQIeeJflrmyB3/oJVwAtN9lA+
grUAn2LP8TrFL7iAIh0ftldIilaIZCFT
=JdKl
-END PGP SIGNATURE-

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


---
This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient (or have received this e-mail in error) please 
notify the sender immediately and delete this e-mail. Any unauthorized copying, 
disclosure or distribution of the material in this e-mail is strictly forbidden.

Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional 
EU corporate and regulatory disclosures.

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



RE: Destroying resources created with a custom ObjectFactory

2013-01-29 Thread Xavier Dury
Ok nevermind, I just found the closeMethod attribute on Resource 
(http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Resource_Definitions)
Thanks,
Xavier

> From: kal...@hotmail.com
> To: users@tomcat.apache.org
> Subject: RE: Destroying resources created with a custom ObjectFactory
> Date: Tue, 29 Jan 2013 11:08:26 +0100
> 
> Hi,
> 
> There seems to be no simple way to destroy jndi resources in tomcat, somebody 
> had a similar problem here 
> (http://fogbugz.atomikos.com/default.asp?community.6.2101.7) and was advised 
> to use tomcat org.apache.catalina.Lifecycle* classes.
> 
> What I had first in mind was to register a NamespaceChangeListener into the 
> context passed to the getObjectInstance() method but, apparently, it does not 
> implement javax.naming.event.EventContext. This is what I wanted to do: 
> http://pastebin.com/W7dCafPS (on pastebin to keep the formating).
> 
> Is there another (simple) way to destroy my jndi resources?
> 
> Thanks,
> 
> Xavier
> 
> > From: kal...@hotmail.com
> > To: users@tomcat.apache.org
> > Subject: RE: Destroying resources created with a custom ObjectFactory
> > Date: Tue, 29 Jan 2013 09:22:36 +0100
> > 
> > Hi,
> > Here is my context.xml
> > > type="net.sf.ehcache.CacheManager" factory="eg.CacheManagerFactory" 
> > configurationFile="${catalina.home}/conf/test-ehcache.xml" />
> > and this is my ObjectFactory:
> > public class CacheManagerFactory implements ObjectFactory {
> >   public Object getObjectInstance(Object object, Name jndiName, Context 
> > context, Hashtable environment) throws Exception {String 
> > configurationFile = null;if (object instanceof Reference) {  
> > Reference reference = (Reference) object;  Enumeration 
> > refAddrs = reference.getAll();  while (refAddrs.hasMoreElements()) {
> > RefAddr refAddr = refAddrs.nextElement();if 
> > ("configurationFile".equals(refAddr.getType())) {  
> > configurationFile = (String) refAddr.getContent();}  }}
> > CacheManager cacheManager = configurationFile == null ? 
> > CacheManager.create() : CacheManager.create(configurationFile);// 
> > Register some hook here to call cacheManager.shutdown() on 
> > undeploy/redeployreturn cacheManager;  }}
> > Xavier
> > > Date: Mon, 28 Jan 2013 13:07:15 -0500
> > > From: ch...@christopherschultz.net
> > > To: users@tomcat.apache.org
> > > Subject: Re: FW: Destroying resources created with a custom ObjectFactory
> > > 
> > > -BEGIN PGP SIGNED MESSAGE-
> > > Hash: SHA256
> > > 
> > > Xavier,
> > > 
> > > On 1/28/13 12:20 PM, Xavier Dury wrote:
> > > > I'm using Tomcat 7.0.x and made a custom 
> > > > javax.naming.spi.ObjectFactory to create a Ehcache manager,
> > > > exposing a configured CacheManager to an application through
> > > > (local) JNDI. My question is: how/where can I call the
> > > > CacheManager.shutdown() method when my application is
> > > > (re|un)deployed? I tried adding a NamespaceChangerListener to the
> > > > (Event)Context passed to the ObjectFactory.getObjectInstance()
> > > > method without luck.
> > > 
> > > What does your configuration look like? Are you using  in
> > > server.xml/context.xml?
> > > 
> > > - -chris
> > > -BEGIN PGP SIGNATURE-
> > > Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
> > > Comment: GPGTools - http://gpgtools.org
> > > Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
> > > 
> > > iEYEAREIAAYFAlEGvlMACgkQ9CaO5/Lv0PAmawCfS5ZP+1RzKbQJzZBtwo6vrPj1
> > > Z6YAn3NHTr/oiR7RUVgzZgMcs5NDNlCq
> > > =iX5J
> > > -END PGP SIGNATURE-
> > > 
> > > -
> > > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> > > For additional commands, e-mail: users-h...@tomcat.apache.org
> > > 
> >   
> 
  

RE: Destroying resources created with a custom ObjectFactory

2013-01-29 Thread Xavier Dury
Hi,

There seems to be no simple way to destroy jndi resources in tomcat, somebody 
had a similar problem here 
(http://fogbugz.atomikos.com/default.asp?community.6.2101.7) and was advised to 
use tomcat org.apache.catalina.Lifecycle* classes.

What I had first in mind was to register a NamespaceChangeListener into the 
context passed to the getObjectInstance() method but, apparently, it does not 
implement javax.naming.event.EventContext. This is what I wanted to do: 
http://pastebin.com/W7dCafPS (on pastebin to keep the formating).

Is there another (simple) way to destroy my jndi resources?

Thanks,

Xavier

> From: kal...@hotmail.com
> To: users@tomcat.apache.org
> Subject: RE: Destroying resources created with a custom ObjectFactory
> Date: Tue, 29 Jan 2013 09:22:36 +0100
> 
> Hi,
> Here is my context.xml
>   type="net.sf.ehcache.CacheManager" factory="eg.CacheManagerFactory" 
> configurationFile="${catalina.home}/conf/test-ehcache.xml" />
> and this is my ObjectFactory:
> public class CacheManagerFactory implements ObjectFactory {
>   public Object getObjectInstance(Object object, Name jndiName, Context 
> context, Hashtable environment) throws Exception {String 
> configurationFile = null;if (object instanceof Reference) {  
> Reference reference = (Reference) object;  Enumeration refAddrs 
> = reference.getAll();  while (refAddrs.hasMoreElements()) {
> RefAddr refAddr = refAddrs.nextElement();if 
> ("configurationFile".equals(refAddr.getType())) {  configurationFile 
> = (String) refAddr.getContent();}  }}CacheManager 
> cacheManager = configurationFile == null ? CacheManager.create() : 
> CacheManager.create(configurationFile);// Register some hook here to call 
> cacheManager.shutdown() on undeploy/redeployreturn cacheManager;  }}
> Xavier
> > Date: Mon, 28 Jan 2013 13:07:15 -0500
> > From: ch...@christopherschultz.net
> > To: users@tomcat.apache.org
> > Subject: Re: FW: Destroying resources created with a custom ObjectFactory
> > 
> > -BEGIN PGP SIGNED MESSAGE-
> > Hash: SHA256
> > 
> > Xavier,
> > 
> > On 1/28/13 12:20 PM, Xavier Dury wrote:
> > > I'm using Tomcat 7.0.x and made a custom 
> > > javax.naming.spi.ObjectFactory to create a Ehcache manager,
> > > exposing a configured CacheManager to an application through
> > > (local) JNDI. My question is: how/where can I call the
> > > CacheManager.shutdown() method when my application is
> > > (re|un)deployed? I tried adding a NamespaceChangerListener to the
> > > (Event)Context passed to the ObjectFactory.getObjectInstance()
> > > method without luck.
> > 
> > What does your configuration look like? Are you using  in
> > server.xml/context.xml?
> > 
> > - -chris
> > -BEGIN PGP SIGNATURE-
> > Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
> > Comment: GPGTools - http://gpgtools.org
> > Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
> > 
> > iEYEAREIAAYFAlEGvlMACgkQ9CaO5/Lv0PAmawCfS5ZP+1RzKbQJzZBtwo6vrPj1
> > Z6YAn3NHTr/oiR7RUVgzZgMcs5NDNlCq
> > =iX5J
> > -END PGP SIGNATURE-
> > 
> > -
> > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> > For additional commands, e-mail: users-h...@tomcat.apache.org
> > 
> 
  

Re: LDAP on TOMCAT 7.0.30

2013-01-29 Thread André Warnier

Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

André,

On 1/28/13 12:32 PM, André Warnier wrote:

Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE- Hash: SHA256

Chris,

On 1/28/13 7:47 AM, chris derham wrote:

1) All 3 applications  are browser compatible  and users may
use other then IE hence IE alone can be ruled out

Do you mean "multiple browsers access these web applications,
so we can't use anything that is IE specific"? Assuming that
you do, I don't believe that anybody suggested anything that is
IE specific, e.g. the SSO solutions so far posted will work in
other browsers as well. Can you elaborate on what you mean
exactly please?

I think auto-forwarding credentials from the client system
through the browser generally requires MSIE. I've never done
anything like that and have no idea what I'm talking about, so I
may be completely wrong.


You are. Firefox supports "Windows Integrated Authentication" fine
too, and I believe most usual current browsers do.


Do you need a plug-in or anything like that? Does it need to be
specifically enabled?



This may provide more details :
http://markmonica.com/2007/11/20/firefox-and-integrated-windows-authentication/
or search Google for : windows integrated authentication support in firefox

I am using currently Firefox v 17.0.1, and it seems to do fine right out of the 
box.
By default, Firefox will prompt for id/pw in a dialog box anyway, even for WIA. But you 
can change this specifically for a list of sites, for which no prompt will be issued.

(That's all under Windows of course).

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



RE: Destroying resources created with a custom ObjectFactory

2013-01-29 Thread Xavier Dury
Hi,
Here is my context.xml
   
and this is my ObjectFactory:
public class CacheManagerFactory implements ObjectFactory {
  public Object getObjectInstance(Object object, Name jndiName, Context 
context, Hashtable environment) throws Exception {String 
configurationFile = null;if (object instanceof Reference) {  Reference 
reference = (Reference) object;  Enumeration refAddrs = 
reference.getAll();  while (refAddrs.hasMoreElements()) {RefAddr 
refAddr = refAddrs.nextElement();if 
("configurationFile".equals(refAddr.getType())) {  configurationFile = 
(String) refAddr.getContent();}  }}CacheManager 
cacheManager = configurationFile == null ? CacheManager.create() : 
CacheManager.create(configurationFile);// Register some hook here to call 
cacheManager.shutdown() on undeploy/redeployreturn cacheManager;  }}
Xavier
> Date: Mon, 28 Jan 2013 13:07:15 -0500
> From: ch...@christopherschultz.net
> To: users@tomcat.apache.org
> Subject: Re: FW: Destroying resources created with a custom ObjectFactory
> 
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
> 
> Xavier,
> 
> On 1/28/13 12:20 PM, Xavier Dury wrote:
> > I'm using Tomcat 7.0.x and made a custom 
> > javax.naming.spi.ObjectFactory to create a Ehcache manager,
> > exposing a configured CacheManager to an application through
> > (local) JNDI. My question is: how/where can I call the
> > CacheManager.shutdown() method when my application is
> > (re|un)deployed? I tried adding a NamespaceChangerListener to the
> > (Event)Context passed to the ObjectFactory.getObjectInstance()
> > method without luck.
> 
> What does your configuration look like? Are you using  in
> server.xml/context.xml?
> 
> - -chris
> -BEGIN PGP SIGNATURE-
> Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
> 
> iEYEAREIAAYFAlEGvlMACgkQ9CaO5/Lv0PAmawCfS5ZP+1RzKbQJzZBtwo6vrPj1
> Z6YAn3NHTr/oiR7RUVgzZgMcs5NDNlCq
> =iX5J
> -END PGP SIGNATURE-
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>