Git Product home page Git Product logo

Comments (10)

jbachorik avatar jbachorik commented on July 4, 2024

[author="j.bachorik", created="Tue, 15 Mar 2011 13:40:35 +0100"]

For the subtype matching to work correctly it is necessary to process a class only after all its superclasses and interfaces has been loaded.

In order to achieve this the class initializers of all newly loaded classes will be modified (or created if they don't exist) such that the class retransform on the current class will be triggered the moment the class initializer is executed. This will ensure the whole class hierarchy is loaded and the subtype matching will work correctly.

from btrace.

jbachorik avatar jbachorik commented on July 4, 2024

[author="j.bachorik", created="Tue, 15 Mar 2011 13:43:52 +0100"]

Fix delivered in http://kenai.com/projects/btrace/sources/core-maven/revision/12

from btrace.

jbachorik avatar jbachorik commented on July 4, 2024

[author="joachimhskeie", created="Tue, 15 Mar 2011 18:33:46 +0100"]

Hello,

I keep getting the following error:

xception in thread "main" java.lang.VerifyError: (class: org/apache/derby/jdbc/EmbeddedDriver, method:  signature: ()V) Illegal type in constant pool
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at org.eurekaj.demo.derby.DerbyEnvironment.initializeDatabase(DerbyEnvironment.java:35)
    at org.eurekaj.demo.app.Main.startExecuting(Main.java:61)
    at org.eurekaj.demo.app.Main.(Main.java:37)
    at org.eurekaj.demo.app.Main.main(Main.java:107)

The method being executed is contains the following:

public void initializeDatabase() {
try {
    Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
    connection = DriverManager.getConnection(derbyProtocol + "EurekaJDemoDB;create=true", new Properties());
    createDatabaseIfNotCreated();
} catch (InstantiationException e) {
    e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
} catch (IllegalAccessException e) {
    e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
} catch (ClassNotFoundException e) {
    e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
} catch (SQLException e) {
    e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
}
    }

The full source for the code being executed is here: https://github.com/joachimhs/EurekaJDemoApplication

It is being started with the following JAVA_OPTS from within IDEA: -Xmx256m -Dbtrace.agent=EurekaJDemoAgent -javaagent:/srv/btrace/1.3/btrace-agent-1.3-SNAPSHOT-agent.jar=scriptdir=/srv/btrace/1.3/scripts,stdout=false,fileRollMilliseconds=7500

The BTrace script being executed: https://github.com/joachimhs/EurekaJDemoApplication/blob/master/src/main/resources/JdbcQueries.java

from btrace.

jbachorik avatar jbachorik commented on July 4, 2024

[author="j.bachorik", created="Wed, 16 Mar 2011 15:11:35 +0100"]

This error was caused by loading a type operand on stack in the injected routine. Unfortunately, this requires the class version >= 49.
Fix available in http://kenai.com/projects/btrace/sources/core-maven/revision/13

from btrace.

jbachorik avatar jbachorik commented on July 4, 2024

[author="joachimhskeie", created="Thu, 17 Mar 2011 22:56:19 +0100"]

Trying out revision 13 above, I get a different stack trace than before, although similar:

java.sql.SQLException: Cannot create an instance of generated class org.apache.derby.exe.ac582f8014x012exc5cfx1c12x0000046737000.
    at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
    at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
    at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
    at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
    at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
    at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedPreparedStatement.(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedPreparedStatement20.(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedPreparedStatement30.(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedPreparedStatement40.(Unknown Source)
    at org.apache.derby.jdbc.Driver40.newEmbedPreparedStatement(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
    at org.eurekaj.demo.task.NumStatisticsTask.readRowCountFromStatisticsTable(NumStatisticsTask.java:31)
    at org.eurekaj.demo.task.NumStatisticsTask.run(NumStatisticsTask.java:45)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:680)
Caused by: java.sql.SQLException: Cannot create an instance of generated class org.apache.derby.exe.ac582f8014x012exc5cfx1c12x0000046737000.
    at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
    at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
    ... 25 more
Caused by: java.sql.SQLException: Java exception: '(class: org/apache/derby/exe/ac582f8014x012exc5cfx1c12x0000046737000, method:  signature: ()V) Illegal type in constant pool: java.lang.VerifyError'.
    at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
    at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
    at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
    at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
    at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
    at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
    ... 22 more
Caused by: java.lang.VerifyError: (class: org/apache/derby/exe/ac582f8014x012exc5cfx1c12x0000046737000, method:  signature: ()V) Illegal type in constant pool
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
    at java.lang.Class.getConstructor0(Class.java:2699)
    at java.lang.Class.getConstructor(Class.java:1657)
    at org.apache.derby.iapi.services.loader.ClassInfo.getNewInstance(Unknown Source)
    at org.apache.derby.impl.services.reflect.LoadedGeneratedClass.newInstance(Unknown Source)
    at org.apache.derby.impl.services.reflect.ReflectGeneratedClass.newInstance(Unknown Source)
    at org.apache.derby.impl.sql.GenericActivationHolder.(Unknown Source)
    at org.apache.derby.impl.sql.GenericPreparedStatement.getActivation(Unknown Source)
    ... 18 more

from btrace.

jbachorik avatar jbachorik commented on July 4, 2024

[author="j.bachorik", created="Fri, 18 Mar 2011 08:59:19 +0100"]

Rather counterintuitively, the major class version is encoded in the lower word of the version integer number. Thanks to this the plain comparison version < Opcodes.V1_5 doesn't work if a minor version is specified. It is necessary to extract the major version first and use that for the comparison.

I've checked with your demo application and after this change it works fine.

Implemented in - http://kenai.com/projects/btrace/sources/core-maven/revision/14.

from btrace.

jbachorik avatar jbachorik commented on July 4, 2024

[author="joachimhskeie", created="Fri, 18 Mar 2011 10:24:48 +0100"]

This is now working great, thanks!

from btrace.

jbachorik avatar jbachorik commented on July 4, 2024

[author="j.bachorik", created="Fri, 18 Mar 2011 10:55:01 +0100"]

Marking as closed

from btrace.

jbachorik avatar jbachorik commented on July 4, 2024

[author="j.bachorik", created="Sat, 18 Jun 2011 13:47:27 +0200"]

fix transplanted to the main (non-maven) repository - http://kenai.com/projects/btrace/sources/hg/revision/419

from btrace.

jbachorik avatar jbachorik commented on July 4, 2024

[author="j.bachorik", created="Tue, 26 Jun 2012 13:42:55 +0200"]

temporarily reopening; the issue target release has been changed to 1.2.2

from btrace.

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.