[ 
https://issues.apache.org/jira/browse/MIME4J-310?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kevin C. Dorff updated MIME4J-310:
----------------------------------
    Description: 
We've been using apache-mime4j-*0.8.4.jar with our JDK8* application for some 
time without issue.

While attempting to upgrade to apache-mime4j version 0.8.6 (and have verified 
the issue exists with 0.8.5) our application now fails quite a few tests that 
appear to be related to how the apache-mime4j jars are created. 

The following groovy script can be run run from *groovyconsole* to quickly 
demonstrate the issue if you are using JDK8 (I am running Zulu OpenJDK 
1.8.0_192), tested with groovy 2.5.9, but the critical piece is JDK8

Under JDK8, I can successfully run

 
{noformat}
@Grab(group='org.apache.james', module='apache-mime4j-core', version='0.8.4')
@Grab(group='org.apache.james', module='apache-mime4j-dom', version='0.8.4')
import org.apache.james.mime4j.field.address.DefaultAddressParser
def address = DefaultAddressParser.DEFAULT.parseAddress( "em...@addresss.com" 
); 
{noformat}
but if I change the *@Grab*'s to either version 0.8.5 or 0.8.6 *(NOTE* you will 
need to restart groovyconsole if you change a *@Grab* version) I instead get

 
{noformat}
Exception thrown
java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer;
 at org.apache.james.mime4j.io.TextInputStream.<init>(TextInputStream.java:49)
 at org.apache.james.mime4j.io.InputStreams.create(InputStreams.java:77)
 at 
org.apache.james.mime4j.field.address.DefaultAddressParser.parseAddress(DefaultAddressParser.java:51)
 at 
org.apache.james.mime4j.field.address.DefaultAddressParser.parseAddress(DefaultAddressParser.java:56)
 at 
org.apache.james.mime4j.field.address.AddressParser$parseAddress.call(Unknown 
Source)
 at ConsoleScript0.run(ConsoleScript0:6)
{noformat}
If I change my JDK to Zulu OpenJDK 11.0.13, the script works fine under all of 
0.8.4, 0.8.5, and 0.8.6.

After doing a bit of searching [I found this 
discussion|https://stackoverflow.com/questions/61267495/exception-in-thread-main-java-lang-nosuchmethoderror-java-nio-bytebuffer-flip]
 which seems to be related.

The top answer seems to describe the problem and possible solutions. I believe 
the change would need to be implemented within apache-mime4j to remain 
JDK8-compatible. This is likely also an issue with JDK9 and JDK10.

  was:
We've been using apache-mime4j-*-0.8.4.jar with our *JDK8* application for some 
time without issue.

While attempting to upgrade to apache-mime4j version 0.8.6 (and have verified 
the issue exists with 0.8.5) our application now fails quite a few tests that 
appear to be related to how the apache-mime4j jars are created. 

The following groovy script can be run run from *groovyconsole* to quickly 
demonstrate the issue if you are using JDK8 (I am running Zulu OpenJDK 
1.8.0_192), tested with groovy 2.5.9, but the critical piece is JDK8

Under JDK8, I can successfully run

 
{noformat}
@Grab(group='org.apache.james', module='apache-mime4j-core', version='0.8.4')
@Grab(group='org.apache.james', module='apache-mime4j-dom', version='0.8.4')
import org.apache.james.mime4j.field.address.DefaultAddressParser
def address = DefaultAddressParser.DEFAULT.parseAddress( "em...@addresss.com" 
); 
{noformat}

but if I change the *@Grab*'s to either version 0.8.5 or 0.8.6 *(NOTE* you will 
need to restart groovyconsole if you change a *@Grab* version) I instead get



 
{noformat}
Exception thrown
java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer;
 at org.apache.james.mime4j.io.TextInputStream.<init>(TextInputStream.java:49)
 at org.apache.james.mime4j.io.InputStreams.create(InputStreams.java:77)
 at 
