Just investigated further:
The NPE only occurs if the org.apache.cxf.interceptor.LoggingInInterceptor
is used.
I did override the class to get a clue what functionality in this class has
a side-effect
on the FileUtils.removeDir() function called during shutdown of the JVM.
The line 131 in LoggingInterceptor.java calls:
IOUtils.copy(is, bos);
If I remove this line the error described below is fixed?
I have no idea why the IOUtils.copy ... has any side-effect with
the FileUtils.removeDir on shutdown.
Any expert out there? Any ideas? Do other people use the
LoggingInInterceptor?
moslm wrote:
>
> I'm using CXF 2.2.5, running on Java 1.6 and Tomcat 6.18.
>
> When the Tomcat server is stopped, we get always the following
> NullPointerException:
>
> INFO: Stopping Coyote HTTP/1.1 on http-8080
> Exception in thread "Thread-14" java.lang.NullPointerException
> at org.apache.cxf.helpers.FileUtils.removeDir(FileUtils.java:126)
> at org.apache.cxf.helpers.FileUtils$1.run(FileUtils.java:75)
>
>
> I did a little debugging:
>
> During the first usage of CXF the FileUtils.getDefaultTempDir() is called.
> It resolves the tmp-dir correctly. At the end the
> "private static File defaultTempDir" is set to the right directory.
> Then the method schedules the removal of the tmp-dir like this:
> Thread hook = new Thread() {
> @Override
> public void run() {
> removeDir(defaultTempDir);
> }
> };
> Runtime.getRuntime().addShutdownHook(hook);
>
>
> So far, so good. When stopping Tomcat (== stopping the JVM) the hook is
> "fired".
> The removeDir(defaultTempDir) is called. But "defaultTempDir" is 'null'
> and in consequence
> the NPE is thrown.
>
> Any idea why the static defaultTempDir is lost when the ShutdownHooks are
> fired? A Bug?
>
> Thanks
> Mos
>
>
>
--
View this message in context:
http://old.nabble.com/NPE-in-FileUtils.removeDir%28FileUtils.java%3A126%29-on-shutdown-tp28266687p28267761.html
Sent from the cxf-user mailing list archive at Nabble.com.