Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redeployment of Web Application with Melody Filter in WebLogic Server 10 doesn't work #96

Closed
GoogleCodeExporter opened this issue Jun 21, 2015 · 17 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Deploy Webapp with filter on WLS, /<context>/monitoring works
2. Stop/Start or Update Webapp via WLS Admin Console
3. /<context>/monitoring doesn't work not, Exception in Log:


<Mar 4, 2011 11:02:13 AM CET> <Error> <HTTP> <BEA-101165> <Could not load user 
defined filter in web.xml: net.bull.javamelody.MonitoringFilter.
java.lang.IllegalStateException: Timer already cancelled.
    at java.util.Timer.sched(Timer.java:354)
    at java.util.Timer.schedule(Timer.java:170)
    at net.bull.javamelody.JRobin.setJRobinThreadName(JRobin.java:95)
    at net.bull.javamelody.FilterContext.initCollect(FilterContext.java:207)
    at net.bull.javamelody.FilterContext.<init>(FilterContext.java:94)
    Truncated. see log file for complete stacktrace



What is the expected output? What do you see instead?

"/<context>/monitoring" doesn't work after Web-app redeployment.


What version of the product are you using? On what application server, JDK,
operating system?

JDK 1.6.0_21, WLS 10.3.3, Sun Solaris


Please provide any additional information below.



Problem seems to be the usage of a static Timer in JRobin:

From 
http://code.google.com/p/javamelody/source/browse/tags/javamelody-core-1.26.0/sr
c/main/java/net/bull/javamelody/JRobin.java 

RrdNioBackend.class.getDeclaredField("fileSyncTimer");


Timer is stopped through Web-Application deactivation and cannot be restartet 
with updated and (re)activated Web-Application.

IOException is catched, but IllegalStateException is thrown -> Filter is not 
installed.

 try {
                        JRobin.setJRobinThreadName("jrobin "
                                        + Parameters.getContextPath(Parameters.getServletContext()).replace('/', ' '));
                } catch (final IOException e) {
                        LOG.warn(e.toString(), e);
                }

<Error> <HTTP> <BEA-101165> <Could not load user defined filter in web.xml: 
net.bull.javamelody.MonitoringFilter.
java.lang.IllegalStateException: Timer already cancelled.



I don't know what the spec says to reactivating a Web-application, about 
undeploying and deploying, but i think there should be a more interoperable 
solution. May be you could fix JRobin and provide a temporary special version 
for JavaMelody?!

Original issue reported on code.google.com by andrePan...@gmail.com on 4 Mar 2011 at 1:27

@GoogleCodeExporter
Copy link
Author

Reproduced with WebLogic Server as said above.
It seems that the classes (and the static final timer in jrobin) are not 
unloaded by WebLogic when stop is called for the application.

Original comment by evernat@free.fr on 27 Mar 2011 at 10:56

@GoogleCodeExporter
Copy link
Author

I get the same from a Jetty setup

Original comment by toby.wes...@gmail.com on 22 Jun 2011 at 1:39

@GoogleCodeExporter
Copy link
Author

Hi Toby,
Can you say what is your test scenario to reproduce this issue in Jetty?
Thank you

Original comment by evernat@free.fr on 25 Jun 2011 at 11:10

@GoogleCodeExporter
Copy link
Author

Same issue on eclipse / tomcat.

I modify java code on eclipse... tomcat is automatically restarted... and i got 
exactly the same error.

Original comment by ity.man...@gmail.com on 23 Aug 2011 at 2:04

@GoogleCodeExporter
Copy link
Author

Let me provide a workaround it worked for me:

I removed the javamelody library from tomcat installation, and i put them under 
/WEB-INF/lib of the web app. No problem after that.

Original comment by ity.man...@gmail.com on 23 Aug 2011 at 2:29

@GoogleCodeExporter
Copy link
Author

This workaround doesn't work though for WLS...Tomcat unloads classes in 
WEB-INF/lib.

I would say this static timer stuff isn't the best architecture part in JRobin?

Original comment by andrePan...@gmail.com on 23 Aug 2011 at 2:34

@GoogleCodeExporter
Copy link
Author

So there is a fact, putting the javamelody and the jrobin jar files in the lib 
directory of tomcat is currently not compatible with hot redeployment of the 
webapp, for example in development. If compatibility with hot redeployment is 
needed, the javamelody and the jrobin jar files must currently be put in the 
/WEB-INF/lib as the other dependencies of the webapp and as said in the user 
guide [1].
I should add in the "other" deployment mode that hot redeployment is not 
supported [2].
But perhaps we can detect where jrobin is deployed and if its timer should be 
cancelled by javamelody [3] when the webapp is undeployed or we could work on a 
patch for jrobin (its static final Timer is not a good idea for a webapp).
The good news is that the JRobin code is living again now.

