Having trouble getting example Air application started

51 views
Skip to first unread message

Osman Ullah

unread,
Sep 28, 2012, 3:32:08 PM9/28/12
to gran...@googlegroups.com
I am trying to build a Granite project where the server and the Air client are separate from each other. However, I seem to be running into issues in telling the client where it needs to go to contact the server. This is a Spring Project. I created a new GDS project (TestProject) using the GDS Build Wizard in Eclipse. Then I took the server code and moved it into a different project. I then created a new air project and copied the Flex code from the TestProject. I then added a services-config.xml to the server project. This is where I am running into a problem.

When I try to run the example and sign in, I get the following error:

Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Failed: url: 'http://raniteAir.swf/fs-server/graniteamf/amf.txt'

My services-config.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<services-config>
    <services>
        <service
            id="granite-service"
            class="flex.messaging.services.RemotingService"
            messageTypes="flex.messaging.messages.RemotingMessage">

            <destination id="testBean">
                <channels>
                    <channel ref="graniteamf"/>
                </channels>
                <properties>
                    <factory>springFactory</factory>
                    <source>springBean</source>
                </properties>
                <security>
                    <security-constraint>
                        <auth-method>Custom</auth-method>
                        <roles>
                            <role>ROLE_USER</role>
                            <role>ROLE_ADMIN</role>
                        </roles>
                    </security-constraint>
                </security>
            </destination>
        </service>
    </services>

    <factories>
        <factory id="springFactory" class="org.granite.spring.SpringServiceFactory" />
    </factories>

    <channels>
        <channel-definition id="graniteamf" class="mx.messaging.channels.AMFChannel">
            <endpoint
                uri="http://localhost:8080/{context.root}/graniteamf/amf"
                class="flex.messaging.endpoints.AMFEndpoint"/>
        </channel-definition>
    </channels>
</services-config>

I am not really sure why it is trying to hit "raniteAir.swf" instead of localhost:8080. What am I doing wrong?

Thanks

Osman Ullah

unread,
Sep 28, 2012, 4:03:42 PM9/28/12
to gran...@googlegroups.com
OK I took out the line which initializes the default initializer and that seemed to fix it. This was the line I had to take out from the Application MXML file:

                Tide.getInstance().getContext().serviceInitializer = new DefaultServiceInitializer('/TestGranite');

Osman Ullah

unread,
Sep 28, 2012, 4:58:00 PM9/28/12
to gran...@googlegroups.com
Well, I had it working. Now I don't know what I did and it's broken again. I am getting this error:

SEVERE: Servlet.service() for servlet [dispatcher] in context with path [/fs-server] threw exception [java.lang.IllegalArgumentException: 'name' must not be null] with root cause
java.lang.IllegalArgumentException: 'name' must not be null
    at org.springframework.util.Assert.notNull(Assert.java:112)
    at org.springframework.beans.factory.BeanFactoryUtils.transformedBeanName(BeanFactoryUtils.java:70)
    at org.springframework.beans.factory.support.AbstractBeanFactory.transformedBeanName(AbstractBeanFactory.java:1004)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:232)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1075)
    at org.granite.spring.SpringServiceFactory.getServiceInstance(SpringServiceFactory.java:70)
    at org.granite.messaging.amf.process.AMF3MessageProcessor.processRemotingMessage(AMF3MessageProcessor.java:135)
    at org.granite.messaging.amf.process.AMF3MessageProcessor.process(AMF3MessageProcessor.java:59)
    at org.granite.messaging.amf.process.AMF0MessageProcessor.process(AMF0MessageProcessor.java:78)
    at org.granite.messaging.webapp.AMFEndpoint.service(AMFEndpoint.java:71)
    at org.granite.spring.FlexFilter.handle(FlexFilter.java:245)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:585)
    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)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:680)





On Friday, September 28, 2012 3:32:09 PM UTC-4, Osman Ullah wrote:

Erguder Bekrek

unread,
Sep 28, 2012, 5:34:45 PM9/28/12
to gran...@googlegroups.com
Try it this way

Spring.getInstance().addComponentWithFactory("serviceInitializer",DefaultServiceInitializer,
{serverName:"localhost", serverPort:"80", contextRoot: "/TestGRanite"});

--
 
 
 



--
Erguder Bekrek

Développeur Flash/Flex ActionScript 2.0/3.0
514.728.5708
erguder...@gmail.com

Erguder Bekrek

unread,
Sep 28, 2012, 5:35:30 PM9/28/12
to gran...@googlegroups.com
Sorry little error

Tide.getInstance().addComponentWithFactory("serviceInitializer",DefaultServiceInitializer,
{serverName:"localhost", serverPort:"80", contextRoot: "/TestGRanite"});

Osman Ullah

unread,
Sep 28, 2012, 5:43:19 PM9/28/12
to gran...@googlegroups.com
That worked great...solved all my other problems too. Thanks

Erguder Bekrek

unread,
Sep 28, 2012, 5:48:34 PM9/28/12
to gran...@googlegroups.com
You are welcome :)!
Reply all
Reply to author
Forward
0 new messages