| Summary: | Weaving fails with ClassNotFoundException for already weaved class | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Tassos Bassoukos <abassouk> |
| Component: | Eclipselink | Assignee: | Nobody - feel free to take it <nobody> |
| Status: | CLOSED DUPLICATE | QA Contact: | |
| Severity: | minor | ||
| Priority: | P2 | CC: | tom.ware |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | osgi | ||
Have you looked at the Gemini project? Going forward, our JPA OSGi development will be under Gemini. www.eclipse.org/gemini Setting target and priority. See the following page for the meanings of these fields: http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines Community: Please vote for this bug if it is important to you. Votes are one of the main criteria we use to determine which bugs to fix next. *** This bug has been marked as a duplicate of bug 365385 *** The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |
Build Identifier: 2.3.1.v20111018-r10243 After upgrading to EclipseLink 2.3.1, a specific class could not be weaved with a very strange error: ------------------ SNIP --------------------------- gr.auth.meng.isag.aekk.operations.om.Transportation woven gr.auth.meng.isag.aekk.om.AekkInstallation woven gr.auth.meng.isag.aekk.operations.om.MaterialToTransport woven gr.auth.meng.isag.aekk.operations.om.Quantity woven gr.auth.meng.isag.aekk.operations.om.DemolitionOperation woven [EL Warning]: 2011-11-09 00:16:04.864--ServerSession(1548978993)--Thread(Thread[JPA-Activation,5,main])--Weaver encountered an exception while trying to weave class gr.auth.meng.isag.aekk.operations.om.BaseOperation. The exception was: java.lang.RuntimeException: java.lang.ClassNotFoundException: gr.auth.meng.isag.aekk.operations.om.Transportation ------------------ SNIP --------------------------- However, that class was already woven. Digging further into the innards, the class BaseOperations has a method that contains the following code: ------------------ SNIP --------------------------- for (Iterator<Transportation> it = getTransportation().iterator(); it .hasNext();) { Transportation tr = it.next(); if (tr.getMaterials().size() == 0) it.remove(); } ------------------ SNIP --------------------------- Let's rearrange the code a bit: ------------------ SNIP --------------------------- for (Iterator<Transportation> it = getTransportation().iterator(); it .hasNext();) { if (it.next().getMaterials().size() == 0) it.remove(); } ------------------ SNIP --------------------------- The class now weaves without any issue. This bug also occurs in 2.3.0. It looks like the wrong class loader is used in ASM - stack trace follows: Daemon Thread [JPA-Activation] (Suspended (breakpoint at line 65 in ClassNotFoundException)) ClassNotFoundException.<init>(String) line: 65 ClasspathManager.findLocalClassImpl(String, ClassLoadingStatsHook[]) line: 504 ClasspathManager.findLocalClass_LockClassLoader(String, ClassLoadingStatsHook[]) line: 478 ClasspathManager.findLocalClass(String) line: 458 DefaultClassLoader.findLocalClass(String) line: 216 BundleLoader.findLocalClass(String) line: 400 BundleLoader.findClassInternal(String, boolean, ClassLoader) line: 476 BundleLoader.findClass(String, boolean) line: 429 BundleLoader.findClass(String) line: 417 (this BundleLoader has BundleHost == org.eclipse.persistence.asm_2.3.1.v20111018-r10243) DefaultClassLoader.loadClass(String, boolean) line: 107 DefaultClassLoader(ClassLoader).loadClass(String) line: 247 Class<T>.forName0(String, boolean, ClassLoader) line: not available [native method] Class<T>.forName(String) line: 169 ClassWriter.getCommonSuperClass(String, String) line: not available (it is getCommonSuperclass("gr/auth/meng/isag/aekk/operations/om/Transportation","java/util/Iterator")) ClassWriter.getMergedType(int, int) line: not available Frame.merge(ClassWriter, int, int[], int) line: not available Frame.merge(ClassWriter, Frame, int) line: not available MethodWriter.visitMaxs(int, int) line: not available MethodWeaver(MethodAdapter).visitMaxs(int, int) line: not available MethodWeaver.visitMaxs(int, int) line: 152 ClassReader.accept(ClassVisitor, Attribute[], int) line: not available ClassReader.accept(ClassVisitor, int) line: not available PersistenceWeaver.transform(ClassLoader, String, Class, ProtectionDomain, byte[]) line: 93 (the PersistenceWeawer is called for the BaseOperations class, it's the second parameter) EquinoxWeaver.transform(String, byte[]) line: 40 WeaverRegistry.processClass(String, byte[], ClasspathEntry, BundleEntry, ClasspathManager) line: 80 ClasspathManager.defineClass(String, byte[], ClasspathEntry, BundleEntry, ClassLoadingStatsHook[]) line: 596 ClasspathManager.findClassImpl(String, ClasspathEntry, ClassLoadingStatsHook[]) line: 567 ClasspathManager.findLocalClassImpl(String, ClassLoadingStatsHook[]) line: 490 ClasspathManager.findLocalClass_LockClassLoader(String, ClassLoadingStatsHook[]) line: 478 ClasspathManager.findLocalClass(String) line: 458 DefaultClassLoader.findLocalClass(String) line: 216 BundleLoader.findLocalClass(String) line: 400 BundleLoader.findClassInternal(String, boolean, ClassLoader) line: 476 BundleLoader.findClass(String, boolean) line: 429 BundleLoader.findClass(String) line: 417 DefaultClassLoader.loadClass(String, boolean) line: 107 DefaultClassLoader(ClassLoader).loadClass(String) line: 247 ClassLoader.defineClass1(String, byte[], int, int, ProtectionDomain, String, boolean) line: not available [native method] DefaultClassLoader(ClassLoader).defineClassCond(String, byte[], int, int, ProtectionDomain, boolean) line: 631 DefaultClassLoader(ClassLoader).defineClass(String, byte[], int, int, ProtectionDomain) line: 615 DefaultClassLoader.defineClass(String, byte[], ClasspathEntry, BundleEntry) line: 188 ClasspathManager.defineClass(String, byte[], ClasspathEntry, BundleEntry, ClassLoadingStatsHook[]) line: 601 ClasspathManager.findClassImpl(String, ClasspathEntry, ClassLoadingStatsHook[]) line: 567 ClasspathManager.findLocalClassImpl(String, ClassLoadingStatsHook[]) line: 490 ClasspathManager.findLocalClass_LockClassLoader(String, ClassLoadingStatsHook[]) line: 478 ClasspathManager.findLocalClass(String) line: 458 DefaultClassLoader.findLocalClass(String) line: 216 BundleLoader.findLocalClass(String) line: 400 BundleLoader.findClassInternal(String, boolean, ClassLoader) line: 476 BundleLoader.findClass(String, boolean) line: 429 BundleLoader.findClass(String) line: 417 DependentPolicy.loadClass(String) line: 54 PolicyHandler.doBuddyClassLoading(String) line: 135 BundleLoader.findClassInternal(String, boolean, ClassLoader) line: 501 BundleLoader.findClass(String, boolean) line: 429 BundleLoader.findClass(String) line: 417 DefaultClassLoader.loadClass(String, boolean) line: 107 PersistenceService$PersistenceClassLoader(ClassLoader).loadClass(String, boolean) line: 295 PersistenceService$PersistenceClassLoader(ClassLoader).loadClass(String) line: 247 CompositeClassLoader.loadClass(String) line: 146 Class<T>.forName0(String, boolean, ClassLoader) line: not available [native method] Class<T>.forName(String, boolean, ClassLoader) line: 247 PrivilegedAccessHelper.getClassForName(String, boolean, ClassLoader) line: 119 RelationalDescriptor(ClassDescriptor).convertClassNamesToClasses(ClassLoader) line: 1290 Project.convertClassNamesToClasses(ClassLoader) line: 432 EntityManagerSetupImpl.deploy(ClassLoader, Map) line: 428 EntityManagerFactoryDelegate.getDatabaseSession() line: 188 EntityManagerFactoryDelegate.createEntityManagerImpl(Map) line: 277 EntityManagerFactoryImpl.createEntityManagerImpl(Map) line: 294 EntityManagerFactoryImpl.createEntityManager() line: 272 PersistenceService.testTableSetup() line: 682 PersistenceService$5.addingService(ServiceReference<IWeaver>) line: 617 PersistenceService$5.addingService(ServiceReference) line: 1 ServiceTracker$Tracked.customizerAdding(ServiceReference, ServiceEvent) line: 980 ServiceTracker$Tracked.customizerAdding(Object, Object) line: 1 ServiceTracker$Tracked(AbstractTracked).trackAdding(Object, Object) line: 262 ServiceTracker$Tracked(AbstractTracked).trackInitial() line: 185 ServiceTracker.open(boolean) line: 348 ServiceTracker.open() line: 283 PersistenceService.waitForWeaver(Map<String,Set<String>>) line: 625 PersistenceService$4.run() line: 555 Thread.run() line: 662 Reproducible: Always Steps to Reproduce: I haven't yet fully explored the phase space, and a minimal test case is still a ways off...