codeconsole commented on PR #15650:
URL: https://github.com/apache/grails-core/pull/15650#issuecomment-4436758567

   > @codeconsole `grails-datastore-core` is pulling in 
`org.javassist:javassist`. How come you don't get that dependency on your apps 
runtime classpath?
   
   @matrei good find, thanks
   
   Here was the issue
   
   ```gradle
   configurations {
       all {
           exclude group: "org.apache.grails.data", module: 
"grails-datastore-core"
           exclude group: "org.apache.grails.data", module: 
"grails-data-mongodb-bson"
           exclude group: "org.apache.grails.data", module: 
"grails-data-mongodb-core"
       }
   }
   
   List<String> extLibs = [
       'lib/grails-datastore-core-7.1.1-SNAPSHOT.jar',
       'lib/grails-data-mongodb-bson-7.1.1-SNAPSHOT.jar',
       'lib/grails-data-mongodb-core-7.1.1-SNAPSHOT.jar'
   }
   ```
   
   I wasn't resolving `org.javassist:javassist` because I was running a custom 
datastore-core, but the issue still stands that this fails when javaassist is 
not in the class path.
   
   
   `AbstractMappingContext.getProxyFactory()` picks the proxy implementation by 
classpath probe:
   ```java
   if (ClassUtils.isPresent("javassist.util.proxy.ProxyFactory", classLoader)) {
       proxyFactory = DefaultProxyFactoryCreator.create();      // → 
JavassistProxyFactory
   }
   else if 
(ClassUtils.isPresent("org.grails.datastore.gorm.proxy.GroovyProxyFactory", 
...)) {
       proxyFactory = new GroovyProxyFactory();                 // ← fallback 
which results in failure
   }
   ```
   
   So the question is do we want to address the edge case when javassist is not 
in the class path even though it is a transitive dependency of 
`grails-datastore-core` ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to