openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jody Grassel (JIRA)" <j...@apache.org>
Subject [jira] Commented: (OPENJPA-1790) java.lang.VerifyError thrown when trying to commit entity.
Date Tue, 21 Sep 2010 19:12:32 GMT

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

Jody Grassel commented on OPENJPA-1790:
---------------------------------------

It turns out that the problem is with the way OpenJPA extends a Map type to implement Proxy
and ProxyMap during runtime with the ProxyManagerImpl when the type of the map is a ConcurrentMap
type, in Kai's case it is ConcurrentHashMap.  ConcurrentMap defines a method "boolean replace(Object,
Object)" -- the very method that is in the reported Exception:

java.lang.VerifyError: (class: org/apache/openjpa/util/java$util$concurrent$ConcurrentHashMap$11$proxy,
method: remove signature: (Ljava/lang/Object;Ljava/lang/Object;)Z) Expecting to find integer
on stack 

After researching more on the VerifyError, it looks like the version of remove (remove methods
are considered to be setter methods by  ProxyManagerImpl.isSetter()) is wrappered by ProxyManagerImpl.proxySetter().
 And while it looks like proxySetter() is taking care to ensure the return type is preserved,
the VerifyError suggests the bytecode is trying to return an object of type integer instead.

I've reproduced this problem with a junit test, all that needed to be done was to initialize
a relationship field of type Map with a ConcurrentHashMap, and the Exception surfaced during
transaction commit:

  <testcase time="0.158" classname="org.apache.openjpa.persistence.relations.TestConcurrentMap"
name="testConcurrentMap001">
    <error message="(class: org/apache/openjpa/util/java$util$concurrent$ConcurrentHashMap$1$proxy,
method: remove signature: (Ljava/lang/Object;Ljava/lang/Object;)Z) Expecting to find integer
on stack" type="java.lang.VerifyError">java.lang.VerifyError: (class: org/apache/openjpa/util/java$util$concurrent$ConcurrentHashMap$1$proxy,
method: remove signature: (Ljava/lang/Object;Ljava/lang/Object;)Z) Expecting to find integer
on stack
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:247)
	at org.apache.openjpa.util.GeneratedClasses.loadBCClass(GeneratedClasses.java:71)
	at org.apache.openjpa.util.ProxyManagerImpl.getFactoryProxyMap(ProxyManagerImpl.java:382)
	at org.apache.openjpa.util.ProxyManagerImpl.newMapProxy(ProxyManagerImpl.java:207)
	at org.apache.openjpa.kernel.StateManagerImpl.newFieldProxy(StateManagerImpl.java:1829)
	at org.apache.openjpa.kernel.SingleFieldManager.proxy(SingleFieldManager.java:117)
	at org.apache.openjpa.kernel.StateManagerImpl.proxyFields(StateManagerImpl.java:2896)
	at org.apache.openjpa.kernel.PNonTransState.initialize(PNonTransState.java:45)
	at org.apache.openjpa.kernel.StateManagerImpl.setPCState(StateManagerImpl.java:287)
	at org.apache.openjpa.kernel.StateManagerImpl.commit(StateManagerImpl.java:1128)
	at org.apache.openjpa.kernel.BrokerImpl.endTransaction(BrokerImpl.java:2383)
	at org.apache.openjpa.kernel.BrokerImpl.afterCompletion(BrokerImpl.java:1975)
	at org.apache.openjpa.kernel.LocalManagedRuntime.commit(LocalManagedRuntime.java:94)
	at org.apache.openjpa.kernel.BrokerImpl.commit(BrokerImpl.java:1479)
	at org.apache.openjpa.kernel.DelegatingBroker.commit(DelegatingBroker.java:925)
	at org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:560)
	at org.apache.openjpa.persistence.relations.TestConcurrentMap.testConcurrentMap001(TestConcurrentMap.java:46)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at junit.framework.TestCase.runTest(TestCase.java:154)
	at org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.runTest(AbstractPersistenceTestCase.java:516)

This junit should provide a baseline with developing a fix for this problem.

> java.lang.VerifyError thrown when trying to commit entity.
> ----------------------------------------------------------
>
>                 Key: OPENJPA-1790
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1790
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 2.0.1
>         Environment: JDK1.6 u20, maven 2.2.1, Apache Shindig 2.0, OpenJPA 2.0.1
>            Reporter: Kai Feng Zhang
>            Assignee: Jody Grassel
>            Priority: Critical
>         Attachments: concurrent_junit.patch, persistence.xml, PersonServiceDbTest.java,
pom.xml, SpiDatabaseBootstrap.java
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Hi,
> Now I am working on OpenJPA support for Apache Shindig 2.0. There is a test case to insert
some entity into backend derby database, but every time when running to commint(), there 
is such error thrown, unfortunately I am not to work it out, and ask here if this is a known
issue? Thanks.
> I searched an issue past of: https://issues.apache.org/jira/browse/OPENJPA-91, and tried
to put all openjpa related jars into jdk/jre/lib/ext, but it does not work for.
> In DOS cmd line or in eclipse IDE, I run the junit test case with jdk 1.6, both  returning
same error:
> -------------------------------------------------------------------------------
> Test set: org.apache.shindig.social.opensocial.jpa.spi.PersonServiceDbTest
> -------------------------------------------------------------------------------
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.391 sec <<<
FAILURE!
> org.apache.shindig.social.opensocial.jpa.spi.PersonServiceDbTest  Time elapsed: 0.438
sec  <<< ERROR!
> java.lang.VerifyError: (class: org/apache/openjpa/util/java$util$concurrent$ConcurrentHashMap$11$proxy,
method: remove signature: (Ljava/lang/Object;Ljava/lang/Object;)Z) Expecting to find integer
on stack
> 	at java.lang.Class.forName0(Native Method)
> 	at java.lang.Class.forName(Class.java:247)
> 	at org.apache.openjpa.util.GeneratedClasses.loadBCClass(GeneratedClasses.java:67)
> 	at org.apache.openjpa.util.ProxyManagerImpl.getFactoryProxyMap(ProxyManagerImpl.java:382)
> 	at org.apache.openjpa.util.ProxyManagerImpl.newMapProxy(ProxyManagerImpl.java:207)
> 	at org.apache.openjpa.kernel.StateManagerImpl.newFieldProxy(StateManagerImpl.java:1829)
> 	at org.apache.openjpa.kernel.SingleFieldManager.proxy(SingleFieldManager.java:117)
> 	at org.apache.openjpa.kernel.StateManagerImpl.proxyFields(StateManagerImpl.java:2896)
> 	at org.apache.openjpa.kernel.PNonTransState.initialize(PNonTransState.java:45)
> 	at org.apache.openjpa.kernel.StateManagerImpl.setPCState(StateManagerImpl.java:287)
> 	at org.apache.openjpa.kernel.StateManagerImpl.commit(StateManagerImpl.java:1128)
> 	at org.apache.openjpa.kernel.BrokerImpl.endTransaction(BrokerImpl.java:2383)
> 	at org.apache.openjpa.kernel.BrokerImpl.afterCompletion(BrokerImpl.java:1975)
> 	at org.apache.openjpa.kernel.LocalManagedRuntime.commit(LocalManagedRuntime.java:94)
> 	at org.apache.openjpa.kernel.BrokerImpl.commit(BrokerImpl.java:1479)
> 	at org.apache.openjpa.kernel.DelegatingBroker.commit(DelegatingBroker.java:925)
> 	at org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:560)
> 	at org.apache.shindig.social.opensocial.jpa.spi.SpiDatabaseBootstrap.bootstrapDatabase(SpiDatabaseBootstrap.java:186)
> 	at org.apache.shindig.social.opensocial.jpa.spi.SpiDatabaseBootstrap.init(SpiDatabaseBootstrap.java:85)
> 	at org.apache.shindig.social.opensocial.jpa.spi.PersonServiceDbTest.setup(PersonServiceDbTest.java:71)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
> 	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
> 	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
> 	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
> 	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
> 	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
> 	at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
> 	at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
> 	at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
> 	at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
> 	at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)

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


Mime
View raw message