RE: ContextListener executes twice

2008-07-22 Thread Caldarale, Charles R
 From: Riaz, Bob [mailto:[EMAIL PROTECTED]
 Subject: ContextListener executes twice

 In my webapp I have a ContextListener class in which I
 initialize a DB connection. I've noticed that when I run
 the project this code executes twice.

Is your app being deployed twice?  Improper Context settings can do that.

 - 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 start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: ContextListener executes twice

2008-07-22 Thread Riaz, Bob
Looks that way. 
I do get this message in deploying:
INFO: The listener MyContextListener is already configured for this
context. The duplicate definition has been ignored.

Default settings from context.xml:

Context

!-- Default set of monitored resources --
WatchedResourceWEB-INF/web.xml/WatchedResource

!-- Uncomment this to disable session persistence across Tomcat
restarts --
!--
Manager pathname= /
--

!-- Uncomment this to enable Comet connection tacking (provides
events
 on session expiration as well as webapp lifecycle) --
!--
Valve
className=org.apache.catalina.valves.CometConnectionManagerValve /
--

/Context

Bob

-Original Message-
From: Caldarale, Charles R [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 22, 2008 10:49 AM
To: Tomcat Users List
Subject: RE: ContextListener executes twice

 From: Riaz, Bob [mailto:[EMAIL PROTECTED]
 Subject: ContextListener executes twice

 In my webapp I have a ContextListener class in which I
 initialize a DB connection. I've noticed that when I run
 the project this code executes twice.

Is your app being deployed twice?  Improper Context settings can do
that.

 - 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 start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: ContextListener executes twice

2008-07-22 Thread Caldarale, Charles R
 From: Riaz, Bob [mailto:[EMAIL PROTECTED]
 Subject: RE: ContextListener executes twice

 INFO: The listener MyContextListener is
 already configured for this context. The
 duplicate definition has been ignored.

That's a purely cosmetic error in the current 6.0 version; fixed in 6.0.17, 
whenever it gets released.

 Default settings from context.xml:

That looks like the global Context settings, not the one for your webapp.

1) Where is your webapp deployed?

2) Do you have a META-INF/context.xml file inside your webapp?  If so, what's 
in it?

3) Do you have a conf/Catalina/[host]/[appName].xml file?  If so, what's in it?

4) What is the appBase setting for each of your Host elements in 
conf/server.xml?

5) Do you have any Context elements in server.xml?  (You shouldn't.)

 - 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 start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: ContextListener executes twice

2008-07-22 Thread Riaz, Bob


-Original Message-
From: Caldarale, Charles R [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 22, 2008 11:12 AM
To: Tomcat Users List
Subject: RE: ContextListener executes twice

 From: Riaz, Bob [mailto:[EMAIL PROTECTED]
 Subject: RE: ContextListener executes twice

 INFO: The listener MyContextListener is
 already configured for this context. The
 duplicate definition has been ignored.

That's a purely cosmetic error in the current 6.0 version; fixed in
6.0.17, whenever it gets released.

 Default settings from context.xml:

That looks like the global Context settings, not the one for your
webapp.

1) Where is your webapp deployed?
On my dev machine - localhost. Is that what you mean?

2) Do you have a META-INF/context.xml file inside your webapp?  If so,
what's in it?

?xml version=1.0 encoding=UTF-8?
Context path=/MyWebApp/


3) Do you have a conf/Catalina/[host]/[appName].xml file?  If so, what's
in it?
?xml version=1.0 encoding=UTF-8?
Context docBase=C:/..Path/NetBeansProjects/MyWebApp/build/web path=/
MyWebApp /

4) What is the appBase setting for each of your Host elements in
conf/server.xml?
 Host name=localhost  appBase=webapps
unpackWARs=true autoDeploy=true
xmlValidation=false xmlNamespaceAware=false

!-- SingleSignOn valve, share authentication between web
applications
 Documentation at: /docs/config/valve.html --
!--
Valve
className=org.apache.catalina.authenticator.SingleSignOn /
--

!-- Access log processes all example.
 Documentation at: /docs/config/valve.html --
!--
Valve className=org.apache.catalina.valves.AccessLogValve
directory=logs  
   prefix=localhost_access_log. suffix=.txt
pattern=common resolveHosts=false/
--

  /Host


