cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Neil Rutherford (JIRA)" <j...@apache.org>
Subject [jira] Created: (CAY-1192) NoClassDefFoundError while loading JPA entity classes on Windows
Date Thu, 12 Mar 2009 12:41:16 GMT
NoClassDefFoundError while loading JPA entity classes on Windows
----------------------------------------------------------------

                 Key: CAY-1192
                 URL: https://issues.apache.org/cayenne/browse/CAY-1192
             Project: Cayenne
          Issue Type: Bug
          Components: Cayenne JPA
    Affects Versions: 3.0M5
         Environment: MS Windows XP
Eclipse 3.4.1
JDK 1.5.08
            Reporter: Neil Rutherford
         Attachments: patch.diff

While running a test app with 1 entity from inside Eclipse I get the below exception:

2009/03/12 02:17:03 org.apache.cayenne.jpa.Provider createEntityManagerFactory
INFO: Extra PersistenceUnitInfo properties: {}
Exception in thread "main" java.lang.NoClassDefFoundError: test\entities\Transaction (wrong
name: test/entities/Transaction)
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:465)
	at org.apache.cayenne.jpa.JpaUnitClassLoader.findClass(JpaUnitClassLoader.java:83)
	at org.apache.cayenne.jpa.JpaUnitClassLoader.loadClass(JpaUnitClassLoader.java:49)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:242)
	at org.apache.cayenne.jpa.conf.EntityMapLoader.loadFromAnnotations(EntityMapLoader.java:249)
	at org.apache.cayenne.jpa.conf.EntityMapLoader.loadEntityMap(EntityMapLoader.java:112)
	at org.apache.cayenne.jpa.conf.EntityMapLoader.<init>(EntityMapLoader.java:88)
	at org.apache.cayenne.jpa.Provider.createContainerEntityManagerFactory(Provider.java:224)
	at org.apache.cayenne.jpa.Provider.createEntityManagerFactory(Provider.java:194)
	at javax.persistence.Persistence.createFactory(Persistence.java:171)
	at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:111)
	at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:65)
	at Main.main(Main.java:36)

This seems to be caused by this line in org.apache.cayenne.jpa.conf.EntityMapLoader (inside
locateClassesInFolder(File,...):

classes.add(absPath.substring(
                                    rootPathLength,
                                    absPath.length() - suffixLen).replace('/', '.'));

because on Windows the path separator is a '\\', replacing the '/' with File.separatorChar
fixes my problem.


-- 
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