NullPointerException when Flex client connects (Converting from BlazeDS)

194 views
Skip to first unread message

Gavin Donald

unread,
Dec 11, 2012, 8:17:14 AM12/11/12
to gran...@googlegroups.com
I am trying to move from BlazeDS to GraniteDS. The server boots without any errors but when the Flex client makes a call the server throws an error:

11-Dec-2012 12:55:09 org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [GravityServlet] in context with path [] threw exception
java.lang.NullPointerException
    at org.granite.gravity.GravityServletUtil.deserialize(GravityServletUtil.java:81)
    at org.granite.gravity.GravityServletUtil.deserialize(GravityServletUtil.java:71)
    at org.granite.gravity.AbstractGravityServlet.deserialize(AbstractGravityServlet.java:85)
    at org.granite.gravity.generic.GravityGenericServlet.doPost(GravityGenericServlet.java:80)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)

My current configuration running on Tomcat 7 is as follows:

web.xml

<listener>
        <listener-class>org.granite.config.GraniteConfigListener</listener-class>
</listener>
<servlet>
        <servlet-name>dispatcher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>2</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>dispatcher</servlet-name>
        <url-pattern>/gravity-amf/*</url-pattern>
    </servlet-mapping> 
   
    <servlet>
        <servlet-name>GravityServlet</servlet-name>
        <servlet-class>org.granite.gravity.generic.GravityGenericServlet</servlet-class>
        <load-on-startup>3</load-on-startup>
        <!--<async-supported>true</async-supported>-->
    </servlet>
    <servlet-mapping>
        <servlet-name>GravityServlet</servlet-name>
        <url-pattern>/gravity-amf/*</url-pattern>
    </servlet-mapping>

I am not sure if I am using the correct GravityServlet.

services-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<services-config>
    <services>      
        <service    id="messaging-service"
                    class="flex.messaging.services.MessagingService"
                    messageTypes="flex.messaging.messages.AsyncMessage">
            <adapters>
                <adapter-definition id="default"
                                    class="org.granite.gravity.adapters.SimpleServiceAdapter"
                                    default="true"/>
            </adapters>
            <destination id="dashboard">
                <channels>
                    <channel ref="habittracker-amf"/>
                    <channel ref="habittracker-secure-amf"/>
                </channels>
            </destination>
        </service>
    </services>
    <channels>
        <channel-definition id="habittracker-amf" class="org.granite.gravity.channels.GravityChannel">
            <endpoint   uri="http://trackitude:8080/gravity-amf/habittracker-amf"
                        class="flex.messaging.endpoints.AMFEndpoint"/>
        </channel-definition>
        <channel-definition id="habittracker-secure-amf" class="org.granite.gravity.channels.SecureGravityChannel">
            <endpoint   uri="https://trackitude:8443/gravity-amf/habittracker-secure-amf"
                        class="flex.messaging.endpoints.SecureAMFEndpoint"/>
        </channel-definition>
    </channels>
</services-config>

The services are annotated as follows:

@Service("serviceHtLogin")
@RemoteDestination( id="serviceHtLogin" ,
                    source="ServiceHtLogin" ,
                    channel="habittracker-secure-amf")

Spring application-context.xml configuration contains:

<graniteds:flex-filter url-pattern="/*"/>

The first connection the Flex client makes is over the habittracker-secure-amf channel but it doesn't seem to be getting as far as the service class. Can anyone make any suggestions as to where I have gone wrong?

Gavin Donald

unread,
Dec 11, 2012, 8:20:59 AM12/11/12
to gran...@googlegroups.com
I am including a slightly better snippet from the log file:

prosoc => [log level: DEBUG] [thread: http-bio-8080-exec-2] [logging time (ms): 30843]
    org.granite.gravity.generic.GravityGenericServlet doPost
        doPost: from "127.0.0.1":52071

prosoc => [log level: DEBUG] [thread: http-bio-8080-exec-2] [logging time (ms): 30847]
    org.granite.messaging.amf.io.AMF3Deserializer_MORE <init>
        new AMF3Deserializer(in=org.apache.catalina.connector.CoyoteInputStream@793673)

prosoc => [log level: DEBUG] [thread: http-bio-8080-exec-2] [logging time (ms): 30848]
    org.granite.messaging.amf.io.AMF3Deserializer_MORE readObject
        readObject()...

prosoc => [log level: DEBUG] [thread: http-bio-8080-exec-2] [logging time (ms): 30951]
    org.granite.messaging.amf.io.AMF3Deserializer_MORE readAMF3Integer
        readAMF3Integer() -> 0

prosoc => [log level: DEBUG] [thread: http-bio-8080-exec-2] [logging time (ms): 30951]
    org.granite.messaging.amf.io.AMF3Deserializer_MORE readObject
        readObject(type=0x00)


11-Dec-2012 12:55:09 org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [GravityServlet] in context with path [] threw exception
java.lang.NullPointerException
    at org.granite.gravity.GravityServletUtil.deserialize(GravityServletUtil.java:81)
    at org.granite.gravity.GravityServletUtil.deserialize(GravityServletUtil.java:71)
    at org.granite.gravity.AbstractGravityServlet.deserialize(AbstractGravityServlet.java:85)



Gavin Donald

unread,
Dec 11, 2012, 9:02:39 AM12/11/12
to gran...@googlegroups.com
I see that I am actually getting this error in the Flex client:

faultCode [[RPC Fault faultString="Send failed" faultCode="Client.Error.MessageSend" faultDetail="Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 404: url: 'http://trackitude:8080/gravity-amf/habittracker-amf'"]]

so the client thinks it doesn't have the correct URL. However that is the URL that is in services-config.xml. Maybe I am using the wrong URL as the annotation:


@RemoteDestination( id="serviceHtLogin" ,
                    source="ServiceHtLogin" ,
                    channel="habittracker-secure-amf")

is generating it differently and I don't need the channel defined in services-config.xml?

The RO the client uses is a Swiz managed bean (I want to convert to Tide later) defined as follows:

<mx:RemoteObject     id="remoteObjectHtLogin"
                            destination="serviceHtLogin"
                            channelSet="{channelSetHelper}"
                            showBusyCursor="true" />

<swiz:ChannelSetHelper     id="channelSetHelper"
                                protocol="http"
                                serverName="trackitude"
                                serverPort="8080"
                                contextRoot=""
                                endPointName="gravity-amf/habittracker-amf" />





On Tuesday, December 11, 2012 1:17:14 PM UTC, Gavin Donald wrote:

Gavin Donald

unread,
Dec 11, 2012, 11:35:50 AM12/11/12
to gran...@googlegroups.com
I have now installed the APR dll into Tomcat 7 and I am using:

<servlet-class>org.granite.gravity.servlet3.GravityAsyncServlet</servlet-class>
<async-supported>true</async-supported>

servlet. I am getting the following error which I don't seem to be able to get around:

javax.servlet.ServletException: Asynchronous requests are not supported with this servlet. Please check your web.xml

The servlet is called the GravityAsyncServlet so it make sense to me that it is asynchronous and so I probably have a configuration error somewhere. I have no idea where though.

Thanks for any pointers.
Reply all
Reply to author
Forward
0 new messages