org.apache.james.mime4j.field.address.DefaultAddressParser.parseAddress(DefaultAddressParser.java:51)
 at 
org.apache.james.mime4j.field.address.DefaultAddressParser.parseAddress(DefaultAddressParser.java:56)
 at 
org.apache.james.mime4j.field.address.AddressParser$parseAddress.call(Unknown 
Source)
 at ConsoleScript0.run(ConsoleScript0:6)
{noformat}

If I change my JDK to Zulu OpenJDK 11.0.13, the script works fine under all of 
0.8.4, 0.8.5, and 0.8.6.

After doing a bit of searching [I found this 
discussion|https://stackoverflow.com/questions/61267495/exception-in-thread-main-java-lang-nosuchmethoderror-java-nio-bytebuffer-flip]
 which seems to be related.

The top answer seems to describe the problem and possible solutions. I believe 
the change would need to be implemented within apache-mime4j to remain 
JDK8-compatible. This is likely also an issue with JDK9 and JDK10.


> TextInputStream NoSuchMethodError under JDK8 starting with 0.8.5
> ----------------------------------------------------------------
>
>                 Key: MIME4J-310
>                 URL: https://issues.apache.org/jira/browse/MIME4J-310
>             Project: James Mime4j
>          Issue Type: Bug
>    Affects Versions: 0.8.5, 0.8.6
>            Reporter: Kevin C. Dorff
>            Priority: Blocker
>
> We've been using apache-mime4j-*0.8.4.jar with our JDK8* application for some 
> time without issue.
> While attempting to upgrade to apache-mime4j version 0.8.6 (and have verified 
> the issue exists with 0.8.5) our application now fails quite a few tests that 
> appear to be related to how the apache-mime4j jars are created. 
> The following groovy script can be run run from *groovyconsole* to quickly 
> demonstrate the issue if you are using JDK8 (I am running Zulu OpenJDK 
> 1.8.0_192), tested with groovy 2.5.9, but the critical piece is JDK8
> Under JDK8, I can successfully run
>  
> {noformat}
> @Grab(group='org.apache.james', module='apache-mime4j-core', version='0.8.4')
> @Grab(group='org.apache.james', module='apache-mime4j-dom', version='0.8.4')
> import org.apache.james.mime4j.field.address.DefaultAddressParser
> def address = DefaultAddressParser.DEFAULT.parseAddress( "em...@addresss.com" 
> ); 
> {noformat}
> but if I change the *@Grab*'s to either version 0.8.5 or 0.8.6 *(NOTE* you 
> will need to restart groovyconsole if you change a *@Grab* version) I instead 
> get
>  
> {noformat}
> Exception thrown
> java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer;
>  at org.apache.james.mime4j.io.TextInputStream.<init>(TextInputStream.java:49)
>  at org.apache.james.mime4j.io.InputStreams.create(InputStreams.java:77)
>  at 
> org.apache.james.mime4j.field.address.DefaultAddressParser.parseAddress(DefaultAddressParser.java:51)
>  at 
> org.apache.james.mime4j.field.address.DefaultAddressParser.parseAddress(DefaultAddressParser.java:56)
>  at 
> org.apache.james.mime4j.field.address.AddressParser$parseAddress.call(Unknown 
> Source)
>  at ConsoleScript0.run(ConsoleScript0:6)
> {noformat}
> If I change my JDK to Zulu OpenJDK 11.0.13, the script works fine under all 
> of 0.8.4, 0.8.5, and 0.8.6.
> After doing a bit of searching [I found this 
> discussion|https://stackoverflow.com/questions/61267495/exception-in-thread-main-java-lang-nosuchmethoderror-java-nio-bytebuffer-flip]
>  which seems to be related.
> The top answer seems to describe the problem and possible solutions. I 
> believe the change would need to be implemented within apache-mime4j to 
> remain JDK8-compatible. This is likely also an issue with JDK9 and JDK10.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to