4 Replies Latest reply on Jul 8, 2012 3:25 PM by zeeman

    Seam 3 and Jetty 8

    demetrio812 Apprentice

      Hello,

      I configured a demo project to test a Seam 3 configuration on Jetty 8.

       

      I've configured the pom.xml (it's a maven project), the web.xml and the jetty-env.xml but when it tries to locate the BeanManager it fails so I guess there is something wrong in the jetty-env.xml configuration.

       

      I've looked everywhere and tried different options, is there someone that has experience on this?

       

      You can download my demo project here:

       

      https://www.dropbox.com/s/thmxhnrkvo296ay/jetty-demo.zip

       

      Thanks,

      Dem

        • 1. Re: Seam 3 and Jetty 8
          demetrio812 Apprentice

          P.S.: it gives me the following error on start-up:

           

          org.jboss.solder.beanManager.BeanManagerUnavailableException: Failed to locate BeanManager using any of these providers: org.jboss.solder.servlet.beanManager.ServletContextAttributeProvider(20), org.jboss.solder.beanManager.DefaultJndiBeanManagerProvider(11), org.jboss.solder.beanManager.ServletContainerJndiBeanManagerProvider(10)

               at org.jboss.solder.beanManager.BeanManagerLocator.getBeanManager(BeanManagerLocator.java:88)

               at org.jboss.seam.faces.environment.SeamApplicationFactory.getApplication(SeamApplicationFactory.java:47)

           

          thanks,

          Dem

          • 2. Re: Seam 3 and Jetty 8
            zeeman Novice

            Jason has a post for getting Tomcat 7 to work with Seam3, you'll need to do something similiar with Jetty. But that requires some hacks. I ported my web app to Tomee (Tomcat for javaEE) and could not be happier.

            • 3. Re: Seam 3 and Jetty 8
              demetrio812 Apprentice

              I have already deployed it on tomcat and I've started from it for the jetty one, but don't know why it's not getting the BeanManager...   Do you have more info on porting it on TomEE? Is there something specific I have to do?

               

              Btw I'm interested to have it running on jetty 8...has someone got experience?

               

              Thanks,

               

              Dem

              • 4. Re: Seam 3 and Jetty 8
                zeeman Novice

                For Tomee it's easy, if you use Hibernate see this http://openejb.apache.org/tomee-and-hibernate.html, by default Tomee uses OpenJPA as JPA provider, you can use Hibernate instead easily. For Seam and other things it should just work.

                I have uploaded a project here https://github.com/z00/test that works on Tomee, it uses Seam and needed Hibernate dependencies. I don't have persistence.xml  added, so you need to do that. Also, the POM in test project uses Tomee maven plugin. It'll automatically set up libs for you in lib Tomee folder.

                Plugin will download Tomee for you in target of the project. Search pom.xml for tomee-maven-plugin if you wanna to set your own libs. you can run mvn tomee:configtest to test your config. Be sure to package your war if you want to run Tomee with your project.

                 

                Once I have Tomee setup, you can use Eclipse and deploy to Tomee, makes developent turnaround time really nice.

                 

                Check out Tomee site http://openejb.apache.org/documentation.html and there is an active forum there if you have questions.

                 

                To add a DS create a file called resources.xml under src/main/resources/META-INF and hook up your DB. This is for Postgres, be sure to include your DB driver in POM.xml. This is really easy to add a DS to Tomee compared to jBoss.

                 

                <?xml version="1.0" encoding="UTF-8"?>

                <resources>

                          <Resource id="myDS" type="javax.sql.DataSource">

                            JdbcDriver org.postgresql.Driver

                            JdbcUrl jdbc:postgresql://127.0.0.1:5432/db

                            JtaManaged true

                            UserName user

                            Password psw

                            MaxActive                     10

                            MaxIdle                       5

                            MinIdle                       2

                            TimeBetweenEvictionRunsMillis    600000

                            NumTestsPerEvictionRun        2

                            ValidationQuery               SELECT 1

                            TestWhileIdle                 true

                     </Resource>

                </resources>