Questions tagged [cglib]

CGLib (Code Generation Library) is a run time code generation library for the Java platform licensed under the Apache 2.0 license.

CGLib (Code Generation Library) is mainly used the generation of class proxies. This is achieved by creating subclasses at run time where method invocations are intercepted by user defined methods. Additionally, cglib offers different extension such as for example bean utilities. cglib is built on top of ASM.

Alternative code generation libraries for the JVM that are still under active development are:

401 questions
0
votes
0 answers

Got "UnsupportedOperationException" when try to retransformClasses

JDK1.6, modify class loaded in jvm dynamically. When I comment the code:classReader.accept(classAdapter, ClassReader.SKIP_DEBUG);, the exception "UnsupportedOperationException" disapear. Actually, for testing my code, I didnt modify any field or…
Nick Dong
  • 3,638
  • 8
  • 47
  • 84
0
votes
0 answers

how to a jvm load a project(many classes in it)

how to jvm load a project, including many classes in it? Does jvm has a class map of the whole project. How to jvm get the map of those classes? Can I get any class of this project at any time from the jvm, no matter the class is not loaded in jvm…
Nick Dong
  • 3,638
  • 8
  • 47
  • 84
0
votes
1 answer

Guice's AOP extension not working on super type

I have a following hierarchical structure: public class ItemImpl extends RepositoryBase { @Inject ItemImpl( dependency ) { super( dependency ) } } public class RepositoryBase extends Base { public…
user_1357
  • 7,766
  • 13
  • 63
  • 106
0
votes
1 answer

Grails action not firing on test environment due to some CGLIB enchantment

I have a grails application with several pages and controllers. While some of the actions work properly and the gsp pages rendering correctly, some of them aren't being rendered due to some CGLIB related error. Here is my exception when I want to…
mosahin
  • 167
  • 1
  • 9
0
votes
1 answer

java.lang.NoClassDefFoundError: net/sf/cglib/asm/util/TraceClassVisitor

i'm trying simple aop with spring 3 app-context.xml:
kassie
  • 727
  • 4
  • 11
  • 24
0
votes
1 answer

JMock using mocked objects with concrete a class

I have an object with no interface (I can't change this), I was able to mock it using Mock mockedClass = mock(ObjectExample.class, "returnObject", new Class[ ]{java.lang.Integer, java.lang.Integer}, new Object[…
Matt C
  • 137
  • 1
  • 3
  • 15
0
votes
2 answers

EasyMock Error: java.lang.VerifyError: net.sf.cglib.proxy.Enhancer

I've realized a series of Unit Tests for an Android App. The thing is, I want my test to be independent from Server Errors or others recording expectations. It seems that Mocking Object is the solution. I've started with EasyMock by following…
GiyommStarsky
  • 31
  • 1
  • 6
0
votes
2 answers

CGLib - control instance creation

I am using CGLib to enhance class A. public class A { public void printName(){ System.out.println("guy"); } } I have class B which extends class A. public class B extends A{ public void printName(){ …
guy mograbi
  • 27,391
  • 16
  • 83
  • 122
0
votes
1 answer

Creating mixins with CGLIB that implement a new interface

First off, I don't think this is necessarily a good idea, I'm just seeing if this is really possible. I could see some benefits, such as not having to explicitly convert to objects that we're sending to the client and using an interface to…
Scott
  • 338
  • 2
  • 13
0
votes
1 answer

How can I call the original method with CGLib?

I'm using CGLib to dynamicly change a TileEntity (Minecraft). In the InvocationHandler I call the Lua functions for the interface, but I want the methods that already exist to be called in Java. This is my invoke method: public Object…
Rule
  • 105
  • 1
  • 10
0
votes
1 answer

Java bytecode libraries

Could anybody explain what is the bytecode libraries? For example, some Hibernate 3.5 book tells me that Hibernate uses javaassit or CGLib bytecode libraries. For what this libraries exists? Thank you.
sidlejinks
  • 709
  • 1
  • 9
  • 25
0
votes
3 answers

java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer

when i am trying to request to Rest service at time of response it getting exception.. Feb 21, 2013 2:34:49 PM com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException SEVERE: The exception contained within…
Bhushan
  • 287
  • 3
  • 6
  • 16
0
votes
1 answer

maven repo contains wrong cglib source jar

I have encountered a problem with cglib 2.2.2 sources jar in maven central repo. It contains following top-level entries: lib META_INF src build.xml README LICENCE NOTICE Is it done intentionally or it is malformed sources package? I have repacked…
michael nesterenko
  • 14,222
  • 25
  • 114
  • 182
0
votes
1 answer

How to intercept private methods

Can someone please explain how some mocking libraries like power mock create proxies for private method. I looked a little into cglib but couldn't find a way to intercept private method invocation. I specifically want to know about any low level…
Prasad Weera
  • 1,223
  • 3
  • 13
  • 25
0
votes
1 answer

Spring-cglib proxy Behaviour in a class hierarchy

I have 2 classes @Component @Scope(proxyMode=ScopedProxyMode.TARGET_CLASS,value="session") public class Child extends Base{ } @Component @Scope(proxyMode=ScopedProxyMode.TARGET_CLASS,value="session") public class Base{ …
Srini
  • 420
  • 1
  • 5
  • 17
1 2 3
26
27