[ 
https://issues.apache.org/jira/browse/OPENJPA-1976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13018738#comment-13018738
 ] 

Chuong Pham commented on OPENJPA-1976:
--------------------------------------

The error "java.lang.IllegalStateException: WEB9031" relates to a problem with 
the OpenJPA enhancer (See Issue 1410 at 
https://issues.apache.org/jira/browse/OPENJPA-1410%3E). When you execute Sun's 
JDK the OpenJPA's dynamic enhancer starts by default. This action, in turn, 
stuffs up Glassfish's classloader class - hence, the "WEB9031" error.

For those who experience this same issue, a simple workaround is to do the 
enhancement at build time - which I did in ANT with 
`org.apache.openjpa.ant.PCEnhancerTask` - and add this property to your 
"persistence.xml" to shut off the dynamic enhancer: "<property 
name="openjpa.DynamicEnhancementAgent" value="false"/>".

Also, it wouldn't hurt to throw this in your "persistence.xml" as well 
"<property name="openjpa.RuntimeUnenhancedClasses" value="unsupported" />".

> EntityManager.find method cause errors
> --------------------------------------
>
>                 Key: OPENJPA-1976
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1976
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>    Affects Versions: 2.1.0
>         Environment: Glassfish 3.1, JSF 2.1.0, Apache OpenJPA 2.1.0, MySQL 
> 5.5.10, Eclipse Helios IDE, Windows XP Service Pack 3
>            Reporter: Chuong Pham
>            Assignee: Rick Curtis
>              Labels: features, test
>         Attachments: ENTITY.txt, SCENARIO 1 STACKTRACE.txt, SCENARIO 2 
> STACKTRACE.txt
>
>
> Scenario 1: The EntityManager.find method is unable to pass a String value as 
> its second parameter and caused the following error:
> <openjpa-2.1.0-r422266:1071316 nonfatal user error> 
> org.apache.openjpa.persistence.ArgumentException: The given value 
> "214736890D96ED598E1D3050F1F025A7" cannot be converted into an identity for 
> "com.ckd.model.BookModel".  The value is the wrong type (java.lang.String).
> java.lang.NumberFormatException: For input string: 
> "214736890D96ED598E1D3050F1F025A7"
> It seems from the errors above that the EntityManager.find method will only 
> accept a numeric value as its second parameter.
> Scenario 2: The EntityManager.find method is unable to pass a Long value and 
> caused the following error:
> <openjpa-2.1.0-r422266:1071316 fatal user error> 
> org.apache.openjpa.persistence.ArgumentException: An error occurred while 
> processing registered class "class com.ckd.model.BookModel".
> java.lang.IllegalStateException: WEB9031: WebappClassLoader unable to load 
> resource [org.apache.openjpa.util.LongId], because it has not yet been 
> started, or was already stopped
> The columns used for testing are from a MySQL 5.x table and have the 
> following definitions:
> ID SMALLINT(5)
> HASHID VARCHAR(32)
> The value of HASHID is used to test Scenario 1; while the value of ID is used 
> to test Scenario 2.
> Conclusion: The above scenarios show that the EntityManager.find method is 
> currently unusable/buggy and needs to be investigated for the next release.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to