Re: ClassNotFoundException when calling custom MBean operation

2018-03-06 Thread Konstantin Kolinko
2018-03-06 18:43 GMT+03:00 Christopher Schultz :
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> All,
>
> I think I already know the answer to this question, but I'm going to
> ask anyway in case it helps others understand what's going on.
>
> I have a custom MBean for a loadable-object in my web application.
> This is an object that lives in the application-scope and needs to be
> periodically re-loaded from our relational database when we add new
> data to it.
>
> The bean looks like this:
>
> public static class ReloadableObjectBean
> implements ReloadableObjectBeanMBean
> {
> private ReloadableObject _rlo;
> private Date _loadTime;
>
> public ReloadableObjectBean()
> {
> _rlo = null;
> _loadTime = null;
> }
>
> public ReloadableObjectBean(ReloadableObject dxe)
> {
> _loadTime = new Date();
> _rlo = dxe;
> }
>
> @Override
> public int getItemCount() {
> return _rlo.getItems().size();
> }
>
> protected Date getLoadTimeInternal()
> {
> return _loadTime;
> }
>
> @Override
> public Date getLoadTime() {
> return (Date)getLoadTimeInternal().clone();
> }
>
> @Override
> public void reload() throws ReloadableObjectException,
> ServiceException
> {
> ReloadableObject rlo =
> ReloadableObjectHelper.newReloadableObject();
> _loadTime = new Date();
> _rlo = rlo;
> }
> }
>
> This is an inner class defined in one of my ServletContextListeners,
> and it's inserted into the MBeanServer like this:
>
> ReloadableObject rlo =
> ReloadableObjectHelper.newReloadableObject();
>
> try {
> MBeanServer mbs = getServer();
> ObjectName objectName = new
> ObjectName("com.chadis:type=ReloadableObject");
>
> if(mbs.isRegistered(objectName))
> mbs.unregisterMBean(objectName);
>
> mbs.registerMBean(new ReloadableObjectBean(rlo), objectName)
> ;
> } catch (MBeanException mbe) {
> logger.warn("Cannot register MBean", mbe);
> } catch (InstanceAlreadyExistsException iaee) {
> logger.warn("Cannot register MBean", iaee);
> } catch (NotCompliantMBeanException ncme) {
> logger.warn("Cannot register MBean", ncme);
> } catch (MalformedObjectNameException mone) {
> logger.warn("Cannot register MBean", mone);
> } catch (InstanceNotFoundException infe) {
> logger.warn("Cannot de-register MBean", infe);
> }
>
> application.setAttribute("reloadbleObject", rlo);
>
> Everything goes well until I try to invoke the "reload" operation on
> this MBean from a JMX client, where I get ClassNotFoundException:
>
> 2018-03-06 10:26:07,271 [RMI TCP Connection(1)-169.254.211.40] FATAL
> ReloadableObjectHelper- Could not load ReloadableObject:
> ServiceException: Cannot obtain database connection
> at 
> ReloadableObjectHelper.getConnection(ReloadableObjectHelper.java:147
> )
> at
> ReloadableObjectHelper.newDiagnosisEngine(ReloadableObjectHelper.java:55
> )
> at 
> InitListener$ReloadableObjectBean.reloadEngine(InitListener.java:159
> )
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
> a:62)
> 
> Caused by:
> Caused by: javax.naming.NoInitialContextException: Cannot instantiate
> class: org.apache.naming.java.javaURLContextFactory [Root exception is
> java.lang.ClassNotFoundException:
> org.apache.naming.java.javaURLContextFactory]
> at
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:674)
> at 
> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:31
> 3)
> at javax.naming.InitialContext.init(InitialContext.java:244)
> at javax.naming.InitialContext.(InitialContext.java:192)
> at 
> ReloadbleObjectHelper.getConnection(ReloadableObjectHelper.java:136)
> ... 39 more
> Caused by: java.lang.ClassNotFoundException:
> org.apache.naming.java.javaURLContextFactory
> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:348)
> at
> com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:7
> 2)
> at
> com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:6
> 1)
> at
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:672)
> 

Re: Catalina.out not updating

2018-03-06 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Akhilesh,

On 3/6/18 7:31 AM, Akhilesh  ET wrote:
> We are facing a situation wherein one of our production servers
> running tomcat 6.0.18 is unable to generate logs after service
> startup. Logging just stops after service start up.

