You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Frederic Jeanneau (JIRA)" <ji...@apache.org> on 2007/08/16 16:13:30 UTC

[jira] Updated: (OPENJPA-318) Auto-enhancement within a Web Application

     [ https://issues.apache.org/jira/browse/OPENJPA-318?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Frederic Jeanneau updated OPENJPA-318:
--------------------------------------

    Description: 
Hello.
I'm still french, so excuse my english one more time.

I have a problem while trying to persist a very simple object, within a web application.
With a web form I create an object, and then the web app try to persist it.

The EntityManager is loaded for the first object I have to persist, not at the loading of the server, but only when I first try to persist an object. (For the other objects, the EntityManager will be loaded yet).

I have just a message with a number and a text.
My Message class is :

@Entity
@Inheritance (strategy = InheritanceType.TABLE_PER_CLASS)
@Table(name = "MESG")
@Id
@Column(name = "NUM_MESG", nullable = false, length = 10)
@Basic
@Column(name = "TXT_MESG", nullable = false, length = 60)

The table is created, but when I send an object to the EntityManager, it fails, because :

Attempt to cast instance "2 [mesobjets.Message]" to PersistenceCapable failed.  Ensure that it has been enhanced.


I tried to launch the server whith -the javaagent argument, but the launching fail, because :

java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/lang/exception/NestableRuntimeException
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(Unknown Source)
	at java.security.SecureClassLoader.defineClass(Unknown Source)
	at java.net.URLClassLoader.defineClass(Unknown Source)
	at java.net.URLClassLoader.access$100(Unknown Source)
	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)
	at org.apache.openjpa.enhance.PCEnhancerAgent.premain(PCEnhancerAgent.java:47)
	... 5 more
FATAL ERROR in native method: processing of -javaagent failed


So, if someone know how to auto-enhance on a server, I'm waiting for their ideas, and i'm still trying to solve the problem. Thanks for your help

  was:
Hello.
I'm still french, so excuse my english one more time.

I have a problem while trying to persist a very simple object, within a web application.
With a web form I create an object, and then the web app try to persist it.

I have just a message with a number and a text.
My Message class is :

@Entity
@Inheritance (strategy = InheritanceType.TABLE_PER_CLASS)
@Table(name = "MESG")
@Id
@Column(name = "NUM_MESG", nullable = false, length = 10)
@Basic
@Column(name = "TXT_MESG", nullable = false, length = 60)

The table is created, but when I send an object to the EntityManager, it fails, because :

Attempt to cast instance "2 [mesobjets.Message]" to PersistenceCapable failed.  Ensure that it has been enhanced.


I tried to launch the server whith -the javaagent argument, but the launching fail, because :

java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/lang/exception/NestableRuntimeException
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(Unknown Source)
	at java.security.SecureClassLoader.defineClass(Unknown Source)
	at java.net.URLClassLoader.defineClass(Unknown Source)
	at java.net.URLClassLoader.access$100(Unknown Source)
	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)
	at org.apache.openjpa.enhance.PCEnhancerAgent.premain(PCEnhancerAgent.java:47)
	... 5 more
FATAL ERROR in native method: processing of -javaagent failed


So, if someone know how to auto-enhance on a server, I'm waiting for their ideas, and i'm still trying to solve the problem. Thanks for your help


> Auto-enhancement within a Web Application
> -----------------------------------------
>
>                 Key: OPENJPA-318
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-318
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc, jpa, sql
>    Affects Versions: 0.9.7
>         Environment: Java JRE 1.5
> OpenJPA 0.9.7
> IDE Eclipse
> Tomcat 5.0
> MySQL 4.1.9 DataBase (EasyPhp 1.8.0.1)
>            Reporter: Frederic Jeanneau
>
> Hello.
> I'm still french, so excuse my english one more time.
> I have a problem while trying to persist a very simple object, within a web application.
> With a web form I create an object, and then the web app try to persist it.
> The EntityManager is loaded for the first object I have to persist, not at the loading of the server, but only when I first try to persist an object. (For the other objects, the EntityManager will be loaded yet).
> I have just a message with a number and a text.
> My Message class is :
> @Entity
> @Inheritance (strategy = InheritanceType.TABLE_PER_CLASS)
> @Table(name = "MESG")
> @Id
> @Column(name = "NUM_MESG", nullable = false, length = 10)
> @Basic
> @Column(name = "TXT_MESG", nullable = false, length = 60)
> The table is created, but when I send an object to the EntityManager, it fails, because :
> Attempt to cast instance "2 [mesobjets.Message]" to PersistenceCapable failed.  Ensure that it has been enhanced.
> I tried to launch the server whith -the javaagent argument, but the launching fail, because :
> java.lang.reflect.InvocationTargetException
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> 	at java.lang.reflect.Method.invoke(Unknown Source)
> 	at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(Unknown Source)
> Caused by: java.lang.NoClassDefFoundError: org/apache/commons/lang/exception/NestableRuntimeException
> 	at java.lang.ClassLoader.defineClass1(Native Method)
> 	at java.lang.ClassLoader.defineClass(Unknown Source)
> 	at java.security.SecureClassLoader.defineClass(Unknown Source)
> 	at java.net.URLClassLoader.defineClass(Unknown Source)
> 	at java.net.URLClassLoader.access$100(Unknown Source)
> 	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)
> 	at org.apache.openjpa.enhance.PCEnhancerAgent.premain(PCEnhancerAgent.java:47)
> 	... 5 more
> FATAL ERROR in native method: processing of -javaagent failed
> So, if someone know how to auto-enhance on a server, I'm waiting for their ideas, and i'm still trying to solve the problem. Thanks for your help

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.