Hi ,
I want using MDS service classes to get some information . but when I run my
code , I see this error :
-----------------------------
[EMAIL PROTECTED]:/usr/local/globus-4.0.3> java MDSclass
MDS Running
Hiiiiiiiiiiiiiiiii1111
Hiiiiiiiiiiiiiiiii2222
java.rmi.RemoteException: Error when accessing index service entry.; nested
exception is:
java.lang.NullPointerException
at MDSclass.find(MDSclass.java:214)
at MDSclass.main(MDSclass.java:63)
Caused by: java.lang.NullPointerException
at MDSclass.find(MDSclass.java:176)
... 1 more
-----------------------------
I don't know what this error ?
my code contain this:
public class MDSclass
{
static {
Util.registerTransport();
}
public static void main (String args[])
{
MDSclass MDS = new MDSclass();
System.out.print("\nMDS Running \n\n");
try
{
MDS.find();
System.out.print("\n\nsubmitting job ...\n");
}
catch (Exception e)
{
e.printStackTrace();
}
}
public void find() throws RemoteException {
String indexURI = "
https://omid:8443/wsrf/services/DefaultIndexService";
EndpointReferenceType indexEPR = new EndpointReferenceType();
try {
indexEPR.setAddress(new Address(indexURI));
} catch (Exception e) {
throw new RemoteException("ERROR: Malformed index URI '" +
indexURI + "'", e);
}
// Get QueryResourceProperties portType
WSResourcePropertiesServiceAddressingLocator queryLocator;
queryLocator = new WSResourcePropertiesServiceAddressingLocator();
QueryResourceProperties_PortType query = null;
try {
query = queryLocator.getQueryResourcePropertiesPort(indexEPR);
} catch (ServiceException e) {
throw new RemoteException(
"ERROR: Unable to obtain query portType.", e);
}
((Stub)
query)._setProperty(Constants.GSI_SEC_CONV,Constants.ENCRYPTION);
((Stub)
query)._setProperty(GSIConstants.GSI_MODE,GSIConstants.GSI_MODE_FULL_DELEG);
((Stub)
query)._setProperty(Constants.AUTHORIZATION,HostAuthorization.getInstance());
// The following XPath query retrieves all the files with the
specified
// name
String xpathQuery = "//*[local-name()='Address']";
// Create request to QueryResourceProperties
QueryExpressionType queryExpr = new QueryExpressionType();
try {
queryExpr.setDialect(new URI(WSRFConstants.XPATH_1_DIALECT));
} catch (Exception e) {
throw new RemoteException(
"ERROR: Malformed URI (WSRFConstants.XPATH_1_DIALECT)",
e);
}
queryExpr.setValue(xpathQuery);
QueryResourceProperties_Element queryRequest = new
QueryResourceProperties_Element(
queryExpr);
// Invoke QueryResourceProperties
QueryResourcePropertiesResponse queryResponse = null;
try {
queryResponse = query.queryResourceProperties(queryRequest);
} catch (RemoteException e) {
throw new RemoteException(
"ERROR: Unable to invoke QueryRP operation.", e);
}
// The response includes 0 or more entries from the index service.
MessageElement[] entries = queryResponse.get_any();
// If the number of entries is 0, there are no files with that name.
if (entries == null || entries.length == 0) {
System.out.println("Number Of Entrys equals Zero");
} else {
for (int i = 0; i < entries.length; i++) {
try {
// Access information contained in the entry. First of
all,
// we need to deserialize the entry...
EntryType entry = (EntryType)
ObjectDeserializer.toObject(
entries[i], EntryType.class);
System.out.println("Hiiiiiiiiiiiiiiiii1111");
AggregatorContent content = (AggregatorContent)
entry.getContent();
System.out.println("Hiiiiiiiiiiiiiiiii2222");
// ... then the data ...
AggregatorData data = content.getAggregatorData();
System.out.println("Hiiiiiiiiiiiiiiiii3333");
System.out.println("Hiiiiiiiiiiiiiiiii4444");
String IP = (String)data.get_any()[0].getValue();
System.out.println(IP);
} catch (Exception e) {
throw new RemoteException(
"Error when accessing index service entry.", e);
}
}
}
}
}
-----------------------
do anyone can help me to solve this problem ?
Thanks.
Omid.