openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Janap <>
Subject Re: Runtime Enhancement in Eclipse
Date Wed, 11 Jul 2007 09:27:58 GMT

Thx for the info that step working. Didnt have time for research
for the past2 days,but now Im back with another problem.

My web project structure is as follows..





Following is my persistence.xml

<persistence xmlns="" version="1.0">
<persistence-unit name="myPersistence"  transaction-type="RESOURCE_LOCAL">
            <property name="openjpa.ConnectionURL" value="myurl"/>
            <property name="openjpa.ConnectionDriverName"
            <property name="openjpa.ConnectionUserName" value="myuser"/>
            <property name="openjpa.ConnectionPassword" value="mypwd"/>
            <property name="openjpa.Log"

For runtime enhancement is start Tomcat within Eclipse with the following VM
arguments :


My Tomcat starts properly with the following log : 

15  TRACE  [main] openjpa.Runtime - Setting the following properties from
into configuration: {openjpa.ConnectionUserName=myuser,
openjpa.ConnectionPassword=mypwd, openjpa.Log=DefaultLevel=TRACE,Tool=TRACE,
openjpa.MetaDataFactory=Resources=orm.xml, Types=test.Scale,
186  INFO   [main] openjpa.MetaData - Found 1 classes with metadata in 0

Then as I try to run this servlet code :

    	EntityManagerFactory emf =

    	EntityManager em = emf.createEntityManager();

    	Scale tab = new Scale(5);

I run into an exception which I believe because my class is not somehow
enhanced :

62  TRACE  [http-8090-Processor24] openjpa.MetaData - Using metadata factory
93  INFO   [http-8090-Processor24] openjpa.jdbc.JDBC - Using dictionary
class "org.apache.openjpa.jdbc.sql.OracleDictionary".
202  INFO   [http-8090-Processor24] openjpa.MetaData - Found 1 classes with
metadata in 16 milliseconds.
95452  TRACE  [http-8090-Processor24] openjpa.Enhance - "test/Scale"
requires runtime enhancement: true
95561  WARN   [http-8090-Processor24] openjpa.Enhance - An exception was
thrown while attempting to perform class file transformation on
java.lang.IllegalArgumentException: java.lang.ClassNotFoundException:
	at serp.util.Strings.toClass(
	at serp.util.Strings.toClass(
	at serp.bytecode.BCClass.getType(
	at org.apache.openjpa.enhance.PCEnhancer.<init>(
	at sun.instrument.TransformerManager.transform(
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(

I tried out different combinations but was not successful...probably someone
could find the flaw..

best wishes


This is from the Java SE 6 documentation. It explains "all":
Command-Line Interface

On implementations with a command-line interface, an agent is started  
by adding this option to the command-line:

jarpath is the path to the agent JAR file. options is the agent  
options. This switch may be used multiple times on the same command- 
line, thus creating multiple agents. More than one agent may use the  
same jarpath. An agent JAR file must conform to the JAR file  
The manifest of the agent JAR file must contain the attribute Premain- 
Class. The value of this attribute is the name of the agent class.  
The agent class must implement a public static premain method similar  
in principle to the main application entry point. After the Java  
Virtual Machine (JVM) has initialized, each premain method will be  
called in the order the agents were specified, then the real  
application main method will be called. Each premain method must  
return in order for the startup sequence to proceed.
The premain method has one of two possible signatures. The JVM first  
attempts to invoke the following method on the agent class:
public static void premain(String agentArgs, Instrumentation inst);
If the agent class does not implement this method then the JVM will  
attempt to invoke:

public static void premain(String agentArgs);
The agent class may also have an agentmain method for use when the  
agent is started after VM startup. When the agent is started using a  
command-line option, the agentmain method is not invoked.

The agent class will be loaded by the system class loader (see  
ClassLoader.getSystemClassLoader). This is the class loader which  
typically loads the class containing the application main method. The  
premain methods will be run under the same security and classloader  
rules as the application main method. There are no modeling  
restrictions on what the agent premain method may do. Anything  
application main can do, including creating threads, is legal from  

Each agent is passed its agent options via the agentArgs parameter.  
The agent options are passed as a single string, any additional  
parsing should be performed by the agent itself.

If the agent cannot be resolved (for example, because the agent class  
cannot be loaded, or because the agent class does not have an  
appropriate premain method), the JVM will abort. If a premain method  
throws an uncaught exception, the JVM will abort.


View this message in context:
Sent from the OpenJPA Users mailing list archive at

View raw message