5) Do you have any Context elements in server.xml?  (You shouldn't.)
I don't.

 - 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 start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: ContextListener executes twice

2008-07-22 Thread Caldarale, Charles R
 From: Riaz, Bob [mailto:[EMAIL PROTECTED]
 Subject: RE: ContextListener executes twice

  1) Where is your webapp deployed?
 On my dev machine - localhost. Is that what you mean?

No, what directory is it in?  Is it a .war or an expanded webapp?

  2) Do you have a META-INF/context.xml file inside your webapp?
 ?xml version=1.0 encoding=UTF-8?
 Context path=/MyWebApp/

The path attribute is illegal here.  You don't really need a Context at all.

  3) Do you have a conf/Catalina/[host]/[appName].xml file?
 ?xml version=1.0 encoding=UTF-8?
 Context
 docBase=C:/..Path/NetBeansProjects/MyWebApp/build/web path=/
 MyWebApp /

The above will override the invalid one in META-INF/context.xml.

  4) What is the appBase setting for each of your Host elements
  in conf/server.xml?
 Host name=localhost  appBase=webapps

Do you happen to have a copy of your webapp deployed under Tomcat's webapps 
directory?  If so, that would account for the double initialization.

Does the problem occur when you run Tomcat independently of NetBeans, or only 
if run through NetBeans?

 - 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 start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: ContextListener executes twice

2008-07-22 Thread Fu-Tung Cheng
Might have to do with this:

Any declared listener will be reported as declared twice due to this bug

http://www.mail-archive.com/[EMAIL PROTECTED]/msg23408.html

Fu-Tung

--- On Tue, 7/22/08, Caldarale, Charles R [EMAIL PROTECTED] wrote:

 From: Caldarale, Charles R [EMAIL PROTECTED]
 Subject: RE: ContextListener executes twice
 To: Tomcat Users List users@tomcat.apache.org
 Date: Tuesday, July 22, 2008, 4:51 PM
  From: Riaz, Bob [mailto:[EMAIL PROTECTED]
  Subject: RE: ContextListener executes twice
 
   1) Where is your webapp deployed?
  On my dev machine - localhost. Is that what you mean?
 
 No, what directory is it in?  Is it a .war or an expanded
 webapp?
 
   2) Do you have a META-INF/context.xml file inside
 your webapp?
  ?xml version=1.0
 encoding=UTF-8?
  Context path=/MyWebApp/
 
 The path attribute is illegal here.  You don't really
 need a Context at all.
 
   3) Do you have a
 conf/Catalina/[host]/[appName].xml file?
  ?xml version=1.0
 encoding=UTF-8?
  Context
 
 docBase=C:/..Path/NetBeansProjects/MyWebApp/build/web
 path=/
  MyWebApp /
 
 The above will override the invalid one in
 META-INF/context.xml.
 
   4) What is the appBase setting for each of your
 Host elements
   in conf/server.xml?
  Host name=localhost 
 appBase=webapps
 
 Do you happen to have a copy of your webapp deployed under
 Tomcat's webapps directory?  If so, that would account
 for the double initialization.
 
 Does the problem occur when you run Tomcat independently of
 NetBeans, or only if run through NetBeans?
 
  - 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 start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]


  


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: ContextListener executes twice

2008-07-22 Thread Riaz, Bob


-Original Message-
From: Caldarale, Charles R [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 22, 2008 11:52 AM
To: Tomcat Users List
Subject: RE: ContextListener executes twice

 From: Riaz, Bob [mailto:[EMAIL PROTECTED]
 Subject: RE: ContextListener executes twice

  1) Where is your webapp deployed?
 On my dev machine - localhost. Is that what you mean?

No, what directory is it in?  Is it a .war or an expanded webapp?
\NetBeansProjects. Expanded webapp, not running it as a .war.

  2) Do you have a META-INF/context.xml file inside your webapp?
 ?xml version=1.0 encoding=UTF-8?
 Context path=/MyWebApp/

The path attribute is illegal here.  You don't really need a Context
at all.
Ok. Removed it. But if the conf/Catalina/[host]/[appName].xml
overrides this, this should make no difference, right?

  3) Do you have a conf/Catalina/[host]/[appName].xml file?
 ?xml version=1.0 encoding=UTF-8?
 Context
 docBase=C:/..Path/NetBeansProjects/MyWebApp/build/web path=/
 MyWebApp /

The above will override the invalid one in META-INF/context.xml.

  4) What is the appBase setting for each of your Host elements
  in conf/server.xml?
 Host name=localhost  appBase=webapps

Do you happen to have a copy of your webapp deployed under Tomcat's
webapps directory?  If so, that would account for the double
initialization.
Don't see it under \webapps

