[JBoss JIRA] Created: (JBMICROCONT-286) User Guide examples (gettingStarted), NoClassDefFoundError
by Walid Gedeon (JIRA)
User Guide examples (gettingStarted), NoClassDefFoundError
----------------------------------------------------------
Key: JBMICROCONT-286
URL: http://jira.jboss.com/jira/browse/JBMICROCONT-286
Project: JBoss MicroContainer
Issue Type: Patch
Environment: Issue unrelated with environment, platform independent.
Reporter: Walid Gedeon
This relates to the examples attached to the JBoss Microcontainer User Guide 2.0.0Beta9 (sorry, didn't find a matching version in the list).
In the commandLineClient sample, bus mode, Client cannot see Employee (which is defined in one of the services, in this case humanResourcesService); therefore it throws a NoClassDefFoundError when adding an employee.
The attached archive updates files in humanResourcesService:<ul>
<li>split service and beans into interface and implementation</li>
<li>moved interfaces to org.jboss.example.service.common (including SalaryStrategy)</li>
<li>added Address and Employee factory methods to HRService</li>
<li>updated pom to produce secondary artifact for client-only dependency</li>
<li>updated test case deployment descriptors to refer to HRServiceImpl</li>
</ul>
and in commandLineClient:<ul>
<li>Updated ConsoleInput to keep a copy of the Client and use it as a proxy to HRService calls (namely factory methods)</li>
<li>Added HRService factory proxy methods to Client</li>
<li>Added isHiringFreeze() and getSalaryStrategy for homogenous proxy access</li>
<li>Updated printStatus to use client methods for HRService access</li>
<li>Updated config files to inject HRServiceImpl</li>
<li>Updated assembly files to depend on main or secondary (client) artifacts, depending on situation</li>
<li>Added pom dependency to client artifact</li>
<li>Updated test cases to use above changes</li>
<li>Updated test cases deployment descriptors to inject HRServiceImpl</li>
</ul>
The archive contains the complete contents of those 2 subdirectories (changed and unchanged files), if a diff-patch is preferred, it can be provided with an access to svn. To update as is, replace directories commandLineClient and humanResourcesService with the ones provided, no other updates required.
Error trace, for reference:
<pre>
D:\...\commandLineClient\target\client-cl.dir>run.bat bus
Client DEBUG [06-05-2008 17:44:43] KernelFactory - Starting JBoss Kernel construction...
Client DEBUG [06-05-2008 17:44:43] KernelFactory - Completed JBoss Kernel construction. Duration: 187 milliseconds
-----------------------------------
Menu:
d) Deploy Human Resources service
u) Undeploy Human Resources service
a) Add employee
l) List employees
r) Remove employee
g) Get a salary
s) Set a salary
t) Toggle hiring freeze
m) Display menu
p) Print service status
q) Quit
>d
Client DEBUG [06-05-2008 17:44:46] SaxJBossXBParser - Created parser: org.apache.xerces.jaxp.SAXParserImpl@64883c, isNam
espaceAware: true, isValidating: true, isXIncludeAware: true
Client DEBUG [06-05-2008 17:44:46] SaxJBossXBParser - http://xml.org/sax/features/validation set to: true
Client DEBUG [06-05-2008 17:44:46] SaxJBossXBParser - http://xml.org/sax/features/namespaces set to: true
Client DEBUG [06-05-2008 17:44:46] SaxJBossXBParser - http://apache.org/xml/features/validation/dynamic set to: true
Client DEBUG [06-05-2008 17:44:46] SaxJBossXBParser - Using parser: org.apache.xerces.jaxp.SAXParserImpl@64883c, isNames
paceAware: true, isValidating: true, isXIncludeAware: true
>a
Please enter the employee's name [firstName lastName]:
first last
Exception in thread "Thread-1" java.lang.NoClassDefFoundError: org/jboss/example/service/Employee
at org.jboss.example.client.ConsoleInput.getEmployee(ConsoleInput.java:108)
at org.jboss.example.client.Client.addEmployee(Client.java:94)
at org.jboss.example.client.ConsoleInput$1.run(ConsoleInput.java:54)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.jboss.example.service.Employee
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 4 more
Client INFO [06-05-2008 17:44:59] EmbeddedBootstrap - Shutting down
</pre>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
18 years
[JBoss JIRA] Created: (JBMESSAGING-908) MySQL on Linux fails to load server after failover
by Tim Fox (JIRA)
MySQL on Linux fails to load server after failover
--------------------------------------------------
Key: JBMESSAGING-908
URL: http://jira.jboss.com/jira/browse/JBMESSAGING-908
Project: JBoss Messaging
Issue Type: Bug
Reporter: Tim Fox
Assigned To: Tim Fox
Fix For: 1.2.1
Sometimes, after failover occurs and a server is restarted, the server start fails with:
java.lang.IllegalStateException: Did not load correct number of messages, wanted:1 but got:0
at org.jboss.messaging.core.PagingChannelSupport.processReferences(PagingChannelSupport.java:591)
at org.jboss.messaging.core.PagingChannelSupport.doLoad(PagingChannelSupport.java:518)
at org.jboss.messaging.core.plugin.postoffice.cluster.LocalClusteredQueue.mergeIn(LocalClusteredQueue.java:243)
at org.jboss.messaging.core.plugin.postoffice.cluster.DefaultClusteredPostOffice.performFailover(DefaultClusteredPostOffice.java:2169)
at org.jboss.messaging.core.plugin.postoffice.cluster.DefaultClusteredPostOffice.nodeLeft(DefaultClusteredPostOffice.java:2031)
at org.jboss.messaging.core.plugin.postoffice.cluster.DefaultClusteredPostOffice.access$1800(DefaultClusteredPostOffice.java:98)
at org.jboss.messaging.core.plugin.postoffice.cluster.DefaultClusteredPostOffice$HandleViewAcceptedRunnable.run(DefaultClusteredPostOffice.java:2400)
at EDU.oswego.cs.dl.util.concurrent.QueuedExecutor$RunLoop.run(QueuedExecutor.java:89)
at java.lang.Thread.run(Thread.java:595
or similar.
Analysing logs it seems this is because when the server crashed previously it did so and partially committed a transaction, i.e inserted the ref but not the message.
My suspicion is that this is because the MySQL configuration being used is setup to use the non transaction myISAAM storage which has no transaction support. But this needs to be verified.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
18 years
[JBoss JIRA] Created: (JASSIST-52) VerifyError (inconsistent stack height) through MethodCall#replace when block includes a try/catch block
by Yanic Inghelbrecht (JIRA)
VerifyError (inconsistent stack height) through MethodCall#replace when block includes a try/catch block
--------------------------------------------------------------------------------------------------------
Key: JASSIST-52
URL: http://jira.jboss.com/jira/browse/JASSIST-52
Project: Javassist
Issue Type: Bug
Environment: javassist 3.7.1 (from cvs HEAD), jdk 1.6.0_03 on winXP
Reporter: Yanic Inghelbrecht
Assigned To: Shigeru Chiba
Included is the simplest test case I could find that reproduces the error, it consists of two classes : Client (to be instrumented) and Main (does the instrumentation).
When run, it produces the following exception trace :
Exception in thread "main" java.lang.VerifyError: (class: test_verify_error_with_try_catch_in_replace/Client, method: instrumentMe signature: ()V) Inconsistent stack height 0 != 2
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at test_verify_error_with_try_catch_in_replace.Main.main(Main.java:30)
The error disappears in all of the following cases (so it must be related to them I guess) :
- when the try/catch block is removed from the replacement block
- when the string concatenation happens without using two local variables
- when the string concatenation is removed but the local variables are kept
This is related (for me at least) to JIRA JAVASSIST 51, where a similar error occurred for NewExpr (and was quickly fixed, thanks again for that!!).
Just like issue 51, it is a show stopper for our project since it all ties in with the support for exceptions in the development tool we're creating, so I hope you will again regard it as an urgent issue.
Thanks in advance.
Best regards,
Yanic
-- source code for client.java
package test_verify_error_with_try_catch_in_replace;
public class Client {
public void instrumentMe() throws Exception {
// the error is somehow related to the string concatenation and local variables,
// when the code below is replaced with something else, the error does not occur.
String s1 = "a";
String s2 = s1 + "b";
}
}
-- source code for Main.java
package test_verify_error_with_try_catch_in_replace;
import java.lang.reflect.Method;
import javassist.CannotCompileException;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtMethod;
import javassist.Loader;
import javassist.NotFoundException;
import javassist.Translator;
import javassist.expr.ExprEditor;
import javassist.expr.MethodCall;
public class Main {
public static void main(String[] args) throws Exception {
ClassPool pool = new ClassPool(true);
Loader cl = new Loader();
try {
cl.addTranslator(pool, new MyTranslator());
} catch (Exception e) {
e.printStackTrace();
return;
}
// load the Client class
Class clientClass=cl.loadClass("test_verify_error_with_try_catch_in_replace.Client");
// create an instance
Object client=clientClass.newInstance();
// execute Client#instrumentMe
Method callMethod=clientClass.getMethod("instrumentMe", new Class[]{});
callMethod.invoke(client, new Object[]{});
}
static public class MyTranslator extends ExprEditor implements Translator {
public void onLoad(ClassPool pool, String classname) throws NotFoundException, CannotCompileException {
CtClass cc = pool.get(classname);
modify(cc);
}
public void modify(CtClass c) throws CannotCompileException {
for (CtMethod m : c.getMethods()) {
m.instrument(this);
}
}
@Override
public void edit(MethodCall mc) throws CannotCompileException {
// simple proceed surrounded by a try/catch block
String block = "{try{$_=$proceed($$);} catch(Throwable t) {}}";
mc.replace(block);
}
public void start(ClassPool pool) throws NotFoundException, CannotCompileException {
// do nothing
}
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
18 years
[JBoss JIRA] Created: (JASSIST-53) VerifyError (constructor must call super() or this()) through ConstructorCall#replace when block includes a try/catch block
by Yanic Inghelbrecht (JIRA)
VerifyError (constructor must call super() or this()) through ConstructorCall#replace when block includes a try/catch block
---------------------------------------------------------------------------------------------------------------------------
Key: JASSIST-53
URL: http://jira.jboss.com/jira/browse/JASSIST-53
Project: Javassist
Issue Type: Bug
Environment: javassist 3.7.1 (from cvs HEAD), jdk 1.6.0_03 on winXP
Reporter: Yanic Inghelbrecht
Assigned To: Shigeru Chiba
Included is the simplest test case I could find that reproduces the error, it consists of two classes : Client (to be instrumented) and Main (does the instrumentation).
When run, it produces the following exception trace :
Exception in thread "main" java.lang.VerifyError: (class: test_verify_error_with_try_catch_in_replace_for_constructor_call/Client, method: <init> signature: ()V) Constructor must call super() or this()
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at test_verify_error_with_try_catch_in_replace_for_constructor_call.Main.main(Main.java:31)
Also, when the replacement block uses $0 (the constructed object), for example :
String block = "{try {$_=$proceed($$);} catch (Throwable t) {System.out.println($0);}}";
the error message changes to :
Exception in thread "main" java.lang.VerifyError: (class: test_verify_error_with_try_catch_in_replace_for_constructor_call/Client, method: <init> signature: ()V) Register 1 contains wrong type
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at test_verify_error_with_try_catch_in_replace_for_constructor_call.Main.main(Main.java:31)
Again, this is related (for me at least) to JIRA JAVASSIST 51 and 52, since those also deal with adding a try/catch block using replace in an ExprEditor#edit method.
So far I've reported three issues all related to adding try/catch block with a replace in ExprEditor#edit :
51 for NewExpr
52 for MethodCall
53 for ConstructorCall
I don't use the other ExprEditor#edit methods (i.e. edit(Handler), edit(FieldAccess), ...), so I don't expect to report any similar issues. However, you may want to check them to see if they suffer from the same problem.
I hope it's an easy fix for you!
Best regards,
Yanic
-- source for Client.java
package test_verify_error_with_try_catch_in_replace_for_constructor_call;
public class Client {
//
}
-- source for Main.java
package test_verify_error_with_try_catch_in_replace_for_constructor_call;
import java.lang.reflect.Method;
import javassist.CannotCompileException;
import javassist.ClassPool;
import javassist.CtBehavior;
import javassist.CtClass;
import javassist.CtMethod;
import javassist.Loader;
import javassist.NotFoundException;
import javassist.Translator;
import javassist.expr.ConstructorCall;
import javassist.expr.ExprEditor;
public class Main {
public static void main(String[] args) throws Exception {
ClassPool pool = new ClassPool(true);
Loader cl = new Loader();
try {
cl.addTranslator(pool, new MyTranslator());
} catch (Exception e) {
e.printStackTrace();
return;
}
// load the Client class
Class clientClass=cl.loadClass("test_verify_error_with_try_catch_in_replace_for_constructor_call.Client");
// create an instance
Object client=clientClass.newInstance();
}
static public class MyTranslator extends ExprEditor implements Translator {
public void onLoad(ClassPool pool, String classname) throws NotFoundException, CannotCompileException {
CtClass cc = pool.get(classname);
modify(cc);
}
public void modify(CtClass c) throws CannotCompileException {
for (CtBehavior b : c.getDeclaredBehaviors()) {
b.instrument(this);
}
}
@Override
public void edit(ConstructorCall cc) throws CannotCompileException {
// simple proceed surrounded by a try/catch block
// each block gives a different VerifyError
String block = "{try {$_=$proceed($$);} catch (Throwable t) {}}";
// String block = "{try {$_=$proceed($$);} catch (Throwable t) {System.out.println($0);}}";
cc.replace(block);
}
public void start(ClassPool pool) throws NotFoundException, CannotCompileException {
// do nothing
}
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
18 years
[JBoss JIRA] Created: (JASSIST-60) VerifyError : Bad access to protected data
by Yanic Inghelbrecht (JIRA)
VerifyError : Bad access to protected data
------------------------------------------
Key: JASSIST-60
URL: http://jira.jboss.com/jira/browse/JASSIST-60
Project: Javassist
Issue Type: Bug
Environment: Javassist 3.7.1 (latest from cvs HEAD)
Eclipse Version: 3.3.1.1, Build id: M20071023-1652 running in the JRE included with JDK1.6.0_03 on winXP and compiler compliance set to 5.0.
Reporter: Yanic Inghelbrecht
Assigned To: Shigeru Chiba
While running some javassist instrumentation on JHotDraw, I ran into the issue described below
The code (attached in the follow-up post) is the simplest testcase I could find and causes the following exception when executed :
Exception in thread "main" java.lang.VerifyError: (class: test_protected_and_bad_access/Client, method: doit signature: (Ltest_protected_and_bad_access/Circle;)V) Bad access to protected data
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at test_protected_and_bad_access.Main.main(Main.java:31)
The testcase uses clone() to demonstrate the bug.
Some things I've noticed that when the formal parameter of Client#doit(Circle) is changed from Circle to Figure, the error disappears (i.e. the two interface levels seem to matter).
In the JHotDraw setup, adding a "public Object clone();" to the Circle interface is a work-around for this bug, although it doesn't seem to work in the attached testcase : when I add it, it results in a NoSuchMethodError for client#doit(Circle) when javassist loads the Client class (which is very trange since that class was not touched). If the same modification is made but the class is loaded with "regular reflection", the method is found alright, so perhaps this is a javassist bug as well?
Thanks in advance for a quick response.
Best regards,
Yanic
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
18 years