9 Replies Latest reply on Dec 2, 2008 6:05 PM by (joseGranja)

    NullPointerException from MessageBrokerServlet init

      hi,

      How does one figure this out? there's no real content as to what's going on. (this stuff really should be open source, so i can figure it out and move on)..

      the usual cause of this error is a services config file that is not found (servlet context get resource as stream returns null). but my debugger tells me that that's not the problem in this case (as the stack trace at MBS line 101 and FCM line 81). i can't find anything that MBS / FCM is asking the servlet config / context that is returning null.


      BrokerServlet: **** MessageBrokerServlet failed to initialize due to runtime exception: java.lang.NullPointerException
              at flex.messaging.config.FlexConfigurationManager.getMessagingConfiguration(FlexConfigurationManager.java:81)
              at flex.messaging.MessageBrokerServlet.init(MessageBrokerServlet.java:101)


      exasperated,

      john
        • 1. Re: NullPointerException from MessageBrokerServlet init
          Level 1
          config as usual

          <servlet>
            <servlet-name>MessageBrokerServlet</servlet-name>
            <display-name>MessageBrokerServlet</display-name>
            <servlet-class>flex.messaging.MessageBrokerServlet</servlet-class>

            <init-param>
             <param-name>services.configuration.file</param-name>
             <param-value>/WEB-INF/flex/services-config.xml</param-value>
            </init-param>

            <init-param>
             <param-name>flex.write.path</param-name>
             <param-value>/WEB-INF/flex</param-value>
            </init-param>
            <load-on-startup>1</load-on-startup>
          </servlet>

          • 2. Re: NullPointerException from MessageBrokerServlet init
            Level 1
            i'm trying to get lcds work with my servlet container, "Syntelos-SX". i can see the requests for servlet info and resources made into my servlet container, and nothing is returning null.
            • 3. Re: NullPointerException from MessageBrokerServlet init
              Level 1
              LCDS versioning data


              Implementation-Title: LiveCycle Data Services 2.5
              Implementation-Version: 2.5.166921
              Implementation-Vendor: Adobe Systems Inc.
              • 4. Re: NullPointerException from MessageBrokerServlet init
                Peter Farland Level 3
                It looks like your /WEB-INF/flex/services-config.xml is missing a <system> section. If you add back an empty <system /> section it should get you past this NPE.<br /><br />I ran into this recently too and logged it as bug 206277.
                • 5. Re: NullPointerException from MessageBrokerServlet init
                  i have the same problem just cant figure out what couse this .

                  i am useing Eclipes, JBoss and Spring . FDS
                  • 6. Re: NullPointerException from MessageBrokerServlet init
                    Level 1
                    It was a matter of parameters. Maybe some of this will help

                    <servlet>
                    <servlet-name>MessageBrokerServlet</servlet-name>
                    <display-name>MessageBrokerServlet</display-name>
                    <servlet-class>flex.messaging.MessageBrokerServlet</servlet-class>

                    <init-param>
                    <param-name>services.configuration.parser</param-name>
                    <param-value>com.synchronicitylive.flex.ServicesConfigParser</param-value>
                    </init-param>

                    <init-param>
                    <param-name>services.configuration.file</param-name>
                    <param-value>/WEB-INF/flex/services-config.xml</param-value>
                    </init-param>

                    <init-param>
                    <param-name>flex.write.path</param-name>
                    <param-value>/WEB-INF/flex</param-value>
                    </init-param>
                    <load-on-startup>1</load-on-startup>
                    </servlet>
                    • 7. Re: NullPointerException from MessageBrokerServlet init
                      Hello, I've got also trouble with MessageBrokerServlet. First of all, is it necessary tu declare  <security> in services-config.xml ? When I try to declare it for my servlet tomcat like that: <br /><security><br /><br />        <security-constraint id="sample-users"><br /><br />            <auth-method>Custom</auth-method><br /><br />            <roles><br /><br />                <role>sampleusers</role><br /><br />            </roles><br /><br />        </security-constraint><br /><br />        <login-command class="flex.messaging.security.TomcatLoginCommand" server="Tomcat"/><br /><br />        <br /><br />        <!-- Uncomment the correct app server<br /><br />        <login-command class="flex.messaging.security.JRunLoginCommand" server="JRun"/><br /><br />        <login-command class="flex.messaging.security.TomcatLoginCommand" server="JBoss"><br /><br />        <login-command class="flex.messaging.security.WeblogicLoginCommand" server="Weblogic"/><br /><br />        <login-command class="flex.messaging.security.WebSphereLoginCommand" server="WebSphere"/><br /><br />        --><br /><br />    </security><br /><br />I get an exception : <br />GRAVE: El Servlet /WebContent lanzï¿? excepciï¿?n de load()<br />javax.servlet.UnavailableException: An unknown exception occurred while creating an instance of type 'flex.messaging.security.TomcatLoginCommand'.<br />     at flex.messaging.MessageBrokerServlet.init(MessageBrokerServlet.java:170)<br />     at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1172)<br />     at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:992)<br />     at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4058)<br />     at org.apache.catalina.core.StandardContext.start(StandardContext.java:4371)<br />     at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)<br />     at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)<br />     at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)<br />     at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627)<br />     at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)<br />     at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)<br />     at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)<br />     at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)<br />     at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)<b r />     at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)<br />     at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)<br />     at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)<br />     at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)<br />     at org.apache.catalina.core.StandardService.start(StandardService.java:516)<br />     at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)<br />     at org.apache.catalina.startup.Catalina.start(Catalina.java:578)<br />     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br />     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br />     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br />     at java.lang.reflect.Method.invoke(Method.java:597)<br />     at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)<br />     at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)<br /><br />It's really anyoing, I don't know what to do :( would you help me out please? I'll really apreciate your help :)
                      • 8. Re: NullPointerException from MessageBrokerServlet init
                        Level 1
                        If I don't declare the server thing I get this error wich I can't manage to understand also:

                        **** MessageBrokerServlet failed to initialize due to runtime exception: Exception: flex.messaging.MessageException: Unable to create a new instance of type 'flex.messaging.services.RemotingService'. Types cannot be instantiated without a public, no arguments constructor.
                        at flex.messaging.util.ClassUtil.createDefaultInstance(ClassUtil.java:144)
                        at flex.messaging.MessageBroker.createService(MessageBroker.java:990)
                        at flex.messaging.config.MessagingConfiguration.createServices(MessagingConfiguration.java:2 99)
                        at flex.messaging.config.MessagingConfiguration.configureBroker(MessagingConfiguration.java: 100)
                        at flex.messaging.MessageBrokerServlet.init(MessageBrokerServlet.java:129)
                        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1172)
                        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:992)
                        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4058)
                        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4371)
                        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
                        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
                        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
                        at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627)
                        at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
                        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
                        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
                        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
                        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
                        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
                        at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
                        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
                        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
                        at org.apache.catalina.core.StandardService.start(StandardService.java:516)
                        at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
                        at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
                        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:597)
                        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
                        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

                        I've been trying to configure flex and java for a week it's really difficult because there's no much help about it :( any help would be appreciate :D

                        regards
                        • 9. Re: NullPointerException from MessageBrokerServlet init
                          Level 1
                          my whole services-config.xml looks like that:<br /><br /><?xml version="1.0" encoding="UTF-8"?><br /><services-config><br />      <!--<factories><br />         <factory id="spring" class="flex.samples.factories.SpringFactory"/><br />     </factories>--><br />    <services><br />        <service-include file-path="remote-config.xml" /><br />            <default-channels><br />           <channel ref="my-amf"/><br />        </default-channels><br />    </services><br />    <security><br />        <login-command class="flex.messaging.security.TomcatLoginCommand" server="Tomcat">        <br />            <per-client-authentication>false</per-client-authentication><br />        </login-command><br />        <security-constraint id="basic-read-access"><br />            <auth-method>Basic</auth-method><br />            <roles><br />                <role>guests</role><br />                <role>accountants</role><br />                <role>employees</role><br />                <role>managers</role><br />            </roles><br />        </security-constraint><br />        <security-constraint id="sample-users"><br />            <auth-method>Custom</auth-method><br />            <roles><br />                <role>sampleusers</role><br />            </roles><br />        </security-constraint><br />    </security><br />     <servers><br />        <server id="my-nio-server" class="flex.messaging.socketserver.SocketServer"><br />             <properties><br />                 <!-- for deployment on WebSphere, must be mapped to a WorkManager available in the web application's jndi context.<br /><br />                <websphere-workmanager-jndi-name>java:comp/env/wm/MessagingWorkManager</websphere-workman ager-jndi-name><br /><br />                -->              <br />            </properties><br />        </server><br />    </servers><br />    <channels><br />        <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel"><br />            <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/><br />        </channel-definition><br />        <channel-definition id="my-http" class="mx.messaging.channels.HTTPChannel"><br />            <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/http" class="flex.messaging.endpoints.HTTPEndpoint"/><br />        </channel-definition><br />    </channels><br /><br />    <system><br />    <manageable>false</manageable><br />         <redeploy><br />              <enabled>true</enabled><br />            <watch-interval>20</watch-interval><br />            <watch-file>{context.root}/WEB-INF/flex/services-config.xml</watch-file><br />            <watch-file>{context.root}/WEB-INF/flex/remoting-config.xml</watch-file><br />            <touch-file>{context.root}/WEB-INF/web.xml</touch-file><br />        </redeploy><br />    </system><br /><br /></services-config><br />     <br /><br />And If got a remoting-config.xml<br /><br /><?xml version="1.0" encoding="UTF-8"?><br /><service id="my-service"<br />    class="flex.messaging.services.RemotingService"<br />    messageTypes="flex.messaging.messages.RemotingMessage"><br /><br />    <adapters><br />        <adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter" default="true"/><br />    </adapters><br />    <br />    <default-channels><br />        <channel ref="my-amf"/><br />    </default-channels><br /><br />    <destination id="mortgageService"><br />         <properties><br />            <source>flex.samples.spring.mortgage.Mortgage</source><br />        </properties><br />     </destination><br /></service><br /><br />     <br /><br />I haven't declare any messign-config.xml nor data-management.xml. I'm trying to do a simple example and setting up the servlet MessageBrokerServlet to start learning.<br /><br />thanks in advance