Does the problem occur when you run Tomcat independently of NetBeans, or
only if run through NetBeans?
So far I have only run it through NetBeans. When I try to start Tomcat
through the cmd shell (using startup.bat) I get the following error:
The JAV_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB:JAVA_HOME should point to a JDK nota JRE
The JAVA_HOME variable points to the bin in the jdk folder, same error
if JAVA_HOME points to jdk folder.

 - 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 start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: ContextListener executes twice

2008-07-22 Thread Riaz, Bob
Thanks.
Does anyone know of a patch for this? I couldn't find one.

In org.apache.catalina.startup.WebRuleSet you'll see this twice:

digester.addCallMethod(prefix + web-app/listener/listener-class,
addApplicationListener, 0);


-Original Message-
From: Fu-Tung Cheng [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 22, 2008 12:13 PM
To: Tomcat Users List
Subject: RE: ContextListener executes twice

Might have to do with this:

Any declared listener will be reported as declared twice due to this bug

http://www.mail-archive.com/[EMAIL PROTECTED]/msg23408.html

Fu-Tung

--- On Tue, 7/22/08, Caldarale, Charles R [EMAIL PROTECTED]
wrote:

 From: Caldarale, Charles R [EMAIL PROTECTED]
 Subject: RE: ContextListener executes twice
 To: Tomcat Users List users@tomcat.apache.org
 Date: Tuesday, July 22, 2008, 4:51 PM
  From: Riaz, Bob [mailto:[EMAIL PROTECTED]
  Subject: RE: ContextListener executes twice
 
   1) Where is your webapp deployed?
  On my dev machine - localhost. Is that what you mean?
 
 No, what directory is it in?  Is it a .war or an expanded
 webapp?
 
   2) Do you have a META-INF/context.xml file inside
 your webapp?
  ?xml version=1.0
 encoding=UTF-8?
  Context path=/MyWebApp/
 
 The path attribute is illegal here.  You don't really
 need a Context at all.
 
   3) Do you have a
 conf/Catalina/[host]/[appName].xml file?
  ?xml version=1.0
 encoding=UTF-8?
  Context
 
 docBase=C:/..Path/NetBeansProjects/MyWebApp/build/web
 path=/
  MyWebApp /
 
 The above will override the invalid one in
 META-INF/context.xml.
 
   4) What is the appBase setting for each of your
 Host elements
   in conf/server.xml?
  Host name=localhost 
 appBase=webapps
 
 Do you happen to have a copy of your webapp deployed under
 Tomcat's webapps directory?  If so, that would account
 for the double initialization.
 
 Does the problem occur when you run Tomcat independently of
 NetBeans, or only if run through NetBeans?
 
  - 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 start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]


  


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: ContextListener executes twice

2008-07-22 Thread Caldarale, Charles R
 From: Riaz, Bob [mailto:[EMAIL PROTECTED]
 Subject: RE: ContextListener executes twice

 Does anyone know of a patch for this? I couldn't find one.

The bug does *not* cause the Listener to be executed twice, since the second 
registration attempt is ignored; the message is purely cosmetic.  If you read 
the whole thread you'll see that the double registration has been occurring in 
all 6.0 levels, but only recent ones started logging it.

This isn't your problem.

 - 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 start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: ContextListener executes twice

2008-07-22 Thread Caldarale, Charles R
 From: Riaz, Bob [mailto:[EMAIL PROTECTED]
 Subject: RE: ContextListener executes twice

 Ok. Removed it. But if the conf/Catalina/[host]/[appName].xml
 overrides this, this should make no difference, right?

True, but there's no point in leaving invalid junk lying around just waiting to 
cause trouble.

 The JAVA_HOME variable points to the bin in the jdk folder,
 same error if JAVA_HOME points to jdk folder.

JAVA_HOME must point to the directory one up from bin.  Looks like the 
environment variable is not being seen by the process running the startup.bat 
script.  Open up a command prompt window, cd to your Tomcat bin directory, 
enter a set command with no parameters and see what you've got.  If JAVA_HOME 
is set properly, running startup.bat will get you something like this:

Using CATALINA_BASE:   C:\apache-tomcat-6.0.16
Using CATALINA_HOME:   C:\apache-tomcat-6.0.16
Using CATALINA_TMPDIR: C:\apache-tomcat-6.0.16\temp
Using JRE_HOME:C:\jdk1.6.0

(Yes, it says JRE_HOME, that's acceptable.)  Tomcat will start running in 
another command prompt window.

To check JAVA_HOME, try this:

%JAVA_HOME%\bin\java.exe -version

 - 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 start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]