1 2 3 Previous Next 43 Replies Latest reply on Jul 12, 2010 10:56 AM by dknox Go to original post
      • 30. Re: Mapping HttpService to JBossWeb
        bosschaert

        Ah ok, so the javax.servlet is actually embedded in your jetty bundle, I thought it was pulled in as a transitive dependency. The maven <exclusions> only get rid of separate transitive maven dependencies.

         

        What you might do is specify a

          -split-package:=first

        on the _exportcontents to specify that you want the first javax.servlet.*. At least that should get rid of the split package warning - I never tried it there but it should work... Obviously you should make sure that the one you want comes first on the classpath, but looking at the dependency tree this should already be the case.

         

        There is more documentation on how to handle split packages in the original bnd (which underpins the maven-bundle-plugin) manual. You can find that here: http://www.aqute.biz/Code/Bnd

        • 31. Re: Mapping HttpService to JBossWeb
          dknox

          Update:

          Just commited the changes to the itest/pom.xml. The test fires but fails because the Framework is not initialized. Learning about the Framework today, and intend to have the test succeeding this evening.

          • 32. Re: Mapping HttpService to JBossWeb
            dknox

            Hi,

            I need some advice regarding which version of jboss-osgi-spi to use. There was a commit to the project in mid-April that indicated that osgi-spi version is supposed to be 1.0.6.

             

            However, updating the HttpServiceTestCase that was provided, it appears that it is in between 1.0.6 and 1.0.7-SNAPSHOT. Which version of jboss-osgi-spi should I be using?

            • 33. Re: Mapping HttpService to JBossWeb
              thomas.diesler

              The current master uses SPI 1.0.7-SNAPSHOT (http://github.com/jbosgi/jbosgi-http/blob/e37e5b4939060f48b3bf610c7d93518ce37c02ef/pom.xml)

               

              Could you please push your work to github or provide us with some other means to review what you are doing?

               

              The recent posts talk a lot about jetty, which is off the point IMHO. The dependency on PaxWeb needs to get replaced by an equivalent dependency on JBossWeb. When PaxWeb goes so do its transitive dependencies on Jetty and the servlet API. As Remy pointed out correctly the dependency on servlet needs to be the one that is used by the supported target container (i.e. JBossAS6)

               

              Please start with ripping out PaxWeb and build an implementation of the HttpService that delegates to JBossWeb.

               

              To do this work you initially don't even need to start an OSGi framework. Instead, you can write isolated unit tests that verify the correct behaviour of your HttpService implementaion. Have a look at Mockito (http://mockito.org/) if you need to mock OSGi functioanlity (i.e. the registry). However, first please show me test cases that exercise your HttpService on top of JBossWeb. In a later step we can review packaging and integration issues.

              • 34. Re: Mapping HttpService to JBossWeb
                dknox

                >> Could you please push your work to github or provide us with some other means to review what you are doing?

                 

                I have been. There was a commit on Jun 4 and this morning.  

                 

                >> The dependency on PaxWeb needs to get replaced

                This is great news. I was under the impression that pax-web-jetty-bundle was a required dependency for jboss-osgi itself. Thanks for clearing that up. I am very happy to rip it out. 

                 

                >> As Remy pointed out correctly the dependency on servlet needs to be the one that is used by the supported target container (i.e. JBossAS6)  It's already using JBossWeb as Remy recommended. The following was added to the bundle pom when Remy made the recommendation.It was committed to git.

                 

                <dependency>
                     <groupId>jboss.web</groupId>
                     <artifactId>servlet-api</artifactId>
                     <version>3.0.0-beta-2</version>
                   </dependency>
                   <dependency>
                     <groupId>jboss.web</groupId>
                     <artifactId>jsp-api</artifactId>
                     <version>3.0.0-beta-2</version>
                   </dependency>
                    <dependency>
                      <groupId>jboss.web</groupId>
                      <artifactId>el-api</artifactId>
                      <version>3.0.0-beta-2</version>
                    </dependency>
                    <dependency>
                      <groupId>jboss.web</groupId>
                      <artifactId>jasper-jdt</artifactId>
                      <version>3.0.0-beta-2</version>
                   </dependency>
                   <dependency>
                     <groupId>jboss.web</groupId>
                     <artifactId>jbossweb</artifactId>
                     <version>3.0.0-beta-2</version>
                   </dependency>

                 

                >> Instead, you can write isolated unit tests that verify the correct behaviour of your HttpService implementaion.

                 

                I started this way. When the work was moved to the git structure it appeared that maven was the mandated environment. Apparently I'm being too sensitive about process. I added my build bits to git this morning. HttpServiceFactory.java contains the driver. It's good that I know not to put too much emphasis on maven. Much better progress can be made without dealing with it.

                • 35. Re: Mapping HttpService to JBossWeb
                  thomas.diesler

                  I don't see your commits. The last commit was made by me on 09-May-2010.

                   

                  http://github.com/jbosgi/jbosgi-http/commits/master/

                   

                  The build system must be maven (i.e. not ant)

                  • 36. Re: Mapping HttpService to JBossWeb
                    dknox

                    I don't have an idea what the problem might be. The url in my .git/config is:

                    http://github.com/jbosgi/jbosgi-http.git

                     

                    I use 'git commit -a' and when needed git add <blah>

                    $> git log:

                    commit e3d3fe7219010e773168ac04078b9a066c414f6b
                    Author: dknox <dknox@redhat.com>
                    Date:   Tue Jun 8 09:10:22 2010 -0600

                     

                        Ripped pax-web out. Not needed.

                     

                    commit ce1ae7ce78bdc1a803a0fa5fe8d1ef99ed55de9d
                    Author: dknox <dknox@redhat.com>
                    Date:   Tue Jun 8 08:32:50 2010 -0600

                     

                        Adding build directory and build.xml to git.

                     

                    commit 177d989608f45ab1bb20d856f9186811022d92f4
                    Author: dknox <dknox@redhat.com>
                    Date:   Thu Jun 3 09:06:28 2010 -0600

                     

                        test target is working now. Test will fail, however:
                        Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.69 sec <<<
                        org.jboss.test.osgi.http.HttpServiceTestCase  Time elapsed: 0 sec  <<< ERROR
                        java.lang.IllegalStateException: Framework not available. Use createFramewor
                       
                        Starting today to learn what the 'framework' requires.

                     

                    commit b7eab7264670c0a9fbcca1b715fdb68f364a2a68
                    Author: dknox <dknox@redhat.com>
                    Date:   Tue Jun 1 12:28:42 2010 -0600

                     

                        Worked out several problems with the maven install and compile targets. Both

                     

                    commit 8879c7d3055409c42fae7eda40757e6f0653d330
                    Author: dknox <dknox@redhat.com>
                    Date:   Fri May 28 14:00:14 2010 -0600

                     

                        Checking in before a long weekend. The maven build works now. The problem
                        isn't fixed. I changed the order of the dependencies so the jbossweb
                        package is in the classpath before the jetty package. Still need to fix the
                        problem. But at least I can work around it for now.

                     

                    As to maven - I would prefer to make some real progress, get the unit test working, and integrate maven later. I realize the build system is maven, but any progress I made trying to integrate maven was too slow. I'd rather do the maven integration after I've got the unit test running and stable.

                     

                    If the maven integration is required now - then I need someone who knows maven to help me understand how to resolve the constraints that currently break it during the test phase. The Ant dependency is part and parcel of org.apache.catalina.tools. The Eclipse dependency comes from the jsp compiler - again part and parcel of the container. The classes that use eclipse.core.resources and eclipse.core.runtime do so in methods that are not called.The same is true of the Ant component - not used by the container.

                     

                    Given the pom.xml in itest, how do I tell maven to ignore those dependencies during the test phase?

                     

                    I was successful trimming Ant during the build phase by using !org.apache.tools.ant. in <Import-Packages> of the bundle/pom.xml. I belive the osgi-http bundle is close to right. But I haven't been able to resolve the constraint error when running 'mvn test'. I haven't been able to resolve the transitive dependency on org.eclipse..core also during test.

                    • 37. Re: Mapping HttpService to JBossWeb
                      thomas.diesler

                      > git add ..

                      > git commit

                       

                      only adds stuff to your local repository. Please read some basic git documentation (e.g. http://progit.org/book) to learn about http://www.kernel.org/pub/software/scm/git/docs/git-push.html and http://www.kernel.org/pub/software/scm/git/docs/git-pull.html

                       

                      The build system is maven because it handles dependencies (also transitive ones) and ensures good productivity. Every jboss commiter is asumed to know how to build, test, install and deploy using a mvn.

                       

                      Please push your stuff online, I can then fix the mvn build for you. The easiest way for you to get started with an online git repository is to create a github account (https://github.com/signup/free) and fork the jbosgi-http repo. Make sure you don't loose your local commits ;-)

                       

                      When you have done that, I can pull from your repo and help you out with your mvn trouble.

                      • 38. Re: Mapping HttpService to JBossWeb
                        dknox

                        Should be all set - git@github.com:dknox/jbosgi-http.git

                         

                        I ran 'mvn install' under bundle which was successful and 'mvn test' under itest which will build but will not succeed.  I know why it doesn't succeed. I'm not yet sure how to fix it. But am plowing through maven plugin docs for a clue.

                        • 39. Re: Mapping HttpService to JBossWeb
                          dknox

                          I've figured out the constraint error. Adding org.apache.tools.ant.taskdefs to the org.osgi.framework.system.packages.extra property appears to have done the trick. I haven't pushed this change yet.


                          Now I'm working on the next one:

                           

                          org.osgi.framework.BundleException: Unresolved constraint in bundle jboss-osgi-common [2]: package; (&(package=org.osgi.framework)(version>=1.4.0))

                           

                          Don't know where the 1.4.0 comes from. The org.osgi.core in Import-Package specifies 1.5.

                          • 40. Re: Mapping HttpService to JBossWeb
                            thomas.diesler

                            I outlined the general direction here

                            https://community.jboss.org/thread/152977?tstart=0

                             

                            Lets discuss specific issues on individual threads.

                             

                            cheers

                            -thomas

                            • 41. Re: Mapping HttpService to JBossWeb
                              dknox

                              A note describing what progress has been made:

                              * Added BundleAdapter to help access resources and properties

                              * JBossWebWrapperTest::testStartServer is working  - the server initialization is pretty much hard coded however.

                              * JBossWebWrapperTest::testServletAccess - not working right now. Very close though and working through Context initialization details before addServlet will succeed.

                              * Added SimpleServlet to bundle/test. It is an annotated servlet.

                               

                              Next Steps:

                              * Complete work on testServletAccess

                              * integrate server.xml and get rid of hardcoded values

                              • 42. Re: Mapping HttpService to JBossWeb
                                thomas.diesler

                                AS mentioned How to progress on jbosgi-http, JBossWeb should have a set of public interfaces that exposes its functionality. In your test cases, you should bind to those interfaces only. There should be no dependency on JBossWeb implementation details.

                                 

                                If you do this, we can later very easily turn the JBossWeb implementation into an OSGi bundle that exposes its functionality through a set of interfaces that are registered with the framework as services.

                                 

                                In case JBossWeb should not have such a well defined public API, you can start creating one in the jboss-osgi-http project under its own namespace (e.g. org.jboss.web). I say it again because it is important - jboss-osgi-http should not bind to anything else, but what is defined in that namespace. We want to decouple jboss-osgi-http and jboss-web right from the start. JBossWeb cannot be embedded into jboss-osgi-http as we currently do with Jetty.

                                • 43. Re: Mapping HttpService to JBossWeb
                                  dknox

                                  This is a status update. I need to concentrate on tomcat5 production builds this week (Jul 12). Some of this has not been committed or pushed into git because my local copy is broken at the moment.

                                   

                                  * Start and Stop server is working from test. Configuration is not complete though. Before registerServlet, registerResources, and unregister can work, the container needs to be fully configured.

                                  * Created public interface (under bundle and not internal) that extends HttpService for control of JBossWeb. It extends osgi.service.http.HttpService and contains additional public method signatures for initialization, start, and stop. The implementations in internal implement the interface. 

                                  * Integration of jbossweb configuration bits - server.xml, initialization properties, context.xml, catalina.properties. My current strategy is to use an internal wrapper to query for values using Bundle::getResource. Some configuration bits that I have questions about is setting CATALINA_HOME. The server needs a base directory to deploy to.

                                   

                                  Next:

                                  * Complete integration of configuration artifacts. Start/Stop a fully configured JBossWeb.

                                  * Test and gill out registerServlet, test and fill out registerResources, and test and fill out unregister.

                                  1 2 3 Previous Next