javassist

Javassist: how to create proxy of proxy?

I'm creating proxies with javassist ProxyFactory. When creating a single proxy all works fine. However, when I pass a proxied object to the proxying mechanism, it fails with javassist.bytecode.DuplicateMemberException: duplicate method: setHandler in com.mypackage.Bean_$$_javassist_0_$$_javassist_1 I'm creating the proxies with th...

java class creation dynamically and make it accessible across the network different jvms i.e. serializable

Hi. I have a requirement of creating java classes dynamically and make it accessible different jvms across the network. I tried to use reflection and javassist tool,but nothing worked. Let me explain the scenario we are using Coherence distributed cache. It has a power of doing aggregation/filtering in parallel across the cluster. For ex...

Creating java class with annotated fields in runtime

The problem is that I need to create in runtime a class like this: public class Foo { @Bar int value0; @Bar int value1; @Bar int value2; .... } with number of fields being decided at runtime. I was looking at Javassist, and there you can create a new class, and add fields to it, but I haven't found a way to annotate those field...

Adding an annotation to a runtime generated method/class using Javassist

I'm using Javassist to generate a class foo, with method bar, but I can't seem to find a way to add an annotation (the annotation itself isn't runtime generated) to the method. The code I tried looks like this: ClassPool pool = ClassPool.getDefault(); // create the class CtClass cc = pool.makeClass("foo"); // create the method CtMetho...

Deproxy a Seam component that is being passed as a remote EJB parameter?

This is a cross-post to the Seam forum: http://seamframework.org/Community/DeproxyASeamComponentThatIsBeingPassedAsARemoteEJBParameter A coworker of mine recently brought up a scenario that was a bit surprising to me, it involves 2 components and a remote EJB He has a reference to Component B that is injected into Component A. Compone...

Javassist failure in hibernate: invalid constant type: 60

I'm creating a cli tool to manage an existing application. Both the application and the tests build fine and run fine but despite that I receive a javassist failure when running my cli tool that exists within the jar: INFO: Bytecode provider name : javassist ... INFO: Hibernate EntityManager 3.5.1-Final Exception in thread "main" javax....

Javassist annoations problem

I'm trying to generate my Entity class using javassist. Everything went well until I added the GeneratedValue annotation to the Id field. The @Id annotation works fine but when I add @GeneeratedValue I get an exception. This is my code: ClassPool cp = ClassPool.getDefault(); CtClass ctClass = cp.makeClass("test.Snake"); ClassFile ...

Javassist Vs. Java Compiler API

Hello all. In a project I'm currently working on, I need to generate Java classes at runtime. I also need to avoid using reflection when using these classes later on. I've been search for current solutions to do this, and found Javassist and Java 6 Java Compiler API. I'm confused though: What does Javassist uses to generate classes?...

Classpath of classes compiled with Javassist

As the title suggests, what is the classpath of classes compiled with Javassist? My scenario is: Class A is compiled with Javassist. Class B is compiled with Java Compiler API and references Class A. The problem is that Class A is not visible to Class B... Any ideas? ...

introspection - table name of an object managed by Hibernate (JavassistLazyInitializer)

I want to get through introspection the table name of an object managed by Hibernate (in lazy). my object contains "org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer" in the property handler. my object is of type "mypackage.myObjectDO_ _javassist_2 $ $" and does not contain the annotations that the class "mypackage.myObjectDO...

Weblogic 10 and Struts 2.x problem - Javassist

Please help with this issue, I'm going mad... I'm trying to make a client-server web application using Weblogic 10 as an application server and IIS as a webserver (corporate constraints), with EJB 3 and Struts 2. I am however having strage problems which I cannot solve. Using Struts 2.2 I get the following stack trace while starting th...

jsf-console 3.x on JBoss 6.x possible?

Hi, I'm trying to move an application from JBoss 4.2.2 AS to 6.x AS. Right now I'm trying to get jbpm 3.x running on the AS I have this problem when trying to upload a .par file to the server: 13:41:51,713 ERROR [org.jbpm.db.GraphSession] (http-127.0.0.1-8888-1) java.lang.ClassCastException: org.jbpm.graph.def.Node_$$_javassist_92 canno...

How to see / print the class content in Javassist?

Hi guys, I'm making some classes using Javassist. Is there a easy way to get/print the source of the class that I'm creating? Or I have to do manually, get methods and print it :3. ...