[GLASSFISH-18369] weld dependencies are part of distribution Created: 15/Feb/12  Updated: 01/Mar/13  Resolved: 01/Mar/13

Status: Resolved
Project: glassfish
Component/s: cdi
Affects Version/s: 4.0_b23
Fix Version/s: 4.0

Type: Bug Priority: Critical
Reporter: Sanjeeb Sahoo Assignee: jitu
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

In trunk build, I am seeing various weld dependencies being part of distribution when they should not be. e.g.,
slf4-*.jar
cal10n-api.jar

and may be others?

This will cause all kinds of classloading issues as users won't be able to use different versions of these jars in their application. So, they must be removed from distribution.



 Comments   
Comment by Sivakumar Thyagarajan [ 15/Feb/12 ]

It appears that the glassfish-web packager zip brings in slf4j and cal10n, because of maven dependencies of webtier-all. This may need to be fixed.

[ ../packager/glassfish-web] $ unzip -l target/glassfish-web.zip | grep "cal10n|slf"
28866 2012-02-15 21:26 glassfish3/glassfish/modules/cal10n-api.jar
23659 2012-02-15 21:26 glassfish3/glassfish/modules/slf4j-api.jar
41626 2012-02-15 21:26 glassfish3/glassfish/modules/slf4j-ext.jar

Transferring this issue to Shingwai

Comment by Sivakumar Thyagarajan [ 15/Feb/12 ]

Shingwai, please let me know if there is anyway we can help. It appears that glassfish-web packager brings in weld osgi impl's dependencies such as cal10n, sfl4j.

Comment by Shing Wai Chan [ 07/Mar/12 ]

The slf4j-api, slf4j-ext and cal10n-api are bring it by org.jboss.weld:weld-core:jar:1.1.4.Final:compile which is bring it by org.glassfish.web:web-sse:jar:4.0-SNAPSHOT:compile

Comment by Sanjeeb Sahoo [ 02/Apr/12 ]

Jitu,

Can this bug be fixed by depending on javax.inject/javax.inject/1 instead of weld-osgi? More over, mark the dependency a provided scope dependency so that it does not get pulled in to the distribution. Could you do it ASAP?

Thanks,
Sahoo

Comment by jitu [ 02/Apr/12 ]

If I do the following changes in web-sse/pom.xml, running into an exception. May be HK2 maven plugin needs an update.

<dependency>

  • <groupId>org.jboss.weld</groupId>
  • <artifactId>weld-osgi-bundle</artifactId>
    + <groupId>javax.inject</groupId>
    + <artifactId>javax.inject</artifactId>
    + <version>1</version>
    + <scope>provided</scope>
    </dependency>

---------
java.lang.ClassCastException: com.sun.tools.apt.mirror.type.ClassTypeImpl cannot be cast to com.sun.mirror.type.AnnotationType
at com.sun.tools.apt.mirror.declaration.AnnotationMirrorImpl.getAnnotationType(AnnotationMirrorImpl.java:82)
at com.sun.tools.apt.mirror.apt.AnnotationProcessorEnvironmentImpl$CollectingAP$CollectingVisitor.visitDeclaration(AnnotationProcessorEnvironmentImpl.java:118)
at com.sun.mirror.util.SimpleDeclarationVisitor.visitParameterDeclaration(SimpleDeclarationVisitor.java:181)
at com.sun.tools.apt.mirror.declaration.ParameterDeclarationImpl.accept(ParameterDeclarationImpl.java:80)
at com.sun.mirror.util.DeclarationScanner.visitDeclaration(DeclarationScanner.java:45)
at com.sun.mirror.util.DeclarationScanner.visitParameterDeclaration(DeclarationScanner.java:233)
at com.sun.tools.apt.mirror.declaration.ParameterDeclarationImpl.accept(ParameterDeclarationImpl.java:80)
at com.sun.mirror.util.SourceOrderDeclScanner.visitExecutableDeclaration(SourceOrderDeclScanner.java:225)
at com.sun.mirror.util.DeclarationScanner.visitMethodDeclaration(DeclarationScanner.java:214)
at com.sun.tools.apt.mirror.declaration.MethodDeclarationImpl.accept(MethodDeclarationImpl.java:41)
at com.sun.mirror.util.SourceOrderDeclScanner.visitClassDeclaration(SourceOrderDeclScanner.java:207)
at com.sun.tools.apt.mirror.declaration.ClassDeclarationImpl.accept(ClassDeclarationImpl.java:95)
at com.sun.tools.apt.mirror.apt.AnnotationProcessorEnvironmentImpl$CollectingAP.process(AnnotationProcessorEnvironmentImpl.java:126)
at com.sun.tools.apt.mirror.apt.AnnotationProcessorEnvironmentImpl.getDeclarationsAnnotatedWith(AnnotationProcessorEnvironmentImpl.java:100)
at org.jvnet.hk2.config.generator.ConfigInjectorGenerator.process(ConfigInjectorGenerator.java:122)
at com.sun.mirror.apt.AnnotationProcessors$CompositeAnnotationProcessor.process(AnnotationProcessors.java:60)
at com.sun.mirror.apt.AnnotationProcessors$CompositeAnnotationProcessor.process(AnnotationProcessors.java:60)
at com.sun.tools.apt.comp.Apt.main(Apt.java:454)
at com.sun.tools.apt.main.JavaCompiler.compile(JavaCompiler.java:258)
at com.sun.tools.apt.main.Main.compile(Main.java:1102)
at com.sun.tools.apt.main.Main.compile(Main.java:964)
at com.sun.tools.apt.Main.processing(Main.java:95)
at com.sun.tools.apt.Main.process(Main.java:85)
at com.sun.enterprise.module.maven.HK2CompileMojo$1.compileInProcess(HK2CompileMojo.java:126)
at com.sun.enterprise.module.maven.AptCompiler.compile(AptCompiler.java:106)
at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:528)
at com.sun.enterprise.module.maven.CompilerMojo.execute(CompilerMojo.java:155)
at com.sun.enterprise.module.maven.HK2CompileMojo.execute(HK2CompileMojo.java:140)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

Comment by Sanjeeb Sahoo [ 03/Apr/12 ]

I think this is happening because hk2 also depends on javax.inject. This is a guess only. If you don't want to spend a lot of time, then you could try changing the existing weld-osgi-bundle dependency to a provided scope dependency so that's its transitive dependencies are not pulled in by the build.

Comment by jitu [ 03/Apr/12 ]

weld-osgi-bundle artifact is marked with provided scope
---------------
main/appserver/web/web-sse$ svn ci pom.xml
Sending pom.xml
Transmitting file data .
Committed revision 53341.
----------------

Comment by jthoennes [ 04/Apr/12 ]

In reply to comment #6:
> I think this is happening because hk2 also depends on javax.inject. This is a
> guess only. If you don't want to spend a lot of time, then you could try
> changing the existing weld-osgi-bundle dependency to a provided scope dependency
> so that's its transitive dependencies are not pulled in by the build.

Sahoo, please could you elaborate on this? We are also struck by this issue.

And: Will this be corrected for at least GF 4.0?

Thanks, Jörg

Comment by Sanjeeb Sahoo [ 07/Apr/12 ]

Jörg, pl file a separate bug for the hk2 plugin issue against HK2 project to get a faster response from the relevant developers.

Comment by Sanjeeb Sahoo [ 07/Apr/12 ]

jitu, why is this bug still open?

Comment by jitu [ 08/Apr/12 ]

Will close the issue if there aren't any comments.

Generated at Thu Feb 11 21:50:40 UTC 2016 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.