PDA

View Full Version : No Service For


amerywu
05-06-2005, 08:57 AM
I have a problem on my server.


Client code now seems fine:


import mx.remoting.NetServices;


class Test
{


private var gatewayPath:String = "";
private var servicePath:String = "";
private var serviceConnection:Object = new Object();
private var serviceObject:Object = new Object();

function Test()
{

this.gatewayPath =
"http://localhost:8080/openamf/gateway";
this.servicePath = "com.jakestone.bm.Test";
this.setServiceObject();
trace("Directory Created");
}


// Methods
function setServiceObject() {
NetServices.setDefaultGatewayUrl(this.gatewayPath) ;
this.serviceConnection =
NetServices.createGatewayConnection();
this.serviceObject =
this.serviceConnection.getService(this.servicePath ,
this);
}
function setGatewayPath (gatewayPath) {
this.gatewayPath = gatewayPath;
this.setServiceObject();
trace("gateway: "+this.gatewayPath);
}

function setServicePath(servicePath) {
this.servicePath = servicePath;
this.setServiceObject();
trace("service: "+this.servicePath);
}

function sayHello(msg:String) {

this.setServiceObject();
this.serviceObject.sayHello(msg);
}



}


openamf gateway servlet starts up within my webapp
just fine. My web.xml is as per the README. The
config.xml is modified as follows:




<service>
<name>Test</name>

<service-location>com.jakestone.bm.Test</service-location>
<invoker-ref>Java</invoker-ref>
<method>
<!-- Operation's are matched by the name and
parameters -->
<name>sayHello</name>
<state-bean-ref>
<name>Authentication</name>
</state-bean-ref>
<parameter>
<!--
type can be the the name of the class,
a * for any types,
or a ? any 1 type
-->
<type>*</type>
</parameter>
</method>

</service>



My server side code is as follows:



package com.jakestone.bm;


import com.jakestone.bm.utils.BMLogManager;

import java.util.logging.Level;
import java.io.Serializable;

public class Test implements Serializable
{
public void sayHello(String msg)
{

BMLogManager.getDefaultLogger().log(Level.INFO, msg+"
to you too");
}
}


Yet the call to the server creates the following
server side error:



May 5, 2005 11:50:48 PM org.openamf.DefaultGateway
logRequestException
SEVERE: Error in service, detail=[AMFBody:
{serviceName=com.jakestone.bm.Test, serviceMethodNam
e=sayHello, response=/1, type=ARRAY,
value=[boopoodeedoo]}], AMFBody=[AMFBody:
{serviceName=com
.jakestone.bm.Test, serviceMethodName=sayHello,
response=/1, type=ARRAY, value=[boopoodeedoo]}]

org.openamf.invoker.ServiceInvocationException:
java.lang.Exception: No service for 'com.jakest
one.bm.Test'
at
org.openamf.DefaultGateway.invokeBody(DefaultGatew ay.java:203)
at
org.openamf.DefaultGateway.processMessage(DefaultG ateway.java:190)
at
org.openamf.DefaultGateway.service(DefaultGateway. java:95)




Can anyone advise me ?

Thanks in advance.


Jake

amerywu
05-07-2005, 06:33 AM
All the code and config above are completely correct. The error was a sad case of human error. I had forgotten to set my "CATALINA_HOME" to point at the correct tomcat deployment :rolleyes: