[Javassist] New message: "cannot access added Field in some cases. Please help."
by Arvind K
User development,
A new message was posted in the thread "cannot access added Field in some cases. Please help.":
http://community.jboss.org/message/524066#524066
Author : Arvind K
Profile : http://community.jboss.org/people/megalodon
Message:
--------------------------------------------------------------
Hello,
*Some background regarding my issue*:
I have obtained the byteArray of the class using a ClassFileTransformer added to an Instrumentation object. I am then using the
ClassPool.makeClassIfNew()
function to create the corresponding CtClass object.
*Issue*:
I am creating a simple int field using
myCtField = CtField.new(CtClass.intType, "myInt", myCtClassObj)
and then adding theCtField to the CtClass using
myCtClassObj.addField(myCtField);
Now I am adding access to the field, within a method in the class represented by the CtMethod object myCtM, using a simple statement like,
myCtM.insertBefore("myInt = 10;");
I am then using CtClass.toBytecode() to get the instrumented bytecode which I am sending back to the ClassFileTransformer to be loaded. Now, When the class gets instantiated and 'executed', I would get a *CannotCompileException* as follows:
javassist.CannotCompileException: [source error] no such field: myInt
*HOWEVER*,
when I perform the same instrumentations such as above in a simpler Javassist example and then use CtClass.toClass(), create a new class and a new instance of it using the newInstance() function and execute the modified method, I am able to access the newly added field just fine!
*What am I missing here?* Please provide your thoughts on this. Thanks!
-Arvind
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/524066#524066
16 years, 2 months
[Beginner's Corner] New message: "jboss threads in ps -efL"
by shay ngr
User development,
A new message was posted in the thread "jboss threads in ps -efL":
http://community.jboss.org/message/524064#524064
Author : shay ngr
Profile : http://community.jboss.org/people/shayna
Message:
--------------------------------------------------------------
i am not sure that this is the right place for this post but i will try...
i am using linux rad hat 5.1 with jboss
Usually when i am displaying the jboss amount of thread in linux OS( i am using the ps -efL|grep -ic jboss)
i get about 150 threads (this is our normal stat -no problem with that)
the problem starts when we have infrastructure problem 'in this case our threads amount go over 350 and when the infrastructure problem
Solved the jboss threads amount stays the same.
Only restarting the jboss service is solving the problem.
it seems that in case of problem the threads do not closed normally and do not returns to the pool.
is anybody familiar with such problem
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/524064#524064
16 years, 2 months