2 Replies Latest reply on May 3, 2011 11:27 AM by Aage Nielsen

    Weld, war and Tomcat

    Aage Nielsen Newbie

      We are using Weld 1.1.0 in a JSF 2.1 applikation and we are struggleing with war files and Tomcat 6.0.32.

       

      Our production environment are currently using "pure" war files and exploded apps are not permitted ! It is true that Weld does not work unless the war files are exploded ? Our own little test show no beans when running the app unexploded, but alle our beans when exploded

       

      .....

          public List<Bean> getJndiBeans() {

              List<Bean> jndiBeans=new ArrayList<Bean>();

              Context initCtx;

              try {

                  initCtx = new InitialContext();

                  Context envCtx = (Context) initCtx.lookup("java:comp/env");

                  BeanManagerImpl bm= (BeanManagerImpl) envCtx.lookup("BeanManager");

                  for (Object bean : Arrays.asList(bm.getBeans().toArray())) {

                      jndiBeans.add((Bean) bean);

                  }

       

              } catch (NamingException e) {

                  // TODO Auto-generated catch block

                  e.printStackTrace();

              }

       

              return jndiBeans;

          }

      ......

      ......

       

                  <rich:dataTable var="bean" value="#{simpleTest.jndiBeans}">

                      <f:facet name="header">

                          <h:column>Name</h:column>

                          <h:column>Scope</h:column>

                      </f:facet>

                      <h:column>

                          <h:outputText value="#{bean.name}" />

                      </h:column>

                      <h:column>

                          <h:outputText value="#{bean.scope.name}" />

                      </h:column>

                  </rich:dataTable>

       

       

      Anyone ?

       

      best regards

      aage