Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 356661 - Internal Exception: java.lang.ClassNotFoundException: java/lang/String in MetadataHelper
Summary: Internal Exception: java.lang.ClassNotFoundException: java/lang/String in Met...
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P2 normal with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-03 06:15 EDT by Christoph Laeubrich CLA
Modified: 2022-06-09 10:23 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Laeubrich CLA 2011-09-03 06:15:54 EDT
Build Identifier: 2.3.0.v20110604-r9504

I recently tried to port some persisted classes from hibernate (with JPA2.0 annotations) to eclipse link and encountered the following error, another procejt with just one simple test entity works fine. Except the stacktrace everything works fine, object could be persisted/loaded:

javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [berichtgenerator] failed.
Internal Exception: Exception [EclipseLink-7156] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Unable to find the class named [java.lang.String]. Ensure the class name/path is correct and available to the classloader.
Internal Exception: java.lang.ClassNotFoundException: java/lang/String
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1385)
	at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.callPredeploy(JPAInitializer.java:98)
	at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.initPersistenceUnits(JPAInitializer.java:306)
	at org.eclipse.gemini.jpa.provider.GeminiOSGiInitializer.initializeFromBundle(GeminiOSGiInitializer.java:119)
	at org.eclipse.gemini.jpa.provider.EclipseLinkOSGiProvider.assignPersistenceUnitsInBundle(EclipseLinkOSGiProvider.java:191)
	at org.eclipse.gemini.jpa.PersistenceBundleExtender.tryAssigningPersistenceUnitsInBundle(PersistenceBundleExtender.java:172)
	at org.eclipse.gemini.jpa.PersistenceBundleExtender.bundleChanged(PersistenceBundleExtender.java:314)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:847)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
	at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEventPrivileged(Framework.java:1522)
	at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1458)
	at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1453)
	at org.eclipse.osgi.framework.internal.core.PackageAdminImpl.processDelta(PackageAdminImpl.java:485)
	at org.eclipse.osgi.framework.internal.core.PackageAdminImpl.doResolveBundles(PackageAdminImpl.java:251)
	at org.eclipse.osgi.framework.internal.core.PackageAdminImpl$1.run(PackageAdminImpl.java:173)
	at java.lang.Thread.run(Thread.java:662)
Caused by: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [berichtgenerator] failed.
Internal Exception: Exception [EclipseLink-7156] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Unable to find the class named [java.lang.String]. Ensure the class name/path is correct and available to the classloader.
Internal Exception: java.lang.ClassNotFoundException: java/lang/String
	at org.eclipse.persistence.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:221)
	... 17 more
Caused by: Exception [EclipseLink-7156] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Unable to find the class named [java.lang.String]. Ensure the class name/path is correct and available to the classloader.
Internal Exception: java.lang.ClassNotFoundException: java/lang/String
	at org.eclipse.persistence.exceptions.ValidationException.unableToLoadClass(ValidationException.java:1949)
	at org.eclipse.persistence.internal.jpa.metadata.MetadataHelper.getClassForName(MetadataHelper.java:111)
	at org.eclipse.persistence.internal.jpa.metadata.ORMetadata.getJavaClass(ORMetadata.java:273)
	at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.DirectCollectionAccessor.processDirectMapMapping(DirectCollectionAccessor.java:446)
	at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.ElementCollectionAccessor.process(ElementCollectionAccessor.java:737)
	at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processDirectCollectionAccessors(MetadataProject.java:1388)
	at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processStage3(MetadataProject.java:1659)
	at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.processORMMetadata(MetadataProcessor.java:521)
	at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:526)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1320)
	... 16 more
Caused by: java.lang.ClassNotFoundException: java/lang/String
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:247)
	at org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getClassForName(PrivilegedAccessHelper.java:119)
	at org.eclipse.persistence.internal.jpa.metadata.MetadataHelper.getClassForName(MetadataHelper.java:97)
	... 24 more

Reproducible: Always

Steps to Reproduce:
N/A habens on one project all the time, does not happens on another one
Comment 1 Tom Ware CLA 2011-09-06 08:14:01 EDT
It looks like this is happening on an ElementCollection that is a Map. Can you narrow down which one is the problem and provide the mapping information for it? (i.e. annotations, orm.xml, and definition)
Comment 2 Christoph Laeubrich CLA 2011-09-06 12:40:29 EDT
(In reply to comment #1)
> It looks like this is happening on an ElementCollection that is a Map. Can you
> narrow down which one is the problem and provide the mapping information for
> it? (i.e. annotations, orm.xml, and definition)

I have just one file containing Element Collection, the file looks like this:

@Table(name = "Literatur")
@Entity
public class Literatur extends PersitentBase {
    @ElementCollection(fetch = FetchType.EAGER)
    @Column(name = "fields")
    private final Map<String, String> fields = new HashMap<String, String>();

    private String                    name;

    private String                    typ;

    private long                      bibliothek_id;

[... getter and setter ...]
}

@MappedSuperclass
public class PersitentBase {
    @Version
    private long version;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;

[... getter and setter ...]
}

persistence.xml:
<persistence version="1.0"
    xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
    <persistence-unit name="berichtgenerator"
        transaction-type="RESOURCE_LOCAL">
        <class>de.laeubisoft.berichtgenerator.storage.db.dao.Literatur</class>
<class>de.laeubisoft.berichtgenerator.storage.db.dao.PersitentBase</class>

[... other classes ...]

        <exclude-unlisted-classes>true</exclude-unlisted-classes>
        <properties>
            <property name="eclipselink.target-database" value="MySQL"/>
            <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/test" />
            <property name="javax.persistence.jdbc.driver"
                value="com.mysql.jdbc.Driver" />
            <property name="javax.persistence.jdbc.user" value="root" />
            <property name="javax.persistence.jdbc.password"
                value="" />
            <property name="eclipselink.weaving" value="false"/>
        </properties>
    </persistence-unit>
</persistence>
Comment 3 Tom Ware CLA 2011-09-09 09:16:55 EDT
where are you deploying?  application server?  which one?  How is EclipseLink made available?  How is your application packaged?
Comment 4 Christoph Laeubrich CLA 2011-09-09 12:57:18 EDT
(In reply to comment #3)
> where are you deploying?  application server?  which one?  How is EclipseLink
> made available?  How is your application packaged?

The application is deployed inside an Equinox OSGi framework using the JPA Service provided with Eclipse Gemini.

I'm currently launching the application from within the Eclipse IDE.
Comment 5 Tom Ware CLA 2011-09-22 11:36:52 EDT
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.
Comment 6 Eclipse Webmaster CLA 2022-06-09 10:14:28 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 7 Eclipse Webmaster CLA 2022-06-09 10:23:41 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink