Uploaded image for project: 'Javassist'
  1. Javassist
  2. JASSIST-103

Errors appear when starting Weblogic 9.2 samples server with javaassist instrumentations when using jrockit JVM



      I Instrumented Weblogic 9.2 samples server by adding this line to the startup script (<Weblogic-Home>\weblogic92\samples\domains\wl_server\bin\startWebLogic.cmd):

      SET JAVA_TOOL_OPTIONS=-javaagent:C:\dev\workspaces\HEAD\SampleJavaAgent\lib\sample-java-agent.jar

      sample-java-agent.jar contains 2 classes:

      SampleJavaAgent with this method:

      public static void premain(String agentArguments, Instrumentation instrumentation)

      { instrumentation.addTransformer(new SampleTransformer()); }

      SampleTransformer with this method:

      public byte[] transform(ClassLoader loader, String className, Class classBeingRedefined,
      ProtectionDomain protectionDomain, byte[] classfileBuffer)
      throws IllegalClassFormatException

      final String formattedClassName = className.replace('/', '.');
      final ClassPool classPool = ClassPool.getDefault();
      final ClassPath classPath = new ByteArrayClassPath(formattedClassName, classfileBuffer);



      CtClass ctClass = classPool.get(formattedClassName);

      if (className.indexOf("wrapper/ResultSet") > 0 ||
      className.indexOf("sql/ResultSet") > 0 ||
      className.indexOf("net/netJDBCResultSet") > 0 ||
      className.indexOf("ResultSet") > 0)

      { System.out.print("instrumenting " + className + "..."); CtMethod cm = ctClass.getDeclaredMethod("next"); cm.insertAfter("System.out.println(\"executing next for " + className + "\");"); System.out.println("instrumented"); return ctClass.toBytecode(); }


      catch (Throwable e)

      { System.out.println("failed. " + e.getMessage()); }

      return null;

      When I"m starting Weblogic with the modified startup script I see this error:

      <13:47:52 IST 01/03/2010> <Error> <Store> <BEA-280072> <JDBC store "exampleJDBCStore" failed to open table "examplesWLStore".
      weblogic.store.io.jdbc.JDBCStoreException: [Store:280065][Store:280068]JDBC store failed to initialize. It did not find its database table and failed trying to create a new empty table using the commands in file "/weblogic/store/io/jdbc/ddl/pointbase.ddl". (server="examplesServer" store="exampleJDBCStore" table="examplesWLStore"):(Linked Cause, "java.sql.SQLException: The table "EXAMPLES.EXAMPLESWLSTORE" already exists.")
      at weblogic.store.io.jdbc.JDBCStoreIO.createTable(JDBCStoreIO.java:594)
      at weblogic.store.io.jdbc.JDBCStoreIO.open(JDBCStoreIO.java:342)
      at weblogic.store.internal.PersistentStoreImpl.open(PersistentStoreImpl.java:350)
      at weblogic.store.admin.AdminHandler.activate(AdminHandler.java:135)
      at weblogic.store.admin.JDBCAdminHandler.activate(JDBCAdminHandler.java:64)
      Truncated. see log file for complete stacktrace

      When I changed the "if" statement in the transform method to this:

      if (className.indexOf("wrapper/ResultSet") > 0 ||
      className.indexOf("sql/ResultSet") > 0 ||
      className.indexOf("net/netJDBCResultSet") > 0 ||
      className.indexOf("ResultSetxxx") > 0)

      the error disappeared, even according to the system out messages the number of instrumented classes is the same in both cases.

      When I used Sun's JVM by changing JAVA_VENDOR variable in setDomainEnv.cmd script in the same directory the error also disappeared.

      Weblogic 9.2 installation can be found here:


        Gliffy Diagrams




              • Assignee:
                chiba Shigeru Chiba
                tamirla Tamir Lahav
              • Votes:
                0 Vote for this issue
                0 Start watching this issue


                • Created: