Author: tveronezi
Date: Thu Mar 17 18:38:34 2011
New Revision: 1082629

URL: http://svn.apache.org/viewvc?rev=1082629&view=rev
Log:
The server was not loading the EntityBeans.

Changes: 

* ReadDescriptors: line 108 -> The PersistenceModule class uses the moduleName 
as rootUrl. The system was throwing an IllegalArgumentException due to the 
invalid url created by the "getAbsolutePath" method call.

* PersistenceUnitInfoImpl: line 208 -> Just for safety I keep the old way to 
create the root object on the "catch" block.

Modified:
    
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java
    
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/persistence/PersistenceUnitInfoImpl.java

Modified: 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java?rev=1082629&r1=1082628&r2=1082629&view=diff
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java
 (original)
+++ 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java
 Thu Mar 17 18:38:34 2011
@@ -105,8 +105,8 @@ public class ReadDescriptors implements 
                 if (file.getName().endsWith("persistence.xml")) {
                     file = file.getParentFile().getParentFile();
                 }
-                String moduleName = file.getAbsolutePath();
-                
+                String moduleName = file.toURI().toString();
+
                 try {
                     Persistence persistence = 
JaxbPersistenceFactory.getPersistence(persistenceUrl);
                     PersistenceModule persistenceModule = new 
PersistenceModule(moduleName, persistence);
@@ -538,7 +538,7 @@ public class ReadDescriptors implements 
         }
         return tldTaglib;
     }
-    
+
     public static FacesConfig readFacesConfig(URL url) throws OpenEJBException 
{
         FacesConfig facesConfig;
         try {

Modified: 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/persistence/PersistenceUnitInfoImpl.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/persistence/PersistenceUnitInfoImpl.java?rev=1082629&r1=1082628&r2=1082629&view=diff
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/persistence/PersistenceUnitInfoImpl.java
 (original)
+++ 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/persistence/PersistenceUnitInfoImpl.java
 Thu Mar 17 18:38:34 2011
@@ -20,6 +20,7 @@ package org.apache.openejb.persistence;
 import java.lang.instrument.ClassFileTransformer;
 import java.lang.instrument.IllegalClassFormatException;
 import java.net.MalformedURLException;
+import java.net.URI;
 import java.net.URL;
 import java.net.URISyntaxException;
 import java.security.ProtectionDomain;
@@ -109,14 +110,14 @@ public class PersistenceUnitInfoImpl imp
      * Class loader used by JPA to load Entity classes.
      */
     private ClassLoader classLoader;
-    
+
     // JPA 2.0
     /** Schema version of the persistence.xml file */
     private String persistenceXMLSchemaVersion;
-    
+
     /** Second-level cache mode for the persistence unit */
     private SharedCacheMode sharedCacheMode;
-    
+
     /** The validation mode to be used for the persistence unit */
     private ValidationMode validationMode;
 
@@ -204,7 +205,13 @@ public class PersistenceUnitInfoImpl imp
     }
 
     public void setRootUrlAndJarUrls(String persistenceUnitRootUrl, 
List<String> jarFiles) throws MalformedURLException {
-        File root = new File(persistenceUnitRootUrl);
+        File root;
+        try{
+            final URI rootUri = URI.create(persistenceUnitRootUrl);
+            root = new File(rootUri);
+        } catch (IllegalArgumentException e) {
+            root = new File(persistenceUnitRootUrl);
+        }
 
         this.persistenceUnitRootUrl = toUrl(root);
         try {
@@ -317,7 +324,7 @@ public class PersistenceUnitInfoImpl imp
     public SharedCacheMode getSharedCacheMode() {
         return this.sharedCacheMode;
     }
-    
+
     /**
      * @param sharedCacheMode the sharedCacheMode to set
      */
@@ -338,5 +345,5 @@ public class PersistenceUnitInfoImpl imp
     public void setValidationMode(ValidationMode validationMode) {
         this.validationMode = validationMode;
     }
-    
+
 }


Reply via email to