Absent Member.
Absent Member.
2612 views

DevPartner Java Edition -- DPJ Version 4.4 with TestNG

[Migrated content. Thread originally posted on 23 February 2011]

Hi

I am using DevPartner for Java Version 4.4 with TestNG for unit testing.
This is the extract of my Ant script.

<testng outputdir="${basedir}/test-report">
<!-- call devPartner -->
<jvmarg line="-agentlib:dpjJvmtiCore=NM_ANALYSIS_TYPE=memory,NM_CONFIG_NAME=test"/>

<classpath refid="test.path"/>
<xmlfileset dir="${test.dir}" includes="*Test.xml"/>
</testng>

However, I will get the following error msg:

START OF ERROR MSG

ERROR [org.hibernate.proxy.pojo.BasicLazyInitializer] Javassist Enhancement failed: com.auction.model.SlideShow
java.lang.VerifyError: (class: com/auction/model/SlideShow_$$_javassist_16, method: <clinit> signature: ()V) Accessing value from uninitialized register 0
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
at java.lang.Class.getField0(Class.java:2618)
at java.lang.Class.getField(Class.java:1518)
at javassist.util.proxy.ProxyFactory.setField(ProxyFactory.java:350)
at javassist.util.proxy.ProxyFactory.createClass3(ProxyFactory.java:339)
at javassist.util.proxy.ProxyFactory.createClass2(ProxyFactory.java:312)
at javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:271)
at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.getProxyFactory(JavassistLazyInitializer.java:162)
at org.hibernate.proxy.pojo.javassist.JavassistProxyFactory.postInstantiate(JavassistProxyFactory.java:66)
at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:183)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:158)
at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:76)
at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:80)
at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:325)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:457)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:131)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:84)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:261)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)
at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:259)
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.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:56)
at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:110)
at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:214)
at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:45)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:108)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:69)
at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:221)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.installAction(KernelControllerContextAction.java:135)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.installAction(KernelControllerContextAction.java:46)
at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:327)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1309)
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:734)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:862)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:784)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:574)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:398)
at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:96)
at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:90)
at org.jboss.ejb3.MCKernelAbstraction.install(MCKernelAbstraction.java:151)
at org.jboss.ejb3.Ejb3Deployment.startPersistenceUnits(Ejb3Deployment.java:604)
at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:400)
at org.jboss.ejb3.deployers.EJBStage2Deployer.deploy(EJBStage2Deployer.java:53)
at org.jboss.ejb3.deployers.EJBStage2Deployer.deploy(EJBStage2Deployer.java:37)
at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:65)
at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:169)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:853)
at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:794)
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:327)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1309)
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:734)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:862)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:784)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:622)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:411)
at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:498)
at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:506)
at org.jboss.embedded.DeploymentGroup.process(DeploymentGroup.java:127)
at org.jboss.embedded.Bootstrap.deployResourceBases(Bootstrap.java:289)
at org.jboss.seam.mock.EmbeddedBootstrap.startAndDeployResources(EmbeddedBootstrap.java:15)
at org.jboss.seam.mock.AbstractSeamTest.startJbossEmbeddedIfNecessary(AbstractSeamTest.java:1024)
at org.jboss.seam.mock.AbstractSeamTest.startSeam(AbstractSeamTest.java:915)
at org.jboss.seam.mock.SeamTest.startSeam(SeamTest.java:58)
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.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:607)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:417)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:154)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:88)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:284)
at org.testng.SuiteRunner.run(SuiteRunner.java:204)
at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:877)
at org.testng.TestNG.runSuitesLocally(TestNG.java:842)
at org.testng.TestNG.run(TestNG.java:751)
at org.testng.TestNG.privateMain(TestNG.java:914)
at org.testng.TestNG.main(TestNG.java:887)

===============================================
Suite1
Total tests run: 1, Failures: 1, Skips: 0
===============================================

GetClassHookParameters: Found java/lang/Object

END OF ERROR MSG

I am running TestNG on a project that is using Seam 2.2.0GA + Hiberate 3.3.0GA.
Since the last line of exection in the error message points to an native (C++) object.
at java.lang.Class.getDeclaredFields0(Native Method)

The problem seems to be when Hibernate attempt to read the properties of the entity POJO using Java reflection.

Any idea or suggestion on how I may proceed?

Much appreciated!
Thank you for reading this long post.

0 Likes
3 Replies
Absent Member.
Absent Member.

Hi John,

First let me thank you for using DevPartner Java.

From just looking at your call stack, it seems to me that DPJ may be having some issues with the LazyInitialization of Classes. DPJ uses its own runtime bytecode instrumentation to provide you with the results showing you the amount of memory and how it is being used in your application. The first thing that I would try is turning off the LazyInitialization in your application by setting the attribute in your entities and/or collections. If this does not work for you, I would please ask that you open a support ticket with our customer care so that we can dig deeper into your particular issue. We will have a better chance of fixing the problem if you can provide us with some sample code that will allow us to reproduce the issue in house.

Thank you again and we look forward to working with you.
0 Likes
Absent Member.
Absent Member.

Hi Jeff

Thank you for your reply. I have tried out your suggestion to turn off hibernate lazy initialization for testing.
However I get the actual same error.
I edited the persistent-test.xml to be

....



I discover a work around. If I add "-noverify" to the java arg, I can get test suite running.
I tried the various options of the DevParner analysis type options: coverage, performance and memory.
For options coverage and performance, the test suite runs.
However for memory option, the test suite “hangs”.

I do not know if the profiling results will be affected by the JVM opts "-noverify". The java doc says that noverify turns off the class verification
0 Likes
Absent Member.
Absent Member.

John,

Thanks for posting your issue on the forum. This appears to be a product compatibility issue best handled within routine Customer Care. I ask that you file a case and supply a reproducible test as Jeff has requested. Although we want people to use the forum to ask questions, in this case, you will need to work with a Customer Care engineer to supply a test case for Engineering to work through. We will certainly post a final resolution to the forum in case a workaround, patch, or new build is made available that addresses the root cause of the issue, but we do not wish to have all the triage requests and testing volleys aired within the forum. Please move those intermediate communications to Supportline. Thanks. Matt Schuetze
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.