Login  Register

Re: Re: Re: Re: Orbeon 3.9 NullPointerException with websphere 6.1

Posted by Erik Bruchez on May 13, 2011; 4:11am
URL: https://discuss.orbeon.com/Orbeon-3-9-NullPointerException-with-websphere-6-1-tp3445071p3519302.html

Olivier,

Thanks a lot! I have committed the changes:

https://github.com/orbeon/orbeon-forms/commit/9f262e4bba9c15a3eb01b60bcb92f8ccaa587aba

I did some minor adjustments to the Scala code, nothing major at all.

You don't need in general to place names within backticks in Scala:
here only `def` was needed because that would otherwise conflict with
Scala's "def" keyword.

I also nested the functions, although that's clearly not needed.

-Erik

On Thu, May 12, 2011 at 3:03 AM, Olivier Thery <[hidden email]> wrote:

> Erik,
>
> You were right, the exception is swallowed by the pool, as explain in the
> http://commons.apache.org/pool/apidocs/index.html?org/apache/commons/pool//class-usePoolableObjectFactory.html
> javadoc
> I added some trace around defalter.reset() in passivateObject, and you can
> see below the differences between execution on SUN JVM and IBM JVM (see logs
> before change below).
>
> I have investigated a bit more, and I have found posts which explain the
> problem as an implementation difference between sun and ibm's
> GZIPOutputStream classes :
>  - with SUN implementation, DeflaterOutputStream.close called end() on the
> Deflater. So it appears that you had to make a new Deflater everytime we
> wanted to use one with DeflaterOutputStream. A fix has been delivered for
> this bug (see  http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4499542
> Bug ID:  4499542 )
>  - with IBM implementation, GZIPOutputStream class (looks like for
> performance reasons) calls the deflater's end method as part of
> GZIPOutputStream.finish(), so deflater's reset can't be called after (see
> http://www.velocityreviews.com/forums/t123932-deflater-and-ibm-jre.html this
> post )
>
> Solution
> Moving the call of deflater's reset in passivateObject was not a good
> solution.
> Now, I think the best way is to be independent of this implementation
> difference between sun and ibm's GZIPOutputStream classes. So, as you have
> made for the deflater's method close, I have added a method finish to
> override the original deflater's method finish. This new method finish is
> the translation in Scala of the original sun's implementation (see
> http://www.java2s.com/Open-Source/Java-Document/6.0-JDK-Core/Collections-Jar-Zip-Logging-regex/java/util/zip/GZIPOutputStream.java.htm
> SUN java source code ). I am a newbie in Scala, so my code needs your
> validation !
>
> Here is my new versions of XFormsCompressor.scala and XFormsCompressor.jar
> http://orbeon-forms-ops-users.24843.n4.nabble.com/file/n3516921/XFormsCompressor.scala
> XFormsCompressor.scala
> http://orbeon-forms-ops-users.24843.n4.nabble.com/file/n3516921/XFormsCompressor.jar
> XFormsCompressor.jar
> I have tested them with Apache\Tomcat\Sun JVM and Websphere\IBM JVM : the
> deflater is now created just once and is reused (see logs after change
> below)
>
> Logs before change
> 1) With IBM JVM : a new Deflater is created each time we need it
> 2011-05-11 11:32:15,643 DEBUG XFormsServer  - compressor - creating new
> Deflater
> 2011-05-11 11:32:15,659 DEBUG XFormsServer  - compressor - in compressBytes
> Deflater finished : true
> 2011-05-11 11:32:15,659 DEBUG XFormsServer  - compressor - in compressBytes
> Number of instances idle before returnObject : 0
> 2011-05-11 11:32:15,659 DEBUG XFormsServer  - compressor - in compressBytes
> Number of instances active before returnObject : 1
> 2011-05-11 11:32:15,660 DEBUG XFormsServer  - compressor - in
> passivateObject Number of instances idle before reset : 0
> 2011-05-11 11:32:15,660 DEBUG XFormsServer  - compressor - in
> passivateObject Number of instances active before reset : 1
> 2011-05-11 11:32:15,660 DEBUG XFormsServer  - compressor - in compressBytes
> Number of instances idle after returnObject : 0
> 2011-05-11 11:32:15,660 DEBUG XFormsServer  - compressor - in compressBytes
> Number of instances active after returnObject : 0
> 2011-05-11 11:32:16,233 DEBUG XFormsServer  - compressor - creating new
> Deflater
> 2011-05-11 11:32:16,242 DEBUG XFormsServer  - compressor - in compressBytes
> Deflater finished : true
> 2011-05-11 11:32:16,242 DEBUG XFormsServer  - compressor - in compressBytes
> Number of instances idle before returnObject : 0
> 2011-05-11 11:32:16,242 DEBUG XFormsServer  - compressor - in compressBytes
> Number of instances active before returnObject : 1
> 2011-05-11 11:32:16,242 DEBUG XFormsServer  - compressor - in
> passivateObject Number of instances idle before reset : 0
> 2011-05-11 11:32:16,242 DEBUG XFormsServer  - compressor - in
> passivateObject Number of instances active before reset : 1
> 2011-05-11 11:32:16,242 DEBUG XFormsServer  - compressor - in compressBytes
> Number of instances idle after returnObject : 0
> 2011-05-11 11:32:16,242 DEBUG XFormsServer  - compressor - in compressBytes
> Number of instances active after returnObject : 0
>
> 2) With SUN JVM : it works fine : Deflater is created just once then reused
> 2011-05-11 11:43:47,984 DEBUG XFormsServer  - compressor - creating new
> Deflater
> 2011-05-11 11:43:48,000 DEBUG XFormsServer  - compressor - in compressBytes
> Deflater finished : true
> 2011-05-11 11:43:48,000 DEBUG XFormsServer  - compressor - in compressBytes
> Number of instances idle before returnObject : 0
> 2011-05-11 11:43:48,000 DEBUG XFormsServer  - compressor - in compressBytes
> Number of instances active before returnObject : 1
> 2011-05-11 11:43:48,000 DEBUG XFormsServer  - compressor - in
> passivateObject Number of instances idle before reset : 0
> 2011-05-11 11:43:48,000 DEBUG XFormsServer  - compressor - in
> passivateObject Number of instances active before reset : 1
> 2011-05-11 11:43:48,000 DEBUG XFormsServer  - compressor - in
> passivateObject Number of instances idle after reset : 0
> 2011-05-11 11:43:48,000 DEBUG XFormsServer  - compressor - in
> passivateObject Number of instances active after reset : 1
> 2011-05-11 11:43:48,000 DEBUG XFormsServer  - compressor - in compressBytes
> Number of instances idle after returnObject : 1
> 2011-05-11 11:43:48,000 DEBUG XFormsServer  - compressor - in compressBytes
> Number of instances active after returnObject : 0
> 2011-05-11 11:43:48,046 DEBUG XFormsServer  - compressor - in compressBytes
> Deflater finished : true
> 2011-05-11 11:43:48,046 DEBUG XFormsServer  - compressor - in compressBytes
> Number of instances idle before returnObject : 0
> 2011-05-11 11:43:48,046 DEBUG XFormsServer  - compressor - in compressBytes
> Number of instances active before returnObject : 1
> 2011-05-11 11:43:48,046 DEBUG XFormsServer  - compressor - in
> passivateObject Number of instances idle before reset : 0
> 2011-05-11 11:43:48,046 DEBUG XFormsServer  - compressor - in
> passivateObject Number of instances active before reset : 1
> 2011-05-11 11:43:48,046 DEBUG XFormsServer  - compressor - in
> passivateObject Number of instances idle after reset : 0
> 2011-05-11 11:43:48,046 DEBUG XFormsServer  - compressor - in
> passivateObject Number of instances active after reset : 1
> 2011-05-11 11:43:48,046 DEBUG XFormsServer  - compressor - in compressBytes
> Number of instances idle after returnObject : 1
> 2011-05-11 11:43:48,046 DEBUG XFormsServer  - compressor - in compressBytes
> Number of instances active after returnObject : 0
>
> Logs after change
> 1) With IBM JVM and SUN JVM : it works fine : Deflater is created just once
> then reused
> 2011-05-12 10:09:10,468 DEBUG XFormsServer  - compressor - creating new
> Deflater
> 2011-05-12 10:09:10,484 DEBUG XFormsServer  - compressor - in compressBytes
> Deflater finished : true
> 2011-05-12 10:09:10,484 DEBUG XFormsServer  - compressor - in compressBytes
> Number of instances idle before reset and returnObject : 0
> 2011-05-12 10:09:10,484 DEBUG XFormsServer  - compressor - in compressBytes
> Number of instances active before reset and returnObject : 1
> 2011-05-12 10:09:10,484 DEBUG XFormsServer  - compressor - in
> passivateObject Number of instances idle after reset and before returnObject
> : 0
> 2011-05-12 10:09:10,484 DEBUG XFormsServer  - compressor - in
> passivateObject Number of instances active after reset and before
> returnObject : 1
> 2011-05-12 10:09:10,484 DEBUG XFormsServer  - compressor - in compressBytes
> Number of instances idle after returnObject : 1
> 2011-05-12 10:09:10,484 DEBUG XFormsServer  - compressor - in compressBytes
> Number of instances active after returnObject : 0
> 2011-05-12 10:09:10,531 DEBUG XFormsServer  - compressor - in compressBytes
> Deflater finished : true
> 2011-05-12 10:09:10,531 DEBUG XFormsServer  - compressor - in compressBytes
> Number of instances idle before reset and returnObject : 0
> 2011-05-12 10:09:10,531 DEBUG XFormsServer  - compressor - in compressBytes
> Number of instances active before reset and returnObject : 1
> 2011-05-12 10:09:10,531 DEBUG XFormsServer  - compressor - in
> passivateObject Number of instances idle after reset and before returnObject
> : 0
> 2011-05-12 10:09:10,531 DEBUG XFormsServer  - compressor - in
> passivateObject Number of instances active after reset and before
> returnObject : 1
> 2011-05-12 10:09:10,531 DEBUG XFormsServer  - compressor - in compressBytes
> Number of instances idle after returnObject : 1
> 2011-05-12 10:09:10,531 DEBUG XFormsServer  - compressor - in compressBytes
> Number of instances active after returnObject : 0
>
> I hope this change can solve the problem and that you can integrate it soon
> in a nightly build.
>
> Thanks
>
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Orbeon-3-9-NullPointerException-with-websphere-6-1-tp3445071p3516921.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws