2 Replies Latest reply on Oct 20, 2009 6:02 PM by Stephan B

    Web Beans + Web Start

    Stephan B Newbie

      Hi,


      how to package a web beans (Weld) Java SE project for web start?


      Obviously I have to merge the classes and dependencies of my project into one JAR (via maven-dependency-plugin). But when I start the fat jar from the console, web beans starts scanning the classpath like crazy (because the beans.xml that was formerly only in my JAR is now public (because of the merge)):



      SEVERE: Error loading bsh/util/BeanShellBSFEngine.class
      java.lang.NoClassDefFoundError: org/apache/bsf/util/BSFEngineImpl
           at java.lang.ClassLoader.defineClass1(Native Method)
           at java.lang.ClassLoader.defineClass(ClassLoader.java:637)
           at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
           at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
           at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
           at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
           at java.security.AccessController.doPrivileged(Native Method)
           at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
           at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
           at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
           at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
           at org.jboss.webbeans.environment.se.discovery.AbstractScanner.handle(AbstractScanner.java:51)
           at org.jboss.webbeans.environment.se.discovery.URLScanner.handleArchiveByFile(URLScanner.java:149)
           at org.jboss.webbeans.environment.se.discovery.URLScanner.handle(URLScanner.java:126)
           at org.jboss.webbeans.environment.se.discovery.URLScanner.scanResources(URLScanner.java:107)
           at org.jboss.webbeans.environment.se.discovery.SEWebBeanDiscovery.scan(SEWebBeanDiscovery.java:71)
           at org.jboss.webbeans.environment.se.discovery.SEWebBeanDiscovery.<init>(SEWebBeanDiscovery.java:45)
           at org.jboss.webbeans.environment.se.StartMain$1.<init>(StartMain.java:69)
           at org.jboss.webbeans.environment.se.StartMain.go(StartMain.java:69)
           at org.jboss.webbeans.environment.se.StartMain.main(StartMain.java:91)
           at org.jboss.webbeans.environment.se.StartMain.main(StartMain.java:86)



      There are a few dozen more - Web Beans takes those form my MANIFEST file - yet when I don't add all the paths, the jar signing that is required for web start doesn't work. Excerpt:


      Manifest-Version: 1.0
      Build-Jdk: 1.6.0_14
      Created-By: Apache Maven
      Main-Class: org.jboss.webbeans.environment.se.StartMain
      Archiver-Version: Plexus Archiver
      
      Name: javax/mail/internet/ContentDisposition.class
      SHA1-Digest: XPnae+DgbD05R+E1xCNdWjZ0aWA=
      
      Name: javax/servlet/ServletRequestWrapper.class
      SHA1-Digest: NHeo4aV0T3E88+17A/YidgOCqtE=
      
      Name: junit/awtui/TestRunner$2.class
      SHA1-Digest: ak43r0m/RwVKKsUxtXNkdkEu6FI=
      
      ...



      Finally the app crashes:



      Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/batik/gvt/GraphicsNode
           at java.lang.Class.getDeclaredMethods0(Native Method)
           at java.lang.Class.privateGetDeclaredMethods(Class.java:2444)
           at java.lang.Class.getDeclaredMethods(Class.java:1808)
           at org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl.<init>(AnnotatedClassImpl.java:197)
           at org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl.of(AnnotatedClassImpl.java:108)
           at org.jboss.webbeans.resources.ClassTransformer$1.call(ClassTransformer.java:36)
           at org.jboss.webbeans.resources.ClassTransformer$1.call(ClassTransformer.java:32)
           at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
           at java.util.concurrent.FutureTask.run(FutureTask.java:166)
           at org.jboss.webbeans.util.collections.ConcurrentCache.putIfAbsent(ConcurrentCache.java:125)
           at org.jboss.webbeans.resources.ClassTransformer.classForName(ClassTransformer.java:31)
           at org.jboss.webbeans.introspector.jlr.AbstractAnnotatedType.<init>(AbstractAnnotatedType.java:64)
           at org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl.<init>(AnnotatedClassImpl.java:113)
           at org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl.of(AnnotatedClassImpl.java:108)
           at org.jboss.webbeans.resources.ClassTransformer$1.call(ClassTransformer.java:36)
           at org.jboss.webbeans.resources.ClassTransformer$1.call(ClassTransformer.java:32)
           at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
           at java.util.concurrent.FutureTask.run(FutureTask.java:166)
           at org.jboss.webbeans.util.collections.ConcurrentCache.putIfAbsent(ConcurrentCache.java:125)
           at org.jboss.webbeans.resources.ClassTransformer.classForName(ClassTransformer.java:31)
           at org.jboss.webbeans.bootstrap.BeanDeployer.addClass(BeanDeployer.java:82)
           at org.jboss.webbeans.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:91)
           at org.jboss.webbeans.bootstrap.WebBeansBootstrap.registerBeans(WebBeansBootstrap.java:152)
           at org.jboss.webbeans.bootstrap.WebBeansBootstrap.boot(WebBeansBootstrap.java:203)
           at org.jboss.webbeans.environment.se.StartMain.go(StartMain.java:73)
           at org.jboss.webbeans.environment.se.StartMain.main(StartMain.java:91)
           at org.jboss.webbeans.environment.se.StartMain.main(StartMain.java:86)
      Caused by: java.lang.ClassNotFoundException: org.apache.batik.gvt.GraphicsNode
           at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
           at java.security.AccessController.doPrivileged(Native Method)
           at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
           at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
           at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
           at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
           at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)
           ... 27 more



      Creative ideas welcome!

        • 1. Re: Web Beans + Web Start
          Pete Muir Master

          Takeshi wrote us a DSL based configuration (rather than classpath scanner) https://jira.jboss.org/jira/browse/WELD-5 - it's not integrated into trunk yet (we need to concentrate on the spec for now!), but I would suggest starting with that. Also take a look at the SE module and work out how you can pass the DSL based configuration into it.


          When you are done (or ask questions along the way!) create a JIRA issue with a patch. Then, as soon as we get the DSL based configuration in (probably in November), we can look at integrating your patch.


          Sound good?

          • 2. Re: Web Beans + Web Start
            Stephan B Newbie

            Well that's a tempting offer - but I got my hands full with own work and would need quite some time to find my way around the Weld code considering my limited developing experience.


            This is what I did now to solve the problem:
            Dismissed the fat jar concept and using the maven webstart plugin to package a zip with jnlp and (signed) JARs. This is then extracted to some folder inside the WAR (before packaging). Should work - haven't finished it yet :-)


            Cheers