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

JavaAssist and Java 8 #59

Closed
dessalines opened this issue Apr 7, 2014 · 7 comments
Closed

JavaAssist and Java 8 #59

dessalines opened this issue Apr 7, 2014 · 7 comments

Comments

@dessalines
Copy link

I'm getting a strange error when instantiating hikariCP when using java 8.
Here's a description of the problem:
http://www.symphonious.net/2014/03/21/javassist-java-8-invalid-constant-type-15/

The stacktrace is here:
at com.zaxxer.hikari.HikariConfig.(HikariConfig.java:82)
...
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.io.IOException: invalid constant type: 15
at com.zaxxer.hikari.proxy.JavassistProxyFactory.(JavassistProxyFactory.java:63)
... 6 more
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.io.IOException: invalid constant type: 15
at com.zaxxer.hikari.proxy.JavassistProxyFactory.(JavassistProxyFactory.java:103)
at com.zaxxer.hikari.proxy.JavassistProxyFactory.(JavassistProxyFactory.java:57)
... 6 more
Caused by: java.lang.RuntimeException: java.io.IOException: invalid constant type: 15

@brettwooldridge
Copy link
Owner

I am unable to reproduce this issue on Java 8. The pom compiles and all of the tests run. Is there a longer stack trace? The one above terminates at a throw new RuntimeException(e) but the stack trace of e which should contain the exact line of the failure is not shown. I assume you are using the latest version of HikariCP?

I checked in a minor change into the dev branch (1.3.6-SNAPSHOT), that is just a guess at fixing the issue without having a full stacktrace. Can you build it and give it a try?

@dessalines
Copy link
Author

I was using 1.3.5, Let me try it with 1.3.6

@dessalines
Copy link
Author

This is 1.3.5 again, The 1.3.6-snapshot dependency didn't work through maven. I can build it if needed.

Here's another stack trace, where I got a different error:

17:07:01.617 478551 [pool-4-thread-14] ERROR com.zaxxer.hikari.proxy.JavassistProxyFactory - Fatal exception during proxy generation
java.lang.RuntimeException: java.lang.RuntimeException: java.io.FileNotFoundException: /tmp/com/zaxxer/hikari/proxy/ConnectionJavassistProxy.class (Permission denied)
at com.zaxxer.hikari.proxy.JavassistProxyFactory.(JavassistProxyFactory.java:103)
at com.zaxxer.hikari.proxy.JavassistProxyFactory.(JavassistProxyFactory.java:57)
at com.zaxxer.hikari.HikariConfig.(HikariConfig.java:82)
...
at com.ndr.md.cp.containers.redis.RedisUpdatesContainer$MyRunnable.run(RedisUpdatesContainer.java:270)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.RuntimeException: java.io.FileNotFoundException: /tmp/com/zaxxer/hikari/proxy/ConnectionJavassistProxy.class (Permission denied)
at javassist.CtClass.debugWriteFile(CtClass.java:1330)
at com.zaxxer.hikari.proxy.JavassistProxyFactory.generateProxyClass(JavassistProxyFactory.java:210)
at com.zaxxer.hikari.proxy.JavassistProxyFactory.(JavassistProxyFactory.java:90)
... 7 more
Caused by: java.io.FileNotFoundException: /tmp/com/zaxxer/hikari/proxy/ConnectionJavassistProxy.class (Permission denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.(FileOutputStream.java:206)
at java.io.FileOutputStream.(FileOutputStream.java:95)
at javassist.CtClass$DelayedFileOutputStream.init(CtClass.java:1345)
at javassist.CtClass$DelayedFileOutputStream.write(CtClass.java:1359)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
at java.io.DataOutputStream.flush(DataOutputStream.java:123)
at java.io.FilterOutputStream.close(FilterOutputStream.java:158)
at javassist.CtClass.writeFile(CtClass.java:1298)
at javassist.CtClass.debugWriteFile(CtClass.java:1325)
... 9 more
Suppressed: java.io.FileNotFoundException: /tmp/com/zaxxer/hikari/proxy/ConnectionJavassistProxy.class (Permission denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.(FileOutputStream.java:206)
at java.io.FileOutputStream.(FileOutputStream.java:95)
at javassist.CtClass$DelayedFileOutputStream.init(CtClass.java:1345)
at javassist.CtClass$DelayedFileOutputStream.write(CtClass.java:1359)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
at java.io.FilterOutputStream.close(FilterOutputStream.java:158)
at java.io.FilterOutputStream.close(FilterOutputStream.java:159)
... 11 more
Suppressed: java.io.FileNotFoundException: /tmp/com/zaxxer/hikari/proxy/ConnectionJavassistProxy.class (Permission denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.(FileOutputStream.java:206)
at java.io.FileOutputStream.(FileOutputStream.java:95)
at javassist.CtClass$DelayedFileOutputStream.init(CtClass.java:1345)
at javassist.CtClass$DelayedFileOutputStream.close(CtClass.java:1370)
at java.io.FilterOutputStream.close(FilterOutputStream.java:159)
... 12 more

@brettwooldridge
Copy link
Owner

That error seems to be caused by having debug logging enabled and the executing process not having write permissions to /tmp. When debug logging is enabled, a side-effect is that HikariCP will write its generated class files to /tmp (on Linux), because we sometimes need to debug the generated code.

Re: 1.3.6-SNAPSHOT, yes you'll have to build it to test it:

git clone https://github.com/brettwooldridge/HikariCP.git
cd HikariCP
git checkout dev
mvn install

Then use 1.3.6-SNAPSHOT as a dependency in your pom.

@dessalines
Copy link
Author

Has anyone mentioned any surefire errors when building this? I'm getting strange issues with maven:

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test) on project HikariCP: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test failed: Unable to load the mojo 'test' in the plugin 'org.apache.maven.plugins:maven-surefire-plugin:2.17'. A required class is missing: org/apache/maven/plugin/surefire/SurefireReportParameters

I tried adding it manually to the pom, but the same error came up. Tried clearing out my /.m2/org/apache/maven directory and reloading them, but they download with [WARNING] checksum issues. I think this is a maven bug.

@dessalines
Copy link
Author

Here's the maven version:
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T12:37:52-05:00)
Maven home: /usr/share/maven
Java version: 1.7.0_51, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-i386/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.8.0-31-generic", arch: "i386", family: "unix"

@brettwooldridge
Copy link
Owner

I haven't had any reports of this issue. But in the past when i've had maven issues, I just wipe out .m2 completely and allow it to rebuild.

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

2 participants