Hi, Fei,
It looks to me that the problem is that you are invoking the start
method against a port that has not been bound to an actual instance of a
replicator ws-resource. This is your code below.
=================
ReplicationServiceLocator locator = new
ReplicationServiceLocator();
CreateReplicator CRitem=new CreateReplicator();
CRitem = setOption(serviceURI);
// EndpointReferenceType drsepr;
try{
replicator =
locator.getReplicatorPortTypePort(replicatorURL);
replicator.createReplicator(CRitem);
}catch(Exception e){
e.printStackTrace();
}
org.globus.replica.replicator.generated.Start repStart
= new Start();
try {
replicator.start(new
Start());
} catch (InvalidStateFaultType e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
}
}
=================
When you first lookup the replicator it is to a replicator service URL.
Then you use that "replicator" port to create a replicator resource -
that is the right thing to do. But when you get back the response to the
createReplicator method it also returns a new EPR to the replicator
resource (rather than just the service). You need to extract the EPR
from the CreateResponse and use it to locate the resource. Then using
the resource's port you can start the resource.
So:
1) use the locator to find the DRS service
2) use the port returned by (1) to create the DRS resource
3) extract the EPR from the response returned by (2)
4) use the locator to find the DRS resource that you just created in (2)
5) call the start method on the port returned by (4)
(This is standard procedure for WS-Resources)
I would suggest seeing the Create client of the DRS for an example.
Below is an excerpt of its code. Follow the URL to see the complete
code.
See:
http://viewcvs.globus.org/viewcvs.cgi/ws-replica/replicator/client/java/
source/src/org/globus/replica/replicator/client/Create.java?revision=1.3
&view=markup
=================
EndpointReferenceType epr =
createResponse.getEndpointReference();
if (client.isDebugMode()) {
System.out.println("Replicator created.");
}
// Save EPR (Optionally)
if (client.saveEprFile != null) {
client.saveEndpoint(epr, client.saveEprFile);
}
// Start replicator (Optionally)
if (client.start) {
// lookup newly created replicator
port = locator.getReplicatorPortTypePort(epr);
client.setOptions((Stub)port);
if (client.isDebugMode()) {
System.out.println("Starting Replicator...");
}
port.start(new Start());
if (client.isDebugMode()) {
System.out.println("Replicator started.");
}
}
=================
Hope that helps,
Rob
________________________________
From: fei chen [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 24, 2007 12:53 AM
To: Robert Schuler
Subject: Re: [gt-user] DRS in gt4
Hi, Rob:
The previous exception( string index out of range -1) I mentioned
was due to the format of DRS's request file. I mistook SPACE characters
as a substitute for the TAB character.
But there came another exception: Resource key is missing.
I could not check it out! I attached the file with my source code.
Command I ran:
java -Daxis.ClientConfigFile=$GLOBUS_LOCATION/client-config.wsdd
Conn2DRS MailScanner warning: numerical links are often malicious:
https://10.129.211.168:8443/wsrf/services/ReplicationService
<https://10.129.211.168:8443/wsrf/services/ReplicationService>
Stack trace for the exception:
Enter :delegateCredential
now in delegateCredential: factoryUrl = MailScanner warning: numerical
links are often malicious:
https://10.129.211.168:8443/wsrf/services/DelegationFactoryService
<https://10.129.211.168:8443/wsrf/services/DelegationFactoryService>
Exit :delegateCredential
AxisFault
faultCode: {
http://schemas.xmlsoap.org/soap/envelope/}Server.userException
<http://schemas.xmlsoap.org/soap/envelope/%7DServer.userException>
faultSubcode:
faultString: org.globus.wsrf.InvalidResourceKeyException: Resource key
is missing
faultActor:
faultNode:
faultDetail:
{
http://xml.apache.org/axis/}stackTrace:org.globus.wsrf.InvalidResourceKe
yException
<http://xml.apache.org/axis/%7DstackTrace:org.globus.wsrf.InvalidResourc
eKeyException> : Resource key is missing
at
org.globus.wsrf.impl.ResourceHomeImpl.find(ResourceHomeImpl.java:249)
at org.globus.wsrf.impl.ResourceContextImpl.getResource
(ResourceContextImpl.java:164)
at
org.globus.replica.replicator.service.ReplicationServiceImpl.start(Repli
cationServiceImpl.java:152)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
at java.lang.reflect.Method.invoke (Method.java:585)
at org.apache.axis.providers.java.RPCProvider.invokeMethod
(RPCProvider.java:384)
at
org.globus.axis.providers.RPCProvider.invokeMethodSub(RPCProvider.java:1
07)
at org.globus.axis.providers.PrivilegedInvokeMethodAction.run
(PrivilegedInvokeMethodAction.java:42)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:396)
at org.globus.gsi.jaas.GlobusSubject.runAs
(GlobusSubject.java:55)
at org.globus.gsi.jaas.JaasSubject.doAs(JaasSubject.java:90)
at
org.globus.axis.providers.RPCProvider.invokeMethod(RPCProvider.java:97)
at org.apache.axis.providers.java.RPCProvider.processMessage
(RPCProvider.java :281)
at
org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:319
)
at
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.j
ava:32)
at org.apache.axis.SimpleChain.doVisiting (SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at
org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:450)
at org.apache.axis.server.AxisServer.invoke
(AxisServer.java:285)
at
org.globus.wsrf.container.ServiceThread.doPost(ServiceThread.java:664)
at
org.globus.wsrf.container.ServiceThread.process(ServiceThread.java:382)
at org.globus.wsrf.container.GSIServiceThread.process
(GSIServiceThread.java:147)
at
org.globus.wsrf.container.ServiceThread.run(ServiceThread.java:291)
{ http://xml.apache.org/axis/}hostname:gridportal
<http://xml.apache.org/axis/%7Dhostname:gridportal>
org.globus.wsrf.InvalidResourceKeyException: Resource key is missing
at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.ja
va:221)
at org.apache.axis.message.SOAPFaultBuilder.endElement
(SOAPFaultBuilder.java:128)
at
org.apache.axis.encoding.DeserializationContext.endElement(Deserializati
onContext.java:1087)
at org.apache.xerces.parsers.AbstractSAXParser.endElement
(Unknown Source)
at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDis
patcher.dispatch(Unknown Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unkno
wn Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse (Unknown
Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
Source)
at javax.xml.parsers.SAXParser.parse(SAXParser.java :375)
at
org.apache.axis.encoding.DeserializationContext.parse(DeserializationCon
text.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:645)
at org.apache.axis.Message.getSOAPEnvelope (Message.java:424)
at
org.apache.axis.message.addressing.handler.AddressingHandler.processClie
ntResponse(AddressingHandler.java:305)
at
org.apache.axis.message.addressing.handler.AddressingHandler.invoke
(AddressingHandler.java:110)
at
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.j
ava:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke (SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:190)
at org.apache.axis.client.Call.invokeEngine(Call.java:2727)
at org.apache.axis.client.Call.invoke(Call.java :2710)
at org.apache.axis.client.Call.invoke(Call.java:2386)
at org.apache.axis.client.Call.invoke(Call.java:2309)
at org.apache.axis.client.Call.invoke(Call.java:1766)
at
org.globus.replica.replicator.generated.bindings.ReplicatorPortTypeSOAPB
indingStub.start (ReplicatorPortTypeSOAPBindingStub.java:1215)
at Conn2DRS.main(Conn2DRS.java:155)
2007/7/24, Robert Schuler <[EMAIL PROTECTED]>:
Could you post the stack trace for the exception?
Rob
________________________________
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of fei chen
Sent: Saturday, July 21, 2007 7:23 PM
To: gt-user
Subject: [gt-user] DRS in gt4
Hi,there:
Is there any one who had developed with DRS?
Following the DRS develop guide, I worte a piece of java code to test
DRS . Unfortunately,I got an exception: string index out of range -1;
But I had not use any array in my code.
Why? What's the problem?
Thank you for your attention!!
************************************
Michael
2007-1-22
************************************