On 13 Feb 2014, at 07:28, Kristian Rosenvold <kristian.rosenv...@gmail.com> 
wrote:

> Stuart,
> 
> We're seeing java.lang.LinkageError: loader constraint violation: loader
> (instance of org/codehaus/plexus/classworlds/realm/ClassRealm) previously
> initiated loading for a different type with name
> "javax/enterprise/util/TypeLiteral" using the maven-jetty-plugin on 3.1. I
> can't really see this seeping through in DefaultClassRealmManager, but
> google shows me https://java.net/jira/browse/GLASSFISH-20802
> 
> Is this something you understand ?

DefaultClassRealmManager currently exposes the complete javax.enterprise.inject 
package from CDI-API:

        imports.put( "javax.enterprise.inject.*", coreRealm );

This package contains annotations, exceptions, and one interface - and it looks 
like the interface pulls in a type from javax.enterprise.util:

        
http://docs.oracle.com/javaee/6/api/javax/enterprise/inject/Instance.html#select(javax.enterprise.util.TypeLiteral,%20java.lang.annotation.Annotation...)

Which means that while javax.enterprise.inject.Instance is loaded and exposed 
from the core realm, javax.enterprise.util.TypeLiteral will be loaded from core 
but not exposed - this is likely the cause of the constraint violation.

There are two solutions - first we could narrow the exposure in 
DefaultClassRealmManager to:

        imports.put( "javax.enterprise.inject.Typed", coreRealm );

since that is the only CDI annotation we’re really interested in, and it has no 
dependencies to other types.

Alternatively we could widen the exposure to include the javax.enterprise.util 
package:

        imports.put( "javax.enterprise.inject.*", coreRealm );
        imports.put( "javax.enterprise.util.*", coreRealm );

which should also fix the loader constraint while not introducing other issues.

WDYT?

> Kristian


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to