Giter Club home page Giter Club logo

Comments (13)

brianm avatar brianm commented on June 13, 2024

Ugh, cglib conversion has not been smooth I guess. Am sick as the proverbial dog so probably won't get fixed today :-(

On Jun 13, 2012, at 11:51 AM, Coda [email protected] wrote:

Just ugpraded from 2.34 to 2.36.1, and I'm seeing this error in Dropwizard's unit tests:

org.skife.jdbi.net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
   at org.skife.jdbi.net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237)
   at org.skife.jdbi.net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
   at org.skife.jdbi.net.sf.cglib.proxy.Enhancer.create(Enhancer.java:285)
   at org.skife.jdbi.v2.sqlobject.SqlObject.buildSqlObject(SqlObject.java:61)
   at org.skife.jdbi.v2.sqlobject.SqlObjectBuilder.open(SqlObjectBuilder.java:54)
   at org.skife.jdbi.v2.DBI.open(DBI.java:301)
   at com.yammer.dropwizard.db.tests.DatabaseTest.sqlObjectsCanAcceptOptionalParams(DatabaseTest.java:97)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
   at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
   at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
   at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
   at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
   at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
   at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
   at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
   at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
   at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
   at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
   at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
   at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
   at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
   at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
   at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
   at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:76)
   at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)
   at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.lang.reflect.InvocationTargetException
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at org.skife.jdbi.net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:384)
   at org.skife.jdbi.net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:219)
   ... 34 more
Caused by: java.lang.ClassFormatError: Duplicate method name&signature in class file org/skife/jdbi/v2/sqlobject/CloseInternal$$EnhancerByCGLIB$$d17a2f8a
   at java.lang.ClassLoader.defineClass1(Native Method)
   at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
   at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
   ... 40 more

Reply to this email directly or view it on GitHub:
#26

from jdbi.

codahale avatar codahale commented on June 13, 2024

No worries. Not a pressing issue.

On Wed, Jun 13, 2012 at 11:36 AM, Brian McCallister
[email protected]
wrote:

Ugh, cglib conversion has not been smooth I guess. Am sick as the proverbial dog so probably won't get fixed today :-(

On Jun 13, 2012, at 11:51 AM, Coda [email protected] wrote:

Just ugpraded from 2.34 to 2.36.1, and I'm seeing this error in Dropwizard's unit tests:

org.skife.jdbi.net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
   at org.skife.jdbi.net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237)
   at org.skife.jdbi.net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
   at org.skife.jdbi.net.sf.cglib.proxy.Enhancer.create(Enhancer.java:285)
   at org.skife.jdbi.v2.sqlobject.SqlObject.buildSqlObject(SqlObject.java:61)
   at org.skife.jdbi.v2.sqlobject.SqlObjectBuilder.open(SqlObjectBuilder.java:54)
   at org.skife.jdbi.v2.DBI.open(DBI.java:301)
   at com.yammer.dropwizard.db.tests.DatabaseTest.sqlObjectsCanAcceptOptionalParams(DatabaseTest.java:97)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
   at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
   at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
   at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
   at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
   at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
   at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
   at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
   at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
   at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
   at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
   at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
   at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
   at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
   at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
   at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
   at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:76)
   at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)
   at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.lang.reflect.InvocationTargetException
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at org.skife.jdbi.net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:384)
   at org.skife.jdbi.net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:219)
   ... 34 more
Caused by: java.lang.ClassFormatError: Duplicate method name&signature in class file org/skife/jdbi/v2/sqlobject/CloseInternal$$EnhancerByCGLIB$$d17a2f8a
   at java.lang.ClassLoader.defineClass1(Native Method)
   at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
   at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
   ... 40 more

Reply to this email directly or view it on GitHub:
#26


Reply to this email directly or view it on GitHub:
#26 (comment)

Coda Hale
http://codahale.com

from jdbi.

brianm avatar brianm commented on June 13, 2024

