9 Replies Latest reply on Jun 20, 2006 7:46 AM by Tilo Thiele

    problem - JNDI InitialContext properties:null

    Tilo Thiele Newbie

      When I try to start with a simple seam app from scratch, I get the following error when I send the first request:

      2006-06-20 00:28:11,052 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:null
      2006-06-20 00:28:11,052 DEBUG [org.jboss.mx.loading.RepositoryClassLoader] setRepository, repository=org.jboss.mx.loading.HeirarchicalLoaderRepository3@620402, cl=org.jboss.mx.loading.HeirarchicalLoaderRepository3$CacheClassLoader@1139acf{ url=null ,addedOrder=0}
      2006-06-20 00:28:11,062 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/dekra-ap].[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
      java.lang.IllegalStateException: Could not start transaction
       at org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener.begin(SeamExtendedManagedPersistencePhaseListener.java:77)
       at org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener.beforePhase(SeamExtendedManagedPersistencePhaseListener.java:35)
       at org.apache.myfaces.lifecycle.LifecycleImpl.informPhaseListenersBefore(LifecycleImpl.java:520)
       at org.apache.myfaces.lifecycle.LifecycleImpl.restoreView(LifecycleImpl.java:105)
       at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:66)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:106)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at de.ems.dap.appengine.web.AuthenticationFilter.doFilter(AuthenticationFilter.java:54)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:30)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
       at org.jboss.web.tomcat.tc5.session.ClusteredSessionValve.invoke(ClusteredSessionValve.java:95)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: java.lang.NullPointerException
       at org.jboss.seam.util.Naming.getInitialContext(Naming.java:26)
       at org.jboss.seam.util.Naming.getInitialContext(Naming.java:37)
       at org.jboss.seam.util.Transactions.getUserTransaction(Transactions.java:48)
       at org.jboss.seam.util.Transactions.isTransactionActiveOrMarkedRollback(Transactions.java:30)
       at org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener.begin(SeamExtendedManagedPersistencePhaseListener.java:68)
       ... 30 more
      2006-06-20 00:28:11,062 DEBUG [org.jboss.web.tomcat.tc5.session.JBossCacheManager] check to see if needs to store and replicate session with id N15gE2eYVoGB1pI8e8LobQ**
      2006-06-20 00:28:11,062 DEBUG [org.jboss.web.tomcat.tc5.session.ClusteredSession] processSessionRepl(): session is dirty. Will increment version from: 0 and replicate.
      2006-06-20 00:31:38,820 ERROR [org.jboss.naming.JNDIView] JNDIView.getHAJndiAttributes() failed
      java.lang.NullPointerException: name cannot be null
       at javax.management.ObjectName.construct(ObjectName.java:342)
       at javax.management.ObjectName.<init>(ObjectName.java:1304)
       at org.jboss.naming.JNDIView.getHAJndiAttributes(JNDIView.java:836)
       at org.jboss.naming.JNDIView.getHAUrl(JNDIView.java:811)
       at org.jboss.naming.JNDIView.list(JNDIView.java:193)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.jmx.adaptor.control.Server.invokeOpByName(Server.java:258)
       at org.jboss.jmx.adaptor.control.Server.invokeOp(Server.java:223)
       at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.invokeOp(HtmlAdaptorServlet.java:262)
       at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.processRequest(HtmlAdaptorServlet.java:100)
       at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.doPost(HtmlAdaptorServlet.java:82)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Thread.java:595)
      


      When I look at the samples (which run smoothly), there is never set the jndi properties. Can someone please give me a pointer to what might be missing here?

      I am using:
      JBoss 4.0.4GA/clustered+EJB3.0RC8
      Seam-1.0.0.GA

        • 1. Re: problem - JNDI InitialContext properties:null
          Gavin King Master

          Does not seem to have anything to do with Seam. Try the EJB3 forum.

          • 2. Re: problem - JNDI InitialContext properties:null
            Tilo Thiele Newbie

            It seems to work now. After removing the file WEB-INF/faces-config.xml I can see my pages.

            But - does this mean that it is not possible to provide my application with an individual faces-config? What if i need sth. like a custom validator...

            • 3. Re: problem - JNDI InitialContext properties:null
              Thomas Heute Master

              You can keep faces-config.xml

              What's in your file ?

              • 4. Re: problem - JNDI InitialContext properties:null
                Tilo Thiele Newbie

                 

                <?xml version="1.0" encoding="UTF-8"?>
                <!DOCTYPE faces-config
                PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
                 "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
                <faces-config>
                
                 <navigation-rule>
                 <from-view-id>/login.jsp</from-view-id>
                 <navigation-case>
                 <from-outcome>kunde</from-outcome>
                 <to-view-id>/home-kunde.jsp</to-view-id>
                 </navigation-case>
                 <navigation-case>
                 <from-outcome>dekra-hv</from-outcome>
                 <to-view-id>/home-dekra-hv.jsp</to-view-id>
                 </navigation-case>
                 <navigation-case>
                 <from-outcome>dekra-nl</from-outcome>
                 <to-view-id>/home-dekra-nl.jsp</to-view-id>
                 </navigation-case>
                 </navigation-rule>
                
                 <!-- Phase listener needed for all Seam applications -->
                
                 <lifecycle>
                 <phase-listener>org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener</phase-listener>
                 </lifecycle>
                
                </faces-config>
                


                • 5. Re: problem - JNDI InitialContext properties:null
                  Tilo Thiele Newbie

                  okay thomas, you made me to proceed trying.

                  If I remove the element

                   <!-- Phase listener needed for all Seam applications -->
                   <lifecycle>
                   <phase-listener>org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener</phase-listener>
                   </lifecycle>
                  


                  it woks.
                  So, if this is the solution - what is the explanation?

                  • 6. Re: problem - JNDI InitialContext properties:null
                    Gavin King Master

                    It is not possible to get an NPE from that line of code unless you forgot to start Seam. ie. you do not have SeamListener registered in web.xml.

                    • 7. Re: problem - JNDI InitialContext properties:null
                      Tilo Thiele Newbie

                      alright. Maybe the problem is my Filter. I have a (Authentication-)Filter installed. If the branch

                      request.getRequestDispatcher(fwd).forward(request, response);
                      

                      is being called, the NPE occurs. If the branch
                      chain.doFilter(request, response);
                      

                      is being called, the seam processes the request properly.

                      web.xml is:

                      <?xml version="1.0" encoding="UTF-8"?>
                      
                      <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
                       <distributable/>
                      
                       <filter>
                       <filter-name>Seam Redirect Filter</filter-name>
                       <filter-class>org.jboss.seam.servlet.SeamRedirectFilter</filter-class>
                       </filter>
                      
                       <filter>
                       <filter-name>Seam Exception Filter</filter-name>
                       <filter-class>org.jboss.seam.servlet.SeamExceptionFilter</filter-class>
                       </filter>
                      
                       <filter>
                       <filter-name>Authentication</filter-name>
                       <filter-class>de.ems.dap.appengine.web.AuthenticationFilter</filter-class>
                       <init-param>
                       <param-name>failedForward</param-name>
                       <param-value>/login.seam</param-value>
                       </init-param>
                       </filter>
                      
                       <filter-mapping>
                       <filter-name>Seam Redirect Filter</filter-name>
                       <url-pattern>*.seam</url-pattern>
                       </filter-mapping>
                      
                       <filter-mapping>
                       <filter-name>Authentication</filter-name>
                       <url-pattern>/noch-nicht*</url-pattern>
                       </filter-mapping>
                      
                       <listener>
                       <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
                       </listener>
                      
                       <!-- beginn workaround ... es gibt hierfuer keine andere moeglichkeit, es ueber xdoclet einzusteuern -->
                       <context-param>
                       <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
                       <param-value>client</param-value>
                       </context-param>
                       <!-- ende workaround -->
                      
                       <servlet>
                       <servlet-name>Faces Servlet</servlet-name>
                       <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                       <load-on-startup>1</load-on-startup>
                       </servlet>
                      
                       <servlet-mapping>
                       <servlet-name>Faces Servlet</servlet-name>
                       <url-pattern>*.seam</url-pattern>
                       </servlet-mapping>
                      
                       <!--
                       To specify mime mappings, create a file named mime-mappings.xml, put it in your project's mergedir.
                       Organize mime-mappings.xml following this DTD slice:
                      
                       <!ELEMENT mime-mapping (extension, mime-type)>
                       -->
                      
                       <!--
                       To specify error pages, create a file named error-pages.xml, put it in your project's mergedir.
                       Organize error-pages.xml following this DTD slice:
                      
                       <!ELEMENT error-page ((error-code | exception-type), location)>
                       -->
                      
                       <!--
                       To add taglibs by xml, create a file called taglibs.xml and place it
                       in your merge dir.
                       -->
                      
                       <!--
                       To set up security settings for your web app, create a file named web-security.xml, put it in your project's mergedir.
                       Organize web-security.xml following this DTD slice:
                      
                       <!ELEMENT security-constraint (display-name?, web-resource-collection+, auth-constraint?, user-data-constraint?)>
                       <!ELEMENT web-resource-collection (web-resource-name, description?, url-pattern*, http-method*)>
                       <!ELEMENT web-resource-name (#PCDATA)>
                       <!ELEMENT url-pattern (#PCDATA)>
                       <!ELEMENT http-method (#PCDATA)>
                       <!ELEMENT user-data-constraint (description?, transport-guarantee)>
                       <!ELEMENT transport-guarantee (#PCDATA)>
                      
                       <!ELEMENT login-config (auth-method?, realm-name?, form-login-config?)>
                       <!ELEMENT auth-method (#PCDATA)>
                       <!ELEMENT realm-name (#PCDATA)>
                       <!ELEMENT form-login-config (form-login-page, form-error-page)>
                       <!ELEMENT form-login-page (#PCDATA)>
                       <!ELEMENT form-error-page (#PCDATA)>
                       -->
                      
                      </web-app>
                      

                      AuthenticationFilter is:
                      package de.ems.dap.appengine.web;
                      
                      import java.io.IOException;
                      
                      import javax.servlet.Filter;
                      import javax.servlet.FilterChain;
                      import javax.servlet.FilterConfig;
                      import javax.servlet.ServletException;
                      import javax.servlet.ServletRequest;
                      import javax.servlet.ServletResponse;
                      import javax.servlet.http.HttpServletRequest;
                      import javax.servlet.http.HttpSession;
                      
                      import de.ems.dap.appengine.business.AppSession;
                      
                      /**
                       * Filter class
                       *
                       * @web.filter name="Authentication"
                       * @web.filter-mapping url-pattern="/*"
                       * @web.filter-init-param
                       * name="failedForward"
                       * value="/login.seam"
                       */
                      public class AuthenticationFilter implements Filter {
                      
                       //private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(AuthenticationFilter.class);
                       private String authenticationFailedForward;
                      
                       public AuthenticationFilter() {
                       }
                      
                       public void init(FilterConfig cfg) throws ServletException {
                       authenticationFailedForward = cfg.getInitParameter("failedForward");
                       }
                      
                       public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
                      
                       HttpSession session = ((HttpServletRequest) request).getSession(true);
                       AppSessionHolder ash = AppSessionHolder.getInstance(session);
                      
                       AppSession as = null;
                       if(ash!=null) {
                       ash.getAppSession();
                       }
                       boolean ok = (as!=null);
                      
                       String url = ((HttpServletRequest) request).getServletPath();
                       ok |= url.startsWith("/login.");
                       ok |= url.startsWith("/logout.");
                       ok |= url.startsWith("/life-check.");
                      
                       if (ok) {
                       chain.doFilter(request, response);
                       } else {
                       String fwd = authenticationFailedForward;
                      
                       request.getRequestDispatcher(fwd).forward(request, response);
                       }
                       }
                      
                       public void destroy() {
                       }
                      
                      }
                      


                      • 8. Re: problem - JNDI InitialContext properties:null
                        Gavin King Master

                        Did you read my last post?

                        I don't see this anywhere in web.xml:

                        <listener>
                         <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
                        </listener>


                        • 9. Re: problem - JNDI InitialContext properties:null
                          Tilo Thiele Newbie

                          just in time...
                          very well - now it works! great!...

                          With this listener element, I got a deployment error.
                          But - after changing in components.xml

                          <component class="org.jboss.seam.core.Ejb" installed="true"/>
                          


                          to

                          <component class="org.jboss.seam.core.Ejb" installed="false"/>
                          


                          I see what I expected.

                          Thanks a lot
                          /Tilo