[1] http://code.google.com/p/javamelody/wiki/UserGuide#1._Jar_files
[2] 
http://code.google.com/p/javamelody/wiki/UserGuideAdvanced#Deployment_on_Tomcat_
without_modification_of_monitored_webapps_%28
[3] 
http://code.google.com/p/javamelody/source/browse/tags/javamelody-core-1.31.0/sr
c/main/java/net/bull/javamelody/JRobin.java#83

Original comment by evernat@free.fr on 23 Aug 2011 at 11:16

@GoogleCodeExporter
Copy link
Author

I have made a post in the jrobin development list about the static Timer 
problem in jrobin in order to fix redeployments.
The post is at:
http://sourceforge.net/mailarchive/message.php?msg_id=28038427

I suggest to show your interest about this problem in the jrobin forum.

Original comment by evernat@free.fr on 17 Sep 2011 at 4:21

@GoogleCodeExporter
Copy link
Author

Just tagging this issue as accepted.
And there is no response yet from anybody in the JRobin forum.

Original comment by evernat@free.fr on 14 Dec 2011 at 11:00

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

I was having the same issue, except with Tomcat.

Updating from jrobin-1.5.9.1.jar to jrobin-1.5.14.jar solved it for me.

The problem here, I think, is that the jrobin jar provided with JavaMelody is 
outdated.

Original comment by bmckin...@gmail.com on 22 Nov 2012 at 12:17

@GoogleCodeExporter
Copy link
Author

There was no response from the jrobin forum at sourceforge.net
I have now created a jrobin issue in opennms JIRA, including a simple patch, 
for the static final Timer in RrdNioBackend:
http://issues.opennms.org/browse/JRB-26

You can log in JIRA and vote for this jrobin issue.
I hope that one of the jrobin developer(s) includes the patch and makes a 
release of jrobin at some time.


@bmckinlay Tomcat is not supposed to have this issue thanks to some javamelody 
tricks, except if you put the jrobin jar file in the lib directory of Tomcat 
(as said in a comment above), and not in WEB-INF/lib of the webapp.
And jrobin-1.5.14 jar is not supposed to fix this issue, because the "static 
final Timer" is still there. So I think that your issue was different.

Original comment by evernat@free.fr on 22 Dec 2012 at 5:59

@GoogleCodeExporter
Copy link
Author

Thanks @evernat, you are correct - the issue has returned for me despite me 
using robin-1.5.14, and it does appear that 1.5.14 still has the static Timer 
problem. It must have been chance or my mistake that I thought it was fixed 
before.

However, the bug certainly does happen for me with Tomcat 7.0.25, even though 
jrobin is in my tomcat/lib directory.

Redeploying the root webapp in particular causes javamelody to stop working 
with the Timer IllegalStateException above.

Original comment by bmckin...@gmail.com on 23 Dec 2012 at 11:59

@GoogleCodeExporter
Copy link
Author

Issue 168 has been merged into this issue.

Original comment by evernat@free.fr on 26 Dec 2012 at 1:50

@GoogleCodeExporter
Copy link
Author

May it be worth to fork the jrobin code (thanks to git that should be easy)?
Also due to the fact, that there seems little (to no) development happening on 
the repository, the effort of upcomming merges seems to be... tollerable.

As weblogic is our main platform, this makes using javamelody quite hard to use.

Original comment by derj...@googlemail.com on 29 Jan 2013 at 8:31

@GoogleCodeExporter
Copy link
Author

Indeed, it was quite easy:
https://github.com/derjust/jrobin-code

This build will also work on JDK7. But there are two failing testcases for 
whatever reason.

Can this now be usued to make javamelody redeployable?

Original comment by derj...@googlemail.com on 29 Jan 2013 at 9:11

@GoogleCodeExporter
Copy link
Author

@derjust
Indeed, but your fork is certainly not published in Maven central.

Original comment by evernat@free.fr on 13 Jul 2013 at 10:55

@GoogleCodeExporter
Copy link
Author

I have now removed the static final Timer from org.jrobin.core.RrdNioBackend by 
writing a new RrdNioBackend in javamelody and registering a new 
RrdNioBackendFactory in jrobin.

It is committed in trunk (revision 3430) and ready for the next release (1.46).
I have made a new build and it is available at:
https://javamelody.googlecode.com/files/javamelody-20130714.jar

This should fix the redeployment in WebLogic.
This is also a fix for the redeployment in Tomcat, when the javamelody and 
jrobin jar files are put in the tomcat/lib directory (and not in the 
WEB-INF/lib directory of the webapp as recommended in the user guide).

Original comment by evernat@free.fr on 13 Jul 2013 at 11:03

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant