[
https://jira.jboss.org/jira/browse/JASSIST-103?page=com.atlassian.jira.pl...
]
Tamir Lahav commented on JASSIST-103:
-------------------------------------
Hi
Thanks for the quick response. The difference between the 2 cases I mentioned above is not
really relevant to the javassist problem, I added it because I thought it can help but
maybe it just makes the description more complex.
To make things simpler, using this code:
CtClass ctClass = classPool.get(formattedClassName);
if (className.indexOf("ResultSet") > 0)
{
System.out.print("instrumenting " + className + "... " +
loader.getClass().getName() + " " + loader + " ");
CtMethod cm = ctClass.getDeclaredMethod("next");
cm.insertAfter("System.out.println(\"executing next for " +
className + "\");");
System.out.println("instrumented");
return ctClass.toBytecode();
}
I see the error, and when I comment the insertAfter statement I don't see it.
I'm afraid that trying to reproduce this error not in Weblogic can be very difficult
because as you said it may be related to complex class loadings in Weblogic and also to
the specific sample code that is executed and the specific sample database tables...
Errors appear when starting Weblogic 9.2 samples server with
javaassist instrumentations when using jrockit JVM
----------------------------------------------------------------------------------------------------------------
Key: JASSIST-103
URL:
https://jira.jboss.org/jira/browse/JASSIST-103
Project: Javassist
Issue Type: Bug
Affects Versions: 3.11.0.GA
Environment: Windows XP, Red Hat Linux
Reporter: Tamir Lahav
Assignee: Shigeru Chiba
Fix For: 3.11.0.GA
Attachments: diff.JPG, SampleTransformer.java
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);
classPool.insertClassPath(classPath);
try
{
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:
http://www.oracle.com/technology/software/products/ias/htdocs/wls_main.html
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira