1 2 Previous Next 17 Replies Latest reply on Mar 9, 2009 5:59 PM by Dean Hiller

    JBoss vs. Tomcat review for others to read

    Dean Hiller Expert

      I just ported our Seam application from tomcat to JBoss.  I am very annoyed now.  Here is what I had to do


      1. ADD 26 useless interfaces with the @Local annotation that were not needed in tomcat
      2. ADD 20 EMPTY @Remove methods to Stateful beans
      3. go through and add Stateful or Stateless to every bean(this seems repetitive as ScopeType of APPLICATION, SESSION, or CONVERSATION are clearly Stateful but I have to add these.


      I have tried sharing an EJB layer in JBoss between two seam apps and failed though I was on the forum with someone who had seemed to get success(I am jealous)....I am not sure where tomcat sits here though on level of difficulty on sharing the EJB layer. 


      overall, I feel like I have to write alot more useless code for JBoss Seam than tomcat.  That is my personal take on it.
      later,
      Dean Hiller
      http://xsoftware.biz

        • 1. Re: JBoss vs. Tomcat review for others to read
          Dean Hiller Expert

          last post screwed up my formatting....same post but fixed....


          I just ported our Seam application from tomcat to JBoss. I am very annoyed now. Here is what I had to do



          1. ADD 26 useless interfaces with the @Local annotation that were not needed in tomcat 
          2. ADD 20 EMPTY @Remove methods to Stateful beans 
          3. go through and add Stateful or Stateless to every bean(this seems repetitive as ScopeType of APPLICATION, SESSION, or CONVERSATION are clearly Stateful but I have to add these.




          I have tried sharing an EJB layer in JBoss between two seam apps and failed though I was on the forum with someone who had seemed to get success(I am jealous)....I am not sure where tomcat sits here though on level of difficulty on sharing the EJB layer.


          overall, I feel like I have to write alot more useless code for JBoss Seam than tomcat. That is my personal take on it. later, Dean Hiller http://xsoftware.biz

          • 2. Re: JBoss vs. Tomcat review for others to read
            Norman Richards Expert

            That's funny.  I once move a seam app from Tomcat to JBoss and didn't have to change a line of code.  I wonder why you felt you needed to make all those unnecessary changes to change to EJB3 at the same time?  Though, honestly it sounds like about 5-10 minutes worth of work, so I guess it really wasn't so bad.

            • 3. Re: JBoss vs. Tomcat review for others to read
              Drew Kutchar Newbie

              That's funny. I started developing my app with Seam and EJB3 on JBoss then moved it to Glassfish then got rid of all the EJB nonsense and converted everything to POJOs and started using Tomcat and I can't be happier. The whole stack (tomcat, JPA/Hibernate, JBoss Cache, ...) loads in 8seconds on Mac Pro and memory footprint is a LOT less (in 10s of MB vs the old 100s). I still don't see why someone would use Seam with EJB3 for a standard webapp.

              • 4. Re: JBoss vs. Tomcat review for others to read
                Dean Hiller Expert

                hmmmmm, really?  I seemed to have to add all these @Local interfaces.  Are you saying those are not needed anymore?  I am on JBoss 5 and seam 2.1.1. 


                I am getting all sorts of LIE and weird exceptions as the transaction window seems to be smaller and is around the action method only instead of around the get request/response lifecycle of my application.  I don't know why...it is so weird....we have not successfully got our application running in jboss yet as we get lots of exceptions.


                We once tried just dropping the war we had for tomcat into jboss and that just blew up big time and we could not resolve that either so we switched to an ear(which I hate....they should have followed the osgi model for packaging which is way better than ear files). 


                The examples in seam are very lacking on advanced cases like how to do a war file in jboss(which I would prefer) and better yet, how to share an ejb3 layer between two seam applications.


                Dean

                • 5. Re: JBoss vs. Tomcat review for others to read
                  Francisco Jose Peredo Noguez Master

                  Dean Hiller wrote on Jan 14, 2009 17:14:


                  I just ported our Seam application from tomcat to JBoss.  I am very annoyed now.  Here is what I had to do

                  1. ADD 26 useless interfaces with the @Local annotation that were not needed in tomcat



                  And they are not needed in JBoss.



                  2. ADD 20 EMPTY @Remove methods to Stateful beans



                  That are not needed in JBoss.




                  3. go through and add Stateful or Stateless to every bean(this seems repetitive as ScopeType of APPLICATION, SESSION, or CONVERSATION are clearly Stateful but I have to add these.



                  That are also not needed in JBoss.



                  I have tried sharing an EJB layer in JBoss between two seam apps and failed though I was on the forum with someone who had seemed to get success(I am jealous)....I am not sure where tomcat sits here though on level of difficulty on sharing the EJB layer. 



                  Maybe you should have started with: I just ported our Seam application from POJOs to EJBs, then what you write would make sense.



                  overall, I feel like I have to write alot more useless code for JBoss Seam than tomcat.  That is my personal take on it.
                  later,
                  Dean Hiller



                  I guess i should translate that to: I feel like I have to write a lot more useless code for EJBs Seam than POJOs.




                  After the translation I agree with you: unless you have a good reason to use EJBs, you should just use POJOs.





                  • 6. Re: JBoss vs. Tomcat review for others to read
                    Francisco Jose Peredo Noguez Master

                    Dean Hiller wrote on Jan 14, 2009 19:07:


                    hmmmmm, really?  I seemed to have to add all these @Local interfaces.  Are you saying those are not needed anymore?  I am on JBoss 5 and seam 2.1.1.



                    Again, not needed for JBoss, but needed for EJBs, but JBoss does not force you to use EJBs (of course, if you are not going to use EJBs, it makes little sense to change from Tomcat to JBoss, but again that does not mean JBoss foreces you to use EJBs)



                    I am getting all sorts of LIE and weird exceptions as the transaction window seems to be smaller and is around the action method only instead of around the get request/response lifecycle of my application.  I don't know why...it is so weird....we have not successfully got our application running in jboss yet as we get lots of exceptions.



                    Maybe I you share the stacktraces of those exceptions someone here can help  you


                    We once tried just dropping the war we had for tomcat into jboss and that just blew up big time and we could not resolve that either so we switched to an ear(which I hate....they should have followed the osgi model for packaging which is way better than ear files). 



                    You need different (less) .jar files in your WEB-INF/lib to deploy in Jboss


                    The examples in seam are very lacking on advanced cases like how to do a war file in jboss(which I would prefer)



                    What? That is really not true, both seam-gen and JBossTools by default generate war files in jboss. In fact making them work for Tomcat as easily as they work for Jboss is a requested feature for future versions!



                    and better yet, how to share an ejb3 layer between two seam applications.



                    Now, on the sharing of an ejb3 layer between two seam applications, I have no experience, but agree it would be nice to know how to do it in case I ever need it.



                    Dean


                    Click HELP for text formatting instructions. Then edit this text and check the preview.

                    • 7. Re: JBoss vs. Tomcat review for others to read
                      Norman Richards Expert

                      Yes, that's exactly what everyone is saying.  Why are you trying to change your platform and your architecture all at once?  First get the app running as is on the full app server, perhaps making one or two tiny configuration changes in the process.  Then, after you are comfortable with the change you can consider making a fundamental change to your architecture (moving to EJB3) if you need/want to.



                      • 8. Re: JBoss vs. Tomcat review for others to read
                        Dean Hiller Expert

                        I went down this path as JBoss 5 told me this when I did POJO's....


                        org.jboss.deployers.spi.DeploymentException: Error deploying agent.jar: Error creating ejb container GlobalMethods: Bean Class net.voicelog.agent.GlobalMethods
                        has no local, webservice, or remote interfaces defined and does not implement at least one business interface: GlobalMethods



                        How come JBoss is not telling you this?


                        I reverted all my code back to code that works in tomcat and I get this error.  thanks for any pointers on how to change the config to allow POJO's like you guys have.  That is what I want.  I will give the example jpa war file a shot and the booking war file a shot too.    Ideally, I would LOVE to be able to swithc easily between tomcat and JBoss!!!!!!!!!!!!  as I can do hot swap in MyEclipse on tomcat but we could not get JBoss tools working here with our directory structure.
                        thanks,
                        Dean


                        • 9. Re: JBoss vs. Tomcat review for others to read
                          Dean Hiller Expert

                          and by the way, THANKS for all the comments!!! 


                          My previous experience with war files in the examples directory was not good, but hopefully today they will work and I just had some stupid human error before(or bad versions).

                          • 10. Re: JBoss vs. Tomcat review for others to read
                            Francisco Jose Peredo Noguez Master

                            How are you creating your projects? Using seam-gen from the command line? or using JBossTools from inside eclipse?


                            Well, anyway, in both cases you are presented with the option of creating a WAR based or an EAR based project. If  you choose a WAR based approach, by default everything will be generated as POJOs, and if you choose an EAR based approach, by default everything will be generated as EJBs (with @Local, @Stateful, @Stateless  annotations and other EJB stuff)


                            Maybe you should try creating (for the sake of understanding the difference) 2 new projects, using either seam-gen or JBossTools, one as a WAR and one as an EAR (both for JBoss since that is the defaul behavior) and compare the resulting code with that of you original project, I did that (months ago) to really understand the difference between them...


                            I started my project as a WAR (POJOs) in JBoss and then migrated it to an EAR (EJBs) in JBoss, but then, I realized that I just was not using any EJB stuff, and I reverted to my project to a WAR, and switched to Tomcat. So belive me, is possible, and not really hard (but it was hard the first time I tried it, because I didn't understand the difference)

                            • 11. Re: JBoss vs. Tomcat review for others to read
                              Dean Hiller Expert

                              I actually don't want to deal with EJB's, but all their apps are in JBoss so this one needs to be in JBoss.  I did get the JPA war example to work(on previous attempts I had always been trying the booking directory not the jpa directory.


                              I am still getting one last exception though on startup in JBoss with my startup bean....



                              Caused by: java.lang.IllegalStateException: A JTA EntityManager cannot use getTr
                              ansaction()
                                      at org.hibernate.ejb.AbstractEntityManagerImpl.getTransaction(AbstractEn
                              tityManagerImpl.java:324)
                                      at org.jboss.seam.persistence.EntityManagerProxy.getTransaction(EntityMa
                              nagerProxy.java:112)
                                      at org.jboss.seam.transaction.EntityTransaction.getDelegate(EntityTransa
                              ction.java:62)
                                      at org.jboss.seam.transaction.EntityTransaction.begin(EntityTransaction.
                              java:82)
                                      at org.jboss.seam.util.Work.workInTransaction(Work.java:42)
                                      at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(Transa
                              ctionInterceptor.java:89)
                                      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocation
                              Context.java:68)
                                      at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodConte
                              xtInterceptor.java:44)
                                      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocation
                              Context.java:68)
                                      at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:
                              107)
                                      at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(Java
                              BeanInterceptor.java:185)
                                      at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanIntercept
                              or.java:103)
                                      at net.voicelog.agent.StartupAction_$$_javassist_0.start(StartupAction_$
                              $_javassist_0.java)
                                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
                              java:39)
                                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
                              sorImpl.java:25)
                                      at java.lang.reflect.Method.invoke(Method.java:597)
                                      at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
                                      at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
                                      at org.jboss.seam.Component.callComponentMethod(Component.java:2211)
                                      at org.jboss.seam.Component.callCreateMethod(Component.java:2134)
                                      at org.jboss.seam.Component.newInstance(Component.java:2094)
                                      ... 63 more
                              




                              The bean is pretty simple and works in tomcat....



                              @Startup
                              @Scope(ScopeType.APPLICATION)
                              @Name("startup")
                              public class StartupAction {
                              
                                   @In
                                   private EntityManager entityManager;
                                   
                                   @Create
                                   @Transactional
                                   public void start() {
                                        List<Account> accounts = Account.getAllAccounts(entityManager);
                                        if(accounts == null || accounts.size() == 0) {
                                             initializeDatabase();
                                        }
                                   }
                              
                                   private void initializeDatabase() {
                                        //lots of create new object and persist it in db
                                      }
                              




                              Any ideas?  I think I just need to get past this one last issue?
                              thanks,
                              Dean

                              • 12. Re: JBoss vs. Tomcat review for others to read
                                Dean Hiller Expert

                                finally, once I had the right example of a war file that actually worked, that went pretty quickly.  It seems to be all working now in JBoss.


                                THANKS!!!!!!!!!

                                • 13. Re: JBoss vs. Tomcat review for others to read
                                  Francisco Jose Peredo Noguez Master

                                  How are you creating your projects? Using seam-gen from the command line? or using JBossTools from inside eclipse? Are you creating them as WAR or as EAR?


                                  Or you are using seam-gen or JBossTools ? Are creating your project manually ?

                                  1 2 Previous Next