14 Replies Latest reply on Nov 18, 2009 1:53 PM by gavin.king

    How to create Eclipse New Project.

    paata.paatal.magtigsm.ge

      Hi All,


      How i can create new project into eclipse? it there something like seam-gen ?


      And how to run sample project which i import from weld examples ? for example jsf-translator example.


      my env is :


      1. Eclipse Galileo with m2eclipse plugin


      2. jboss 6.0.M1 from Here



      also i gen an error when building example :



      11/17/09 4:52:51 PM GMT-04:00: Build errors for weld-jsf-translator-war; org.apache.maven.lifecycle.LifecycleExecutionException: Invalid or missing parameters: [Mojo parameter [name: 'rules'; alias: 'null']] for mojo: org.apache.maven.plugins:maven-enforcer-plugin:1.0-beta-1:enforce
      






      Regards,


      Paata Lominadze.



        • 1. Re: How to create Eclipse New Project.
          paata.paatal.magtigsm.ge

          If i deploy translator example manually, i got an error :


          javax.el.PropertyNotFoundException: /home.xhtml @24,110 value="#{translator.text}": Target Unreachable, identifier 'tran
          slator' resolved to null
                  at com.sun.facelets.el.TagValueExpression.getType(TagValueExpression.java:62)
                  at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:92)
                  at javax.faces.component.UIInput.getConvertedValue(UIInput.java:942)
                  at javax.faces.component.UIInput.validate(UIInput.java:868)
                  at javax.faces.component.UIInput.executeValidate(UIInput.java:1072)
                  at javax.faces.component.UIInput.processValidators(UIInput.java:672)
                  at javax.faces.component.UIForm.processValidators(UIForm.java:235)
                  at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
                  at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:700)
                  at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
                  at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
                  at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
                  at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                  at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
                  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
                  at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
                  at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
                  at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.jav
          a:126)
                  at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java
          :70)
                  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                  at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
                  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
                  at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
                  at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
                  at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                  at java.lang.Thread.run(Thread.java:619)
          21:46:14,839 ERROR [lifecycle] JSF1054: (Phase ID: PROCESS_VALIDATIONS 3, View ID: /home.xhtml) Exception thrown during
          phase execution: javax.faces.event.PhaseEvent[source=com.sun.faces.lifecycle.LifecycleImpl@1bc965]
          21:46:14,839 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
          javax.el.PropertyNotFoundException: /home.xhtml @24,110 value="#{translator.text}": Target Unreachable, identifier 'tran
          slator' resolved to null
                  at com.sun.facelets.el.TagValueExpression.getType(TagValueExpression.java:62)
                  at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:92)
                  at javax.faces.component.UIInput.getConvertedValue(UIInput.java:942)
                  at javax.faces.component.UIInput.validate(UIInput.java:868)
                  at javax.faces.component.UIInput.executeValidate(UIInput.java:1072)
                  at javax.faces.component.UIInput.processValidators(UIInput.java:672)
                  at javax.faces.component.UIForm.processValidators(UIForm.java:235)
                  at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
                  at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:700)
                  at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
                  at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
                  at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
                  at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                  at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
                  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
                  at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
                  at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
                  at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.jav
          a:126)
                  at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java
          :70)
                  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                  at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
                  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
                  at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
                  at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
                  at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                  at java.lang.Thread.run(Thread.java:619)
          
          



          i found this problem on the forum but it can't help me :(





          Regards,


          Paata.


          • 2. Re: How to create Eclipse New Project.
            gavin.king

            Do you have beans.xml files in all the right places?

            • 3. Re: How to create Eclipse New Project.
              nickarls

              And faces-config.xml for right EL-resolver

              • 4. Re: How to create Eclipse New Project.
                paata.paatal.magtigsm.ge

                Thanks for reply.


                when i import maven project into eclipse, i got 4 project :


                1.weld-jsf-translator-ear


                2.weld-jsf-translator-ejb


                3.weld-jsf-translator-parent


                4.weld-jsf-translator-war


                beans.xml path is : weld-jsf-translator-war/WEB-INF/beans.xml


                thats all. but beans is into weld-jsf-translator-ejb project. is it correct ?




                Regards,
                Paata.

                • 5. Re: How to create Eclipse New Project.
                  paata.paatal.magtigsm.ge

                  and faces-config.xml is in the same place.

                  • 6. Re: How to create Eclipse New Project.
                    gavin.king

                    You need a beans.xml everywhere that beans are deployed.


                    So you need one in WEB-INF of the war, and another in META-INF of the EJB jar.

                    • 7. Re: How to create Eclipse New Project.
                      asookazian

                      Gavin King wrote on Nov 17, 2009 17:13:


                      You need a beans.xml everywhere that beans are deployed.

                      So you need one in WEB-INF of the war, and another in META-INF of the EJB jar.


                      Why must there be two (minimum?) per EAR?


                      so let's say we have an EAR which has a WAR and five EJB jars.  So we need seven total beans.xml files in that EAR???

                      • 8. Re: How to create Eclipse New Project.
                        gavin.king

                        You need one in every archive that contains beans. It's a marker that tells the container to scan the classes in that archive. Without this requirement, the container would have to scan every jar in the application. Or we would have to require an explicit list of all bean classes (like in Guice or Spring). This approach is much better.

                        • 9. Re: How to create Eclipse New Project.
                          asookazian

                          Ok.  How bout an annotation version of it instead as an option (you know, like in EJB 3 ejb-jar.xml or annotations)?  Although that may not work b/c I'm not sure which type (or types) would be annotated.


                          Isn't there just one seam.properties file per EAR?  Isn't this the same concept (marker that tells the container to scan the classes)?  Or is this a better design in comparison for the same reason you suggested against Guice/Spring??

                          • 10. Re: How to create Eclipse New Project.
                            swd847

                            The reason is to do with the way classloaders work in java. By calling


                            ClassLoader.getResources("beans.xml");
                            



                            the container can figure out which jars it needs to scan. Annotations do not help here, to look for the annotation it would have to scan through all available jars anyway, resulting in a massive increase in startup time.

                            • 11. Re: How to create Eclipse New Project.
                              asookazian

                              ok, so the problem is that if you forget one or more beans.xml files in your EAR, then certain functionality may not be enabled (b/c a lot of it is disabled by default).


                              so is there a warning for possible omission of beans.xml or is there a default one always created??

                              • 12. Re: How to create Eclipse New Project.
                                paata.paatal.magtigsm.ge

                                Hi gavin,


                                i did everything what you told. beans.xml is placed everywhere that beans are deployed.


                                I want to learn java ee 6.


                                and i found your good article here :
                                How to start learning Java EE 6


                                I've some experience with ejb 3.0 and jsf(1.2)


                                now i decide to learn weld (CDI)


                                I got weld from downloads and tried to run translation(it contains ejb and jsf) example, but failed.


                                maven can't build ear, i got this error :



                                From file: /home/paatal/InstalledPrograms/Weld/weld/weld-examples/jsf/translator/ear/pom.xml
                                Reason: Cannot copy a directory: /home/paatal/InstalledPrograms/Weld/weld/weld-examples/jsf/translator/war/target/classes; Did you package/install active project artifact:
                                     artifact = org.jboss.weld.examples.jsf.translator:weld-jsf-translator-war:war:1.0.0-SNAPSHOT:compile;
                                     project: MavenProject: org.jboss.weld.examples.jsf.translator:weld-jsf-translator-war:1.0.0-SNAPSHOT @ /home/paatal/InstalledPrograms/Weld/weld/weld-examples/jsf/translator/war/pom.xml?
                                
                                



                                if i build war and ejb jar projects separately and deploy them to jboss as manually i got an error which i post above :



                                javax.el.PropertyNotFoundException: /home.xhtml @24,110 value="#{translator.text}": Target Unreachable, identifier 'tran
                                slator' resolved to null
                                        at com.sun.facelets.el.TagValueExpression.getType(TagValueExpression.java:62)
                                        at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:92)
                                



                                I think it must be ear application to be deployed. i think maybe ear application's pom.xml has some problems. I also tried download weld from svn but this example had the same problem.



                                other examples working fine because they're only web applications (war) , with no ejb's.



                                also i have another question
                                does this version of jboss :jboss 6.0.M1
                                supports ejb 3.1 i found annotations but i had some problems with deployment ejb without interfaces.
                                i know that interfaces into ejb 3.1 is optional. also singleton beans did not deployed.





                                Regards,
                                Paata.


                                • 13. Re: How to create Eclipse New Project.
                                  nickarls

                                  Builds for me, are you sure there aren't any relevant mvn output missing?

                                  • 14. Re: How to create Eclipse New Project.
                                    gavin.king

                                    Paata, when I follow the instructions in the weld reference doc exactly, everything builds and deploys correctly.


                                    I can't help you with the maven problems, since I don't know maven.