I have replicated this, but only with shaded CGLIB. Will continue to hack at it.

from jdbi.

brianm avatar brianm commented on June 13, 2024

Okay, looks like the somewhat ancient version of the maven shade plugin I was using had a bug and was converting:

public java.lang.Object newInstance(net.sf.cglib.proxy.Callback);
public java.lang.Object newInstance(net.sf.cglib.proxy.Callback[]);

to

public java.lang.Object newInstance(org.skife.jdbi.cglib.proxy.Callback);
public java.lang.Object newInstance(org.skife.jdbi.cglib.proxy.Callback);

Which clearly won't work. Can you try again with 2.37.1 ?

from jdbi.

codahale avatar codahale commented on June 13, 2024

Works like a charm.

from jdbi.

doomspork avatar doomspork commented on June 13, 2024

I'm seeing this exception, with a different caused by, using JDBI 2.37.1 alongside Dropwizard 0.4.0:

org.skife.jdbi.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
  at org.skife.jdbi.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237)
  at org.skife.jdbi.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
  at org.skife.jdbi.cglib.proxy.Enhancer.create(Enhancer.java:285)
  at org.skife.jdbi.v2.sqlobject.SqlObject.buildSqlObject(SqlObject.java:61)
  at org.skife.jdbi.v2.sqlobject.SqlObjectBuilder.onDemand(SqlObjectBuilder.java:68)
  at org.skife.jdbi.v2.DBI.onDemand(DBI.java:314)
  at com.dropgis.db.LocationsDAOTest.classSetUp(LocationsDAOTest.java:47)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at org.junit.internal.runners.ClassRoadie.runBefores(ClassRoadie.java:49)
  at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:36)
  at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
  at org.junit.runner.JUnitCore.run(JUnitCore.java:130)
  at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
Caused by: java.lang.reflect.InvocationTargetException
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at org.skife.jdbi.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:384)
  at org.skife.jdbi.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:219)
  ... 17 more
Caused by: java.lang.IllegalAccessError: class com.dropgis.db.LocationsDAO$$EnhancerByCGLIB$$7656e3ae cannot access its superinterface org.skife.jdbi.v2.sqlobject.CloseInternal
  at java.lang.ClassLoader.defineClass1(Native Method)
  at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
  at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
  ... 23 more 

Any ideas?

from jdbi.

brianm avatar brianm commented on June 13, 2024

First, try 2.37.2 and let me know if it still happens.

Caused by: java.lang.IllegalAccessError: class com.dropgis.db.LocationsDAO$$EnhancerByCGLIB$$7656e3ae cannot access its superinterface org.skife.jdbi.v2.sqlobject.CloseInternal 

looks interesting. CloseInternal is a package local interface which all sql objects implement.

from jdbi.

doomspork avatar doomspork commented on June 13, 2024

I've updated to 2.37.2 but I'm still seeing the same exception and cause by. I can put together a sample project to demonstrate what I'm doing to replicate this if it would be helpful. It's nothing special though, just an abstract class with a single implemented method.

from jdbi.

frederikb avatar frederikb commented on June 13, 2024

I have the same problem as doomspork with 2.38.

If I had to guess, then I would presume that the exception is thrown because the class generated by cglib resides in the same package as its original and therefore cannot access the package local interface CloseInternal. The TestClassBasedSqlObject test passes because it resides in the same package as the CloseInternal interface. I've never directly used cglib before, so I might be off.

from jdbi.

brianm avatar brianm commented on June 13, 2024

Okay, replicated. Sorry about this!

from jdbi.

brianm avatar brianm commented on June 13, 2024

Just cut 2.38.1 I think this resolves the issue -- I added a test to replicate, and you were exactly correct. Could you confirm if 2.38.1 fixes it for you?

from jdbi.

frederikb avatar frederikb commented on June 13, 2024

Thanks a lot, that did the trick!

from jdbi.

brianm avatar brianm commented on June 13, 2024

Fixed!

from jdbi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.