Jeff Black

Greenhorn
+ Follow
since Aug 02, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Jeff Black

This may be JBoss specific (JB v4.2.1.GA) as the container can implement ServletContextListener as it chooses based on my understanding.

I have two war files each with their own ServletContextListener implementation and each implementing contextInitialized() and contextDestroyed(). I start the container with FIRST.war deployed and see contextInitialized() is notified. I then hotdeploy SECOND.war and his listeners contextInitialized() is notified. However, based on the SECOND.war being deployed to the container, the FIRST.war listener fires its contextDestroyed() and then its contextInitialized() methods.

This seems like strange behavior that the war deploy actions bleed across to unrelated wars. Is my understanding of these methods flawed?

11 years ago
I am fairly confident we are shutting down derby properly based on the derby website instructions. We have several other wars that do the same thing, so now problems there using the same shutdown steps.

Others in our office have tried this under linux and no problems there, so it is a windows specific issue/symptom.

Also, I wanted to report that the problem has disappeared after an upgrade from tomcat 6.0.16 to 6.0.18. We can now undeploy cleanly. This may or may not be the real solution to our problem as maybe this new version is more forceful about terminating webapp threads, but, I would think as the app developers, we should make sure we understand what our threads are doing and should explicitly make sure they are terminate cleanly.

However, I am still very curious about the original question of, how does one track down a misbehaving thread, whether it be a webapp or otherwise.
Sorry, meant to post this to "Threads and Synchronization". Should I re-post there or can someone move it?
We have a simple webapp that runs in Windows, Tomcat 6.x and uses embedded derby. Undeploy does not complete cleanly leaving behind a WEB-INF/lib/derby.jar file that windows says is still in use by another process.

We are having a hard time tracking down which thread is causing this problem. We don't explicitly start any threads, so not sure where the "daemon" property would be set to properly terminate all threads. We have tried watching JMX console when the undeploy happens, but nothing in the thread list looks suspect.

So the question is, what is the best way to track down a thread that is not being a good citizen? If we knew which thread it was, we could properly manage it, but we're at a loss to even identify it.

The only clue besides the leftover derby jar file is that after the undeploy, we CTRL-C the tomcat console and get this stack trace:

INFO: Undeploying context [/psps]
java.util.logging.ErrorManager: 1
java.lang.NullPointerException
at org.apache.juli.FileHandler.publish(FileHandler.java:137)
at java.util.logging.Logger.log(Logger.java:452)
at java.util.logging.Logger.doLog(Logger.java:474)
at java.util.logging.Logger.logp(Logger.java:590)
at org.apache.juli.logging.DirectJDKLog.log(DirectJDKLog.java:165)
at org.apache.juli.logging.DirectJDKLog.info(DirectJDKLog.java:115)
at org.apache.coyote.http11.Http11Protocol.pause(Http11Protocol.java:220)
at org.apache.catalina.connector.Connector.pause(Connector.java:1073)
at org.apache.catalina.core.StandardService.stop(StandardService.java:563)
at org.apache.catalina.core.StandardServer.stop(StandardServer.java:744)
at org.apache.catalina.startup.Catalina.stop(Catalina.java:628)
at org.apache.catalina.startup.Catalina$CatalinaShutdownHook.run(Catalina.java:671)
Thanks for the quick reply. I think we'll have to work with option 2. The loggers are all created directly:

private static final Logger LOG = Logger.getLogger("com.company.BuildTimeTrend");

so if we can configure the logging framework via code to capture the messages in memory, that would work out fairly well.
16 years ago
How do I assert that my code under test has executed a code path with logger output? I'm guessing that you could do this via a listener, but I'm not having any luck finding the "recipe" to do this.

I'm using junit and java.util.logging.Logger.

code under test:
if (...) {
...
} else {
LOG.severe("condition was false");
}

test pseudocode:

// assertLOG count = 1
// assertLOG level = severe
// assertLOG message contains("condition was false")
16 years ago
I have a simple Frame with some text that displays fine upon launching. However, after iconifing and the restoring, the frame is blank. By resizing the frame, the text is restored. This behavior is under Solaris 8 only, the same application under XP works fine. What am I missing?
Jeff
20 years ago
Yes, thank you. I went with a custom TableCellRenderer that extended JTextArea. Works great.
20 years ago
I'm displying a few rows from a database to a Frame, but need the columns to maintain their "formatting" directly below the previous column.
JTable works, except I would like it to line wrap on the one field that could be two or three lines long. This display is read-only, non-editable.
Any other better solutions?
20 years ago
JavaScript is clientside and JavaBeans are stored serverside. So they can't interact without a roundtrip to the server.
If you need the bean data via an onClick, store it to <input type="hidden" ...> fields.
21 years ago
JSP
Something to try:
Instead of generating the image and writing it to the file system:
<img src='output.jpg'>
have it generated by a servlet whose response type is image/gif. So in your jsp, do this:
<img src="ImageServlet">
Then setting the cache controls for this response may solve your problem.
21 years ago
JSP
Are there any existing java API's that can generat the corresponding html to an image tag using a usemap? Then take the <map ...> html String, append it to an *html file and redirect servlet to the html file.
Unfortunately, applets are not a option...
Given: <img usemap="map1" ...> and a Graphics object with irregularly sized buttons and text.
Generate:
21 years ago
No such method session.getServletContext() for servlet 2.2 API. I've already scanned the javax.servlet... API and there is no direct route to get the servletContext. Surely there must be another way?
22 years ago
From a bean that I only pass HttpServletRequest into, how can I obtain a reference to it's corresponding ServletContext?
I want the bean to be able to get at the ServletContext.getInitialParameter() method.

Jeff
22 years ago