Maybe it's dying of old age. Since you aren't using a package-managed
version of Tomcat (and aren't at the mercy of the package-manager),
why not upgrade to a version of Tomcat that is riddled with fewer
security problems than 6.0.18? Maybe like 6.0.53, released during the
current decade.

Better yet, upgrade to Tomcat 8.5. If you aren't able to do this now,
you should really start looking at doing it in dev/test environments
so you can upgrade in the near-future.

> The setup is such a way that the control flows from a Apache
> Webserver to Jboss application server to Tomcat server. The tomcat
> server will connect to the external API URLs and logs should be
> generated for the same which is not working from past one week.

Just checking: this is tomcat inside JBoss, right? Or do you really
have a separate Tomcat that JBoss is talking to (JBoss being a
reverse-proxy, or something similar)?

> Just to give you an insight we are using source code based tomcat
> server and not rpm based. So the service startup is done using
> startup.sh script.
> 
> We tried swapping the IP of the server with the one that was
> working with no luck (The status was reversed with the server with
> same IP still not working). Which means there is something to do
> with the IP which is causing that issue (our assumption).

Weird. You just swapped the IP addresses of two servers and the
problem "moved" along with the IP to the other server?

> Please let me know what else needs to checked in order to make
> this working. The application itself is working fine. However the
> issue is with only the log generation which is very critical for
> tracking the application.

Are you getting no logs from the application, Tomcat, or both? Tomcat
isn't very chatty in catalina.out once it starts up. Really, you
should only be seeing critical errors, or notices about application
(re)deploying, etc.

Does your application log to System.out? If not, I wouldn't expect
application logs to go to catalina.out.

> Details of troubleshooting done so far :
> 
> 1.   Cleared the logs, restarted the service – No luck.
> 
> 2.   Cleared the cache of the server and restarted the service
> – No luck.
> 
> 3.   Rebooted the server multiple times – No Luck.
> 
> 4.   Tried starting tomcat from different web root and
> upgrading java  – No Luck.
> 
> 5.   Gave full permissions to tomcat folder and log files – No
> Luck

Thanks for providing that information. If you are talking about
application-logs, you're going to need to provide more information,
such as how the application performs logging in general. Are you using
an API/framework such as log4j or slf4j? Probably not, if you are
using an ancient version of Tomcat like that. Java-logging using
java.util.logging? Hmm... also probably not. Are you using
ServletContext.log() to perform logging? If so, those logs should be
going to an application-specific log in the logs/ directory.

- -chris
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQJRBAEBCAA7FiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlqfAkMdHGNocmlzQGNo
cmlzdG9waGVyc2NodWx0ei5uZXQACgkQHPApP6U8pFiknw/+K+Su0g4BKhbS/ESk
xZtqVjDhdd3besh07OukFdquxUzPKottHTPk7Xex7DWwOreOYb3Qtho1UvCpeYOt
s2JxsEFGSIIZZlJrlJtoEwfmhsbw1dIocMfSygXtKOH4JrlQOypcoT2sS2Fj5Dql
ATIgjvGehZptSKV9R1kwStfVxSrXuiTu281UImwx0wigRM5sw1nZRQBHZ5mDy9VE
sVZFNjjpzdP9HpL0g5ZsXM37bDQfsRYlauhvQf1oyDHRu8cMpBOLwm7tpgHat68z
DmDHGMtoUalr+TI7zObvmncyuBE70JRj9/MDlo8v/8XqlLwj/12TGcE59KoO2SsC
VU8Gp4+FvtaBTlvLukZNgjtkhuJAPhzIG+QpPX7OxNLV2/h56Ej3nAMB5S2WYFJx
gESk7bbwSd38rvaIpu3uN9HKQZhq+HYYbZ3grygpjpsPk9t75ihp5EhpLkwtXNiw
I76Exu6TTlEWUx1CUso7sfGmgxsslPBPaNKmilQb+hgjoieiH1ulqBQ+HW5fpeZ2
8XTPvysyr/sw6+k8nIsUbE4QEyO+4tpNjMaZjrLMEOr5oOoC/SWzIs9g/NwGANWP
hKTa1WJQXk7IhafLDjTCzJcC6WVtGmb+nbtyLNCSOPbl6oVLScLYPHLfbEpU91zG
8rhxWavnYzmJYlqBybjnqgFszvU=
=w3Oa
-END PGP SIGNATURE-

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



Re: WebApp Caching Broken

2018-03-06 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Ken,

On 3/6/18 9:09 AM, Kenneth Taylor wrote:
> More troubleshooting revealed that our root context xml had been
> copied from another installation and had a wrong path in it.

Do I smell another Darwin Award nomination?

> However, I don’t think this was the problem since it was only a
> path to a Log4J config. We re-installed Tomcat from scratch and it
> seems to have resolved it, but this is not good.  Why is Tomcat
> caching webapps?
Not sure what you mean. Please explain what YOU mean when you say
"caching". We probably have different definitions.

> Also determined that Tomcat was not shutting down properly.  Our 
> installation is deployed as a Windows Service.  Stopping the
> service did not stop Tomcat.  But the Service Console thinks it did
> stop, so when you restart it, another instance of Tomcat starts.
> We are using a Java Service Wrapper if that makes any difference.

Try taking a thread dump to see what threads are still running. My
guess is that your application starts some threads upon startup but
fails to shut them down on shutdown. Tomcat will not forcibly
shut-down the JVM for you; non-daemon threads can prevent the JVM stop
stopping even though Tomcat has shut-down cleanly.

> Also found another problem.  The “-XX:+DisableAttachMechanism” JVM 
> option does not work with Tomcat.  This is a security flaw.

Tomcat works perfectly fine with that option. There is no security
flaw, here. But it does mean that you won't be able to take a thread
dump of your application to find out what threads you left running,
sooo...

- -chris

> Disclaimer: This email from DMBGroup LLC, DMB Consulting Services
> LLC, or the personnel associated with either entity (collectively
> "*DMB*") and attachments, contain *CONFIDENTIAL, PRIVILEGED AND
> PROPRIETARY *information for exclusive use of the addressee
> individual(s) or entity.

OMG I had no idea!

> Unauthorized viewing, copying, disclosure, distribution or use of
> this e-mail or attachments may be subject to legal restriction or
> sanction.

Come at me, bro.

> If received in error, notify sender immediately by return e-mail
> and delete original message and attachments.

Obviously, both of these messages have been sent in error. It might be
difficult to remove them from the mailing list and archives and stuff.

> Nothing contained in this e-mail or attachments shall satisfy the 
> requirements for a writing unless specifically stated.
Hmm... writing isn't considered writing? Dogs and cats, living together.
..

> Nothing contained herein shall constitute a contract or electronic 
> signature under the Electronic Signatures in Global and National 
> Commerce Act, any version of the Uniform Electronic Transactions
> Act or any other statute governing electronic transactions.
Sorry, that's not how we roll here in Sealand. According to Article 6
Section 19 paragraph 49 sub-paragraph (e) of the Sealand Code, you are
now entered into a contract with all recipients of the list whereby
tyou agree not to be such a jerk. E Mare Libertas.

> Opinions and statements expressed in this e-mail and any
> attachments are those of the individual sender and not necessarily
> of DMB.

Good. But I still won't be contacting DMB for any consulting services
in the future, EVEN if they come out with another album as good as
Under the Table and Dreaming.

> DMB does not guarantee this e-mail transmission is secured, error
> or virus-free.
Or jerk-free. Time to update the disclaimer.

> Neither DMB nor the sender of this e-mail accepts liability for
> errors or omissions in the contents of this e-mail, which arise as
> a result of e-mail transmission.

How about sheer ignorance and lack of professional courtesy? I guess
that's not a technical problem.
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQJRBAEBCAA7FiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlqe/2QdHGNocmlzQGNo
cmlzdG9waGVyc2NodWx0ei5uZXQACgkQHPApP6U8pFiGSQ/5AZGIqJE4u6IP3eab
ivudFF5yXl0a+hVea3ML24sgIRSX90awsadi9rOrE9pROYtRGMN/ffrRp1URyxMA
E9Tz0QZtiKx7WoZGvkefhe9wgG64m7itf8jTr0uQRIRp/J3xmTlhE2IwDIpXlAXI
yssqeWR7Gj/ywWDHD4WLLr2KbHcnZUvf+gWrQLpCNVUo4vf48s1aU0iR5jts4Z1x
XYRKozC4GfW974o7KRplb+CxQ3xoifO4E/I87H6roKG/XodMpWCIIFo9yx/6MuWF
UKBf/PP2Oj4uY13jG3DjqqrgcDeZF2bBCxWjNvItuTN52eR3iUSEiYAveDIGfCxB
gnYSFSPoOC34AsrreYtDyCxuEC/JhJMymDnZp8+JbPA2Y0JHbpXP10ij+0AcHtCt
MWF6ubybYEwynchhTMt78Fmn+gzLVwIo688SR/6xb0OKAt+LLjRy5Xjzm/+t6p0p
aGHsBU9HG8n9KQsQNaCvKR62A3U4O9n+aCik7e4ARUl/VriUWGBI/46tkUdcs7O9
AZs53WoTq54zoTZM+srN8amP+t+6dM7zjlm8ExeCchpwICK8m1aKnFCaZazNqDpU
dxvCTIdlEA5LgmwQ0L7or2cKpiK/4WLejVpMkOJcLGs1KnaECjrHfkMrS7kNg8nZ
qLxqDfGYQTKkJijFOKcc70ADRdI=
=B6jm
-END PGP SIGNATURE-

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



ClassNotFoundException when calling custom MBean operation

2018-03-06 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

All,

I think I already know the answer to this question, but I'm going to
ask anyway in case it helps others understand what's going on.

I have a custom MBean for a loadable-object in my web application.
This is an object that lives in the application-scope and needs to be
periodically re-loaded from our relational database when we add new
data to it.

The bean looks like this:

public static class ReloadableObjectBean
implements ReloadableObjectBeanMBean
{
private ReloadableObject _rlo;
private Date _loadTime;

public ReloadableObjectBean()
{
_rlo = null;
_loadTime = null;
}

public ReloadableObjectBean(ReloadableObject dxe)
{
_loadTime = new Date();
_rlo = dxe;
}

@Override
public int getItemCount() {
return _rlo.getItems().size();
}

protected Date getLoadTimeInternal()
{
return _loadTime;
}

@Override
public Date getLoadTime() {
return (Date)getLoadTimeInternal().clone();
}

@Override
public void reload() throws ReloadableObjectException,
ServiceException
{
ReloadableObject rlo =
ReloadableObjectHelper.newReloadableObject();
_loadTime = new Date();
_rlo = rlo;
}
}

This is an inner class defined in one of my ServletContextListeners,
and it's inserted into the MBeanServer like this:

ReloadableObject rlo =
ReloadableObjectHelper.newReloadableObject();

try {
MBeanServer mbs = getServer();
ObjectName objectName = new
ObjectName("com.chadis:type=ReloadableObject");

if(mbs.isRegistered(objectName))
mbs.unregisterMBean(objectName);

mbs.registerMBean(new ReloadableObjectBean(rlo), objectName)
;
} catch (MBeanException mbe) {
logger.warn("Cannot register MBean", mbe);
} catch (InstanceAlreadyExistsException iaee) {
logger.warn("Cannot register MBean", iaee);
} catch (NotCompliantMBeanException ncme) {
logger.warn("Cannot register MBean", ncme);
} catch (MalformedObjectNameException mone) {
logger.warn("Cannot register MBean", mone);
} catch (InstanceNotFoundException infe) {
logger.warn("Cannot de-register MBean", infe);
}

application.setAttribute("reloadbleObject", rlo);

Everything goes well until I try to invoke the "reload" operation on
this MBean from a JMX client, where I get ClassNotFoundException:

2018-03-06 10:26:07,271 [RMI TCP Connection(1)-169.254.211.40] FATAL
ReloadableObjectHelper- Could not load ReloadableObject:
ServiceException: Cannot obtain database connection
at ReloadableObjectHelper.getConnection(ReloadableObjectHelper.java:147
)
at
ReloadableObjectHelper.newDiagnosisEngine(ReloadableObjectHelper.java:55
)
at InitListener$ReloadableObjectBean.reloadEngine(InitListener.java:159
)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:62)

Caused by:
Caused by: javax.naming.NoInitialContextException: Cannot instantiate
class: org.apache.naming.java.javaURLContextFactory [Root exception is
java.lang.ClassNotFoundException:
org.apache.naming.java.javaURLContextFactory]
at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:674)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:31
3)
at javax.naming.InitialContext.init(InitialContext.java:244)
at javax.naming.InitialContext.(InitialContext.java:192)
at ReloadbleObjectHelper.getConnection(ReloadableObjectHelper.java:136)
... 39 more
Caused by: java.lang.ClassNotFoundException:
org.apache.naming.java.javaURLContextFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at
com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:7
2)
at
com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:6
1)
at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:672)
... 43 more


The error I get on VisualVM (my JMX client, here) is that it can't
load my ServiceException class -- one that is defined only within the
web application.

I suspect the problem is that the thread's context class loader (TCCL)
is set to Tomcat's ClassLoader, since the request is being handled by
Tomcat's internal JMX 

Re: WebApp Caching Broken

2018-03-06 Thread Olaf Kock

Kenneth,


On 06.03.2018 15:09, Kenneth Taylor wrote:


More troubleshooting revealed that our root context xml had been 
copied from another installation and had a wrong path in it.  However, 
I don’t think this was the problem since it was only a path to a Log4J 
config.  We re-installed Tomcat from scratch and it seems to have 
resolved it, but this is not good.  Why is Tomcat caching webapps?




Tomcat loads webapps into memory, in order to execute them. It doesn't 
cache per se, as has been stated by others already.


Also determined that Tomcat was not shutting down properly.  Our 
installation is deployed as a Windows Service.  Stopping the service 
did not stop Tomcat.  But the Service Console thinks it did stop, so 
when you restart it, another instance of Tomcat starts.  We are using 
a Java Service Wrapper if that makes any difference.




Windows is known to sometimes keep file locks forever - in fact, I've 
been in trainings where students didn't just need to restart a server, 
but needed to reboot the OS in order to get rid of a locked file. Only 
on Windows.
Further, Tomcat does its best to shut down webapps. But if your webapps 
start their own non-daemon threads, the JVM doesn't shut down when 
Tomcat has long shut down. This, in turn, might keep file handles open, 
thus Windows-File-Locks (it's not always Windows that is to blame)


You'd have a point blaming tomcat for keeping references up, if you 
could reproduce your issues without custom webapps installed. I bet you 
can't, thus I'm seconding Mark with regards to the comment on your tone 
in your original post. And it doesn't really sound like you've read his 
reference.


Also found another problem.  The “-XX:+DisableAttachMechanism” JVM 
option does not work with Tomcat.  This is a security flaw.




please specify "does not work": Give steps to reproduce. Without them, 
this is just another rant assuming that you're perfect and all of the 
software around you is blamed for actively sabotaging your life


Olaf

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



Re: WebApp Caching Broken

2018-03-06 Thread M. Manna
Kenneth,

As MarkT suggested earlier, there is no such "Cache". If you are using
Tag/Cotext Pooling - it's a separate issue and you need to check tomcat's
documentation to check what options you need/don't need.

"The “-XX:+DisableAttachMechanism” JVM option does not work with Tomcat" -
what do you mean? Did it work before, but doesn't work now? or it has
"Never" worked?  or "Ignored"? Please be precise.

Regards,


On 6 March 2018 at 14:09, Kenneth Taylor 
wrote:

> More troubleshooting revealed that our root context xml had been copied
> from another installation and had a wrong path in it.  However, I don’t
> think this was the problem since it was only a path to a Log4J config.  We
> re-installed Tomcat from scratch and it seems to have resolved it, but this
> is not good.  Why is Tomcat caching webapps?
>
>
>
> Also determined that Tomcat was not shutting down properly.  Our
> installation is deployed as a Windows Service.  Stopping the service did
> not stop Tomcat.  But the Service Console thinks it did stop, so when you
> restart it, another instance of Tomcat starts.  We are using a Java Service
> Wrapper if that makes any difference.
>
>
>
> Also found another problem.  The “-XX:+DisableAttachMechanism” JVM option
> does not work with Tomcat.  This is a security flaw.
>
>
>
> Thanks.
>
> Ken
>
> Disclaimer: This email from DMBGroup LLC, DMB Consulting Services LLC, or
> the personnel associated with either entity (collectively "*DMB*") and
> attachments, contain *CONFIDENTIAL, PRIVILEGED AND PROPRIETARY *information
> for exclusive use of the addressee individual(s) or entity. Unauthorized
> viewing, copying, disclosure, distribution or use of this e-mail or
> attachments may be subject to legal restriction or sanction. If received in
> error, notify sender immediately by return e-mail and delete original
> message and attachments. Nothing contained in this e-mail or attachments
> shall satisfy the requirements for a writing unless specifically stated.
> Nothing contained herein shall constitute a contract or electronic
> signature under the Electronic Signatures in Global and National Commerce
> Act, any version of the Uniform Electronic Transactions Act or any other
> statute governing electronic transactions. Opinions and statements
> expressed in this e-mail and any attachments are those of the individual
> sender and not necessarily of DMB. DMB does not guarantee this e-mail
> transmission is secured, error or virus-free. Neither DMB nor the sender of
> this e-mail accepts liability for errors or omissions in the contents of
> this e-mail, which arise as a result of e-mail transmission. .
>


RE: WebApp Caching Broken

2018-03-06 Thread Kenneth Taylor

More troubleshooting revealed that our root context xml had been copied from 
another installation and had a wrong path in it.  However, I don't think this 
was the problem since it was only a path to a Log4J config.  We re-installed 
Tomcat from scratch and it seems to have resolved it, but this is not good.  
Why is Tomcat caching webapps?

Also determined that Tomcat was not shutting down properly.  Our installation 
is deployed as a Windows Service.  Stopping the service did not stop Tomcat.  
But the Service Console thinks it did stop, so when you restart it, another 
instance of Tomcat starts.  We are using a Java Service Wrapper if that makes 
any difference.

Also found another problem.  The "-XX:+DisableAttachMechanism" JVM option does 
not work with Tomcat.  This is a security flaw.

Thanks.
Ken


Disclaimer: This email from DMBGroup LLC, DMB Consulting Services LLC, or the 
personnel associated with either entity (collectively "DMB") and attachments, 
contain CONFIDENTIAL, PRIVILEGED AND PROPRIETARY information for exclusive use 
of the addressee individual(s) or entity. Unauthorized viewing, copying, 
disclosure, distribution or use of this e-mail or attachments may be subject to 
legal restriction or sanction. If received in error, notify sender immediately 
by return e-mail and delete original message and attachments. Nothing contained 
in this e-mail or attachments shall satisfy the requirements for a writing 
unless specifically stated. Nothing contained herein shall constitute a 
contract or electronic signature under the Electronic Signatures in Global and 
National Commerce Act, any version of the Uniform Electronic Transactions Act 
or any other statute governing electronic transactions. Opinions and statements 
expressed in this e-mail and any attachments are those of the individual sender 
and not necessarily of DMB. DMB does not guarantee this e-mail transmission is 
secured, error or virus-free. Neither DMB nor the sender of this e-mail accepts 
liability for errors or omissions in the contents of this e-mail, which arise 
as a result of e-mail transmission. .


RE: Catalina.out not updating

2018-03-06 Thread Akhilesh ET
Hi Thomas,

Thanks for the reply.

Yes we have checked that it is fine. Also the same server with the same 
configuration and permissions is working fine if we change the IP address. 

Thanks & Regards
Akhilesh.E.T
ITC Infotech India Ltd.,
ITC Infotech Park, #18 Banaswadi Main Road, Bangalore - 560005
Mob : +91-9591116360

-Original Message-
From: Thomas Rohde [mailto:t...@ordix.de] 
Sent: Tuesday, March 06, 2018 6:15 PM
To: 'Tomcat Users List' 
Subject: AW: Catalina.out not updating

** This mail has been sent from an external source ** Hi Akhilesh,

 
have you checked your file system permissions? Has the Tomcat runtime user the 
permissions to write into the log directory?

 
Regards,

Thomas

 
BTW: Tomcat 6 ist end of life since 31 December 2016 
(https://tomcat.apache.org/tomcat-60-eol.html). Please consider upgrading to 
Tomcat 9.

 
Von: Akhilesh ET [mailto:akhilesh...@itcinfotech.com]
Gesendet: Dienstag, 6. März 2018 13:31
An: users@tomcat.apache.org
Betreff: Catalina.out not updating

 
Hi All,

 
We are facing a situation wherein one of our production servers running tomcat 
6.0.18 is unable to generate logs after service startup. Logging just stops 
after service start up.

 

 
The setup is such a way that the control flows from a Apache Webserver to Jboss 
application server to Tomcat server. The tomcat server will connect to the 
external API URLs and logs should be generated for the same which is not 
working from past one week.

 
Just to give you an insight we are using source code based tomcat server and 
not rpm based. So the service startup is done using startup.sh script.

 
We tried swapping the IP of the server with the one that was working with no 
luck (The status was reversed with the server with same IP still not working). 
Which means there is something to do with the IP which is causing that issue 
(our assumption). 

 
Please let me know what else needs to checked in order to make this working. 
The application itself is working fine. However the issue is with only the log 
generation which is very critical for tracking the application.

 
Details of troubleshooting done so far : 

 
1.   Cleared the logs, restarted the service – No luck.

2.   Cleared the cache of the server and restarted the service – No luck.

3.   Rebooted the server multiple times – No Luck.

4.   Tried starting tomcat from different web root and upgrading java  – No 
Luck.

5.   Gave full permissions to tomcat folder and log files – No Luck

 
Thanks & Regards

Akhilesh.E.T

ITC Infotech India Ltd.,

ITC Infotech Park, #18 Banaswadi Main Road, Bangalore - 560005

 
 
Disclaimer: This communication is for the exclusive use of the intended 
recipient(s) and shall not attach any liability on the originator or ITC 
Infotech India Ltd./its Holding company/ its Subsidiaries/ its Group Companies. 
If you are the addressee, the contents of this e-mail are intended for your use 
only and it shall not be forwarded to any third party, without first obtaining 
written authorization from the originator or ITC Infotech India Ltd./ its 
Holding company/its Subsidiaries/ its Group Companies. It may contain 
information which is confidential and legally privileged and the same shall not 
be used or dealt with by any third party in any manner whatsoever without the 
specific consent of ITC Infotech India Ltd./ its Holding company/ its 
Subsidiaries/ its Group Companies.

 
Disclaimer: This  communication  is  for the exclusive use of the intended 
recipient(s) and  shall  not attach any liability on the originator or ITC 
Infotech India Ltd./its  Holding company/ its Subsidiaries/ its Group 
Companies. If you are the addressee, the contents of this e-mail are intended 
for your use only and it shall  not be forwarded to any third party, without 
first obtaining written authorization from the originator or ITC Infotech India 
Ltd./ its Holding company/its  Subsidiaries/ its Group Companies. It may 
contain information which is confidential and legally privileged and the same 
shall not be used or dealt with  by any  third  party  in  any manner 
whatsoever without the specific consent  of  ITC  Infotech India Ltd./ its 
Holding company/ its Subsidiaries/ its Group Companies.


AW: Catalina.out not updating

2018-03-06 Thread Thomas Rohde
Hi Akhilesh,

 
have you checked your file system permissions? Has the Tomcat runtime user the 
permissions to write into the log directory?

 
Regards,

Thomas

 
BTW: Tomcat 6 ist end of life since 31 December 2016 
(https://tomcat.apache.org/tomcat-60-eol.html). Please consider upgrading to 
Tomcat 9.

 
Von: Akhilesh ET [mailto:akhilesh...@itcinfotech.com] 
Gesendet: Dienstag, 6. März 2018 13:31
An: users@tomcat.apache.org
Betreff: Catalina.out not updating

 
Hi All,

 
We are facing a situation wherein one of our production servers running tomcat 
6.0.18 is unable to generate logs after service startup. Logging just stops 
after service start up.

 

 
The setup is such a way that the control flows from a Apache Webserver to Jboss 
application server to Tomcat server. The tomcat server will connect to the 
external API URLs and logs should be generated for the same which is not 
working from past one week.

 
Just to give you an insight we are using source code based tomcat server and 
not rpm based. So the service startup is done using startup.sh script.

 
We tried swapping the IP of the server with the one that was working with no 
luck (The status was reversed with the server with same IP still not working). 
Which means there is something to do with the IP which is causing that issue 
(our assumption). 

 
Please let me know what else needs to checked in order to make this working. 
The application itself is working fine. However the issue is with only the log 
generation which is very critical for tracking the application.

 
Details of troubleshooting done so far : 

 
1.   Cleared the logs, restarted the service – No luck.

2.   Cleared the cache of the server and restarted the service – No luck.

3.   Rebooted the server multiple times – No Luck.

4.   Tried starting tomcat from different web root and upgrading java  – No 
Luck.

5.   Gave full permissions to tomcat folder and log files – No Luck

 
Thanks & Regards

Akhilesh.E.T

ITC Infotech India Ltd.,

ITC Infotech Park, #18 Banaswadi Main Road, Bangalore - 560005

 
 
Disclaimer: This communication is for the exclusive use of the intended 
recipient(s) and shall not attach any liability on the originator or ITC 
Infotech India Ltd./its Holding company/ its Subsidiaries/ its Group Companies. 
If you are the addressee, the contents of this e-mail are intended for your use 
only and it shall not be forwarded to any third party, without first obtaining 
written authorization from the originator or ITC Infotech India Ltd./ its 
Holding company/its Subsidiaries/ its Group Companies. It may contain 
information which is confidential and legally privileged and the same shall not 
be used or dealt with by any third party in any manner whatsoever without the 
specific consent of ITC Infotech India Ltd./ its Holding company/ its 
Subsidiaries/ its Group Companies.

 


Catalina.out not updating

2018-03-06 Thread Akhilesh ET
Hi All,

We are facing a situation wherein one of our production servers running tomcat 
6.0.18 is unable to generate logs after service startup. Logging just stops 
after service start up.

[cid:image001.png@01D3B575.098BBBF0]

The setup is such a way that the control flows from a Apache Webserver to Jboss 
application server to Tomcat server. The tomcat server will connect to the 
external API URLs and logs should be generated for the same which is not 
working from past one week.

Just to give you an insight we are using source code based tomcat server and 
not rpm based. So the service startup is done using startup.sh script.

We tried swapping the IP of the server with the one that was working with no 
luck (The status was reversed with the server with same IP still not working). 
Which means there is something to do with the IP which is causing that issue 
(our assumption).

Please let me know what else needs to checked in order to make this working. 
The application itself is working fine. However the issue is with only the log 
generation which is very critical for tracking the application.

Details of troubleshooting done so far :


1.   Cleared the logs, restarted the service - No luck.

2.   Cleared the cache of the server and restarted the service - No luck.

3.   Rebooted the server multiple times - No Luck.

4.   Tried starting tomcat from different web root and upgrading java  - No 
Luck.

5.   Gave full permissions to tomcat folder and log files - No Luck

Thanks & Regards
Akhilesh.E.T
ITC Infotech India Ltd.,
ITC Infotech Park, #18 Banaswadi Main Road, Bangalore - 560005

Disclaimer: This  communication  is  for the exclusive use of the intended 
recipient(s) and  shall  not attach any liability on the originator or ITC 
Infotech India Ltd./its  Holding company/ its Subsidiaries/ its Group 
Companies. If you are the addressee, the contents of this e-mail are intended 
for your use only and it shall  not be forwarded to any third party, without 
first obtaining written authorization from the originator or ITC Infotech India 
Ltd./ its Holding company/its  Subsidiaries/ its Group Companies. It may 
contain information which is confidential and legally privileged and the same 
shall not be used or dealt with  by any  third  party  in  any manner 
whatsoever without the specific consent  of  ITC  Infotech India Ltd./ its 
Holding company/ its Subsidiaries/ its Group Companies.


Re: AW: Blocked Tomcat while (due to?) "concurrent class loading"?

2018-03-06 Thread Mark Thomas
On 06/03/18 09:19, Clemens Wyss DEV wrote:
>> you;d expect such threads to be started and stopped by a 
>> ServletContextListener
> I guess the ServletContextListener is being called/executed from/by another 
> thread than the startStop-thread (and hence has another classloader)?

It will be loaded by the web application class loader and executed in
that context.


> -Ursprüngliche Nachricht-
> Von: Clemens Wyss DEV  
> Gesendet: Dienstag, 6. März 2018 07:51
> An: 'Tomcat Users List' 
> Betreff: AW: Blocked Tomcat while (due to?) "concurrent class loading"?
> 
>> The full thread dump when the problem occurs would be helpful. Note that the 
>> thread dump should tell you if there is a deadlock. If there is no deadlock 
>> but you have a thread stuck at the point above that looks very much like a 
>> JVM bug.
> The stacktraces indicate no deadlock, nevertheless the JVM is "blocked". 
> Should I attach or copy a stacktrace?

That does look like a JVM bug. It might be helpful to post the full
thread dump (you should be able to attach .txt file) just so someone can
double check it but it sounds like you need to contact your JVM vendor.

Mark


> 
>> you;d expect such threads to be started and stopped by a 
>> ServletContextListener.
> Thx, we'll do this
> 
> -Ursprüngliche Nachricht-
> Von: Mark Thomas 
> Gesendet: Montag, 5. März 2018 14:28
> An: users@tomcat.apache.org
> Betreff: Re: Blocked Tomcat while (due to?) "concurrent class loading"?
> 
> On 03/03/18 16:56, Clemens Wyss DEV wrote:
>> From time to time we encouter tomcats which block while starting up. The 
>> stacktraces of the then "running" (but effectively blocked) threads (one of 
>> them being the init servlet starting thread) look alike:
>> ajp-nio-8059-exec-8
>> Stack Trace is:
>> java.lang.Thread.State: RUNNABLE
>> at java.lang.Class.forName0(Native Method) <-- STAYS HERE FOREVER at
>> java.lang.Class.forName(Class.java:264)
>> at
>> ch.mysign.cms.commons.ReflectUtil.getClassForClassName(ReflectUtil.jav
>> a:76) at
>> ch.mysign.cms.commons.TorqueUtil.getTableName(TorqueUtil.java:2756)
>> at
>> ch.mysign.cms.security.AccessTableConfig.setPeerClassName(AccessTableC
>> onfig.java:82) at
>> sun.reflect.GeneratedMethodAccessor605.invoke(Unknown Source) at 
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
>> orImpl.java:43)
>> ...
>>
>> i.e. there seems to be class loading ongoing. Unfortunately I cannot provide 
>> code that reproduces this (mis)behavior/bug. 
>> I can say though that the -XX:+AlwaysLockClassLoader JVM option "helps".
>>
>> Question 1:
>> what happens if the init servlet spawns a thread and by coincidence (timing 
>> issue?) at the "very same time" the init servlet thread and the spawned 
>> thread try to load a (possibly even the same?) class?
> 
> Can't happen. Locking in the class loader ensures that one thread will load 
> the class while the other thread waits. Then both will continue.
> 
>> Question 2:
>> is spawning a thread in the initservlet "allowed" at all?
> 
> It is allowed but it is 'odd'. Normally, you;d expect such threads to be 
> started and stopped by a ServletContextListener.
> 
>> Context/environment:
>> Debian Stretch
>> JDK 1.8.0_162
>> Tomcat 8.5.28
>>
>> To be noted: weh ad this "issue" with/in other environments too (even on 
>> Win10) ...
>>
>> Sorry for being so "fuzzy" but that's all we have to tell 
>>
>> We can live for the moment with the AlwaysLockClassLoader-flag, but 
>> nevertheless would like to know if this is a bug or if we are doing 
>> something wrong ...
> 
> Feels like a JVM issue. You can try using the non-parallel class loader:
> https://tomcat.apache.org/tomcat-8.5-doc/config/loader.html
> 
> The full thread dump when the problem occurs would be helpful. Note that the 
> thread dump should tell you if there is a deadlock. If there is no deadlock 
> but you have a thread stuck at the point above that looks very much like a 
> JVM bug.
> 
> Mark
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
> B CB  
> [  X  ܚX KK[XZ[
>  \ \  ][  X  ܚX P X ]
>  \X K ܙ B  ܈Y][ۘ[  [X[  K[XZ[
>  \ \  Z[ X ]
>  \X K ܙ B 
> 
> -
> 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



How to add application context to host

2018-03-06 Thread madhavi kota
We are migrating from 6.0.48 to 7.0.82 , after updating the libraries we
are hitting the below issue


java.lang.NullPointerException
at
org.apache.catalina.core.ApplicationContext.populateSessionTrackingModes(ApplicationContext.java:1263)
at
org.apache.catalina.core.ApplicationContext.(ApplicationContext.java:126)
at
org.apache.catalina.core.StandardContext.getServletContext(StandardContext.java:2483)
at
org.springframework.osgi.web.deployer.tomcat.TomcatWarDeployer2.createDeployment(TomcatWarDeployer2.java:137)
at
org.springframework.osgi.web.deployer.support.AbstractWarDeployer.deploy(AbstractWarDeployer.java:83)
at
org.springframework.osgi.web.extender.internal.activator.WarLoaderListener$DeploymentManager$DeployTask.doRun(WarLoaderListener.java:257)
at
org.springframework.osgi.web.extender.internal.activator.WarLoaderListener$DeploymentManager$BaseTask.run(WarLoaderListener.java:222)
at
org.springframework.scheduling.timer.DelegatingTimerTask.run(DelegatingTimerTask.java:66)
at java.util.TimerThread.mainLoop(Timer.java:567)
at java.util.TimerThread.run(Timer.java:517)
2018-03-06 10:09:40.379 SEVERE
[org.springframework.osgi.web.extender.internal.activator.WarLoaderListener$DeploymentManager$DeployTask]
War deployment of bundle null (com.approuter.nmc) failed
Throwable occurred:
org.springframework.osgi.web.deployer.OsgiWarDeploymentException: Cannot
create war deployment for bundle [null (com.approuter.nmc)] at [/] on
server org.apache.catalina.core.St
at
org.springframework.osgi.web.deployer.support.AbstractWarDeployer.deploy(AbstractWarDeployer.java:86)
at
org.springframework.osgi.web.extender.internal.activator.WarLoaderListener$DeploymentManager$DeployTask.doRun(WarLoaderListener.java:257)
at
org.springframework.osgi.web.extender.internal.activator.WarLoaderListener$DeploymentManager$BaseTask.run(WarLoaderListener.java:222)
at
org.springframework.scheduling.timer.DelegatingTimerTask.run(DelegatingTimerTask.java:66)
at java.util.TimerThread.mainLoop(Timer.java:567)
at java.util.TimerThread.run(Timer.java:517)
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
at
org.springframework.osgi.web.deployer.tomcat.TomcatWarDeployer2.createDeployment(TomcatWarDeployer2.java:156)
at
org.springframework.osgi.web.deployer.support.AbstractWarDeployer.deploy(AbstractWarDeployer.java:83)
... 5 more
Caused by: java.lang.NullPointerException
at
org.apache.catalina.core.ApplicationContext.populateSessionTrackingModes(ApplicationContext.java:1263)
at
org.apache.catalina.core.ApplicationContext.(ApplicationContext.java:126)
at
org.apache.catalina.core.StandardContext.getServletContext(StandardContext.java:2483)
at
org.springframework.osgi.web.deployer.tomcat.TomcatWarDeployer2.createDeployment(TomcatWarDeployer2.java:137)
... 6 more



We are using a custom tomcatwardeployer program (available
in spring-osgi-web-1.2.1-sources.jar.zip).

it looks like application context not getting added to the host. Please
help us in resolving the above issue.

Is there any configuration related changes for connecting application
context to the host.

Thank you
Madhavi


AW: Blocked Tomcat while (due to?) "concurrent class loading"?

2018-03-06 Thread Clemens Wyss DEV
>you;d expect such threads to be started and stopped by a ServletContextListener
I guess the ServletContextListener is being called/executed from/by another 
thread than the startStop-thread (and hence has another classloader)?

-Ursprüngliche Nachricht-
Von: Clemens Wyss DEV  
Gesendet: Dienstag, 6. März 2018 07:51
An: 'Tomcat Users List' 
Betreff: AW: Blocked Tomcat while (due to?) "concurrent class loading"?

>The full thread dump when the problem occurs would be helpful. Note that the 
>thread dump should tell you if there is a deadlock. If there is no deadlock 
>but you have a thread stuck at the point above that looks very much like a JVM 
>bug.
The stacktraces indicate no deadlock, nevertheless the JVM is "blocked". Should 
I attach or copy a stacktrace?

> you;d expect such threads to be started and stopped by a 
> ServletContextListener.
Thx, we'll do this

-Ursprüngliche Nachricht-
Von: Mark Thomas 
Gesendet: Montag, 5. März 2018 14:28
An: users@tomcat.apache.org
Betreff: Re: Blocked Tomcat while (due to?) "concurrent class loading"?

On 03/03/18 16:56, Clemens Wyss DEV wrote:
> From time to time we encouter tomcats which block while starting up. The 
> stacktraces of the then "running" (but effectively blocked) threads (one of 
> them being the init servlet starting thread) look alike:
> ajp-nio-8059-exec-8
> Stack Trace is:
> java.lang.Thread.State: RUNNABLE
> at java.lang.Class.forName0(Native Method) <-- STAYS HERE FOREVER at
> java.lang.Class.forName(Class.java:264)
> at
> ch.mysign.cms.commons.ReflectUtil.getClassForClassName(ReflectUtil.jav
> a:76) at
> ch.mysign.cms.commons.TorqueUtil.getTableName(TorqueUtil.java:2756)
> at
> ch.mysign.cms.security.AccessTableConfig.setPeerClassName(AccessTableC
> onfig.java:82) at
> sun.reflect.GeneratedMethodAccessor605.invoke(Unknown Source) at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
> orImpl.java:43)
> ...
> 
> i.e. there seems to be class loading ongoing. Unfortunately I cannot provide 
> code that reproduces this (mis)behavior/bug. 
> I can say though that the -XX:+AlwaysLockClassLoader JVM option "helps".
> 
> Question 1:
> what happens if the init servlet spawns a thread and by coincidence (timing 
> issue?) at the "very same time" the init servlet thread and the spawned 
> thread try to load a (possibly even the same?) class?

Can't happen. Locking in the class loader ensures that one thread will load the 
class while the other thread waits. Then both will continue.

> Question 2:
> is spawning a thread in the initservlet "allowed" at all?

It is allowed but it is 'odd'. Normally, you;d expect such threads to be 
started and stopped by a ServletContextListener.

> Context/environment:
> Debian Stretch
> JDK 1.8.0_162
> Tomcat 8.5.28
> 
> To be noted: weh ad this "issue" with/in other environments too (even on 
> Win10) ...
> 
> Sorry for being so "fuzzy" but that's all we have to tell 
> 
> We can live for the moment with the AlwaysLockClassLoader-flag, but 
> nevertheless would like to know if this is a bug or if we are doing something 
> wrong ...

Feels like a JVM issue. You can try using the non-parallel class loader:
https://tomcat.apache.org/tomcat-8.5-doc/config/loader.html

The full thread dump when the problem occurs would be helpful. Note that the 
thread dump should tell you if there is a deadlock. If there is no deadlock but 
you have a thread stuck at the point above that looks very much like a JVM bug.

Mark

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

B CB  [  
X  ܚX KK[XZ[
 \ \  ][  X  ܚX P X ]
 \X K ܙ B  ܈Y][ۘ[  [X[  K[XZ[
 \ \  Z[ X ]
 \X K ܙ B 

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