Ah, you have GT 4.2.0 installed, right?
If so, then the imports from the gt4 book don't fit, because those refer to GT 
4.0.
A few things changed in 4.2, including Java package structures.

The best way for programming with GT and the gt4 book is probably to
install GT 4.0.8 and load the names of the archives into your classpath from
the GT 4.0.8 install (source ...globus-devel-env.sh) .

Then all package names should be right.

Martin

omid boroumand wrote:
Hi,
I accoplish what you said in your reply. but after this , ever i see this error :
---------------
[EMAIL PROTECTED]:/usr/local/GT4-examples/gt4book-examples>
source $GLOBUS_LOCATION/etc/globus-devel-env.sh

[EMAIL PROTECTED]:/usr/local/GT4-examples/gt4book-examples> javac SubmitJob.java
SubmitJob.java:14: package org.apache.axis.message.addressing does not exist
import org.apache.axis.message.addressing.EndpointReferenceType;
                                          ^
SubmitJob.java:15: package org.apache.axis.message.addressing does not exist
import org.apache.axis.message.addressing.ReferencePropertiesType;
                                          ^
SubmitJob.java:16: package org.apache.axis.message.addressing does not exist
import org.apache.axis.message.addressing.Address;
                                          ^
SubmitJob.java:24: cannot find symbol
symbol  : class Authorization
location: package org.globus.wsrf.impl.security.authorization
import org.globus.wsrf.impl.security.authorization.Authorization;
                                                   ^
SubmitJob.java:51: cannot find symbol
symbol  : class EndpointReferenceType
location: class SubmitJob
      EndpointReferenceType endpoint = new EndpointReferenceType();
      ^
SubmitJob.java:51: cannot find symbol
symbol  : class EndpointReferenceType
location: class SubmitJob
      EndpointReferenceType endpoint = new EndpointReferenceType();
                                           ^
SubmitJob.java:52: cannot find symbol
symbol  : class Address
location: class SubmitJob
endpoint.setAddress(new Address("https://omid:8443/wsrf/services/ManagedJobFactoryService";));
                              ^
SubmitJob.java:53: cannot find symbol
symbol  : class ReferencePropertiesType
location: class SubmitJob
      ReferencePropertiesType props = new ReferencePropertiesType();
      ^
SubmitJob.java:53: cannot find symbol
symbol  : class ReferencePropertiesType
location: class SubmitJob
      ReferencePropertiesType props = new ReferencePropertiesType();
                                          ^
SubmitJob.java:65: cannot find symbol
symbol  : class Authorization
location: class SubmitJob
      Authorization authz = HostAuthorization.getInstance();
      ^
Note: SubmitJob.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
10 errors
----------------------
my SubmitJob.java contains this :

import javax.xml.namespace.QName;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
import org.apache.axis.components.uuid.UUIDGen;
import org.apache.axis.components.uuid.UUIDGenFactory;
import org.apache.axis.message.addressing.EndpointReferenceType;
import org.apache.axis.message.addressing.ReferencePropertiesType;
import org.apache.axis.message.addressing.Address;
import org.globus.exec.client.GramJob;
import org.globus.exec.client.GramJobListener;
import org.globus.exec.generated.StateEnumeration;
import org.globus.exec.generated.JobDescriptionType;
import org.globus.exec.generated.FilePairType;
import org.globus.exec.utils.ManagedJobConstants;
import org.globus.wsrf.impl.security.authentication.Constants;
import org.globus.wsrf.impl.security.authorization.Authorization;
import org.globus.wsrf.impl.security.authorization.HostAuthorization;
import org.globus.wsrf.impl.SimpleResourceKey;

public class SubmitJob implements GramJobListener
{
   private static Object waiter = new Object();

   public static void main (String args[])
   {
        SubmitJob client = new SubmitJob();
       System.out.print("submitting job ... ");
       try {
         client.submitJob();
         System.out.println("done");
         System.out.println("Waiting for notification messages ...");
         synchronized (waiter) {
            waiter.wait();
         }
       } catch (Exception e) {
           e.printStackTrace();
       }
}
   public void submitJob() throws Exception
   {
      // create factory epr
      EndpointReferenceType endpoint = new EndpointReferenceType();
endpoint.setAddress(new Address("https://omid:8443/wsrf/services/ManagedJobFactoryService";));
      ReferencePropertiesType props = new ReferencePropertiesType();
      SimpleResourceKey key
                  = new SimpleResourceKey(
                           ManagedJobConstants.RESOURCE_KEY_QNAME,
                           "Fork");
      props.add(key.toSOAPElement());
      endpoint.setProperties(props);

      // job rsl
String rsl = "<job><executable>/bin/sleep</executable><argument>1</argument></job>"; // setup security
      Authorization authz = HostAuthorization.getInstance();
      Integer xmlSecurity = Constants.ENCRYPTION;

      boolean batchMode = false;
      boolean limitedDelegation = true;
// generate job uuid
      UUIDGen uuidgen   = UUIDGenFactory.getUUIDGen();
      String submissionID = "uuid:" + uuidgen.nextUUID();

      GramJob job = new GramJob(rsl);
      job.setAuthorization(authz);
      job.setMessageProtectionType(xmlSecurity);
      job.setDelegationEnabled(true);
      job.addListener(this);

      job.submit(endpoint,
                 batchMode,
                 limitedDelegation,
                 submissionID);
   }

   // GramJob calls this method when a job changes its state
   // It's part of GramJobListener Interface
   public void stateChanged(GramJob job)
   {
        StateEnumeration jobState = job.getState();
System.out.println(" got state notifiation: job is in state " + jobState);
        try {
            //System.out.println("refreshing status: ");
            //job.refreshStatus();
           // System.out.println("state is: " + job.getState());
        } catch (Exception e) {
             e.printStackTrace();
        }

        if (jobState.equals(StateEnumeration.Done)
            || jobState.equals(StateEnumeration.Failed)) {
            System.out.print("job finished. destroying job resource ... ");
            try {
                job.removeListener(this);
                job.destroy();
            } catch (Exception e) {
               e.printStackTrace();
            } finally {
               System.out.println("done");
               synchronized (waiter) {
                   waiter.notify();
               }
            }
        }
   }

this code is the same code that write by other users in this group.
can you help me  to solve this problem and say me what can i do ?
Thanks.
Omid.

2008/8/14 Martin Feller <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>

    Importing is not enough, you have to add required java archives to your
    classpath before compiling. These are GT4 provided archives and the
    archives that contain the stubs that are created when you build your
    program.

    How to add the GT archives to you classpath:
      source $GLOBUS_LOCATION/etc/globus-devel-env.sh

    Once you have all necessary jars in you classpath try to compile again.

    http://gdp.globus.org/gt4-tutorial/multiplehtml/index.html
    is a good starting point for programming with GT4

    Martin

    omid boroumand wrote:

        Hi,
        Thanks for your help.
        I look at the GRAM document and then write  a simple  program .
        in this program  I import  some  classes  but  when  compile
         program  with  javac  , i see this error :
        ------------------
        [EMAIL PROTECTED]:/usr/local/GT4-examples/gt4book-examples> javac
         SubmitJob.java

        SubmitJob.java:3: package org.apache.axis.message.addressing
        does not exist
        import org.apache.axis.message.addressing.Address;
                                                 ^
        SubmitJob.java:4: package org.apache.axis.message.addressing
        does not exist
        import org.apache.axis.message.addressing.EndpointReferenceType;
                                                 ^
        SubmitJob.java:5: package org.globus.examples.stubs.Factory does
        not exist
        import org.globus.examples.stubs.Factory.CreateResource;
                                                ^
        SubmitJob.java:6: package org.globus.examples.stubs.Factory does
        not exist
        import org.globus.examples.stubs.Factory.CreateResourceResponse;
                                                ^
        SubmitJob.java:7: package org.globus.examples.stubs.Factory does
        not exist
        import org.globus.examples.stubs.Factory.FactoryPortType;
                                                ^
        SubmitJob.java:8: package
        org.globus.examples.stubs.Factory.service does not exist
        import
        
org.globus.examples.stubs.Factory.service.FactoryServiceAddressingLocator;
                                                        ^
        SubmitJob.java:24: package org.apache.axis.message.addressing
        does not exist
        import org.apache.axis.message.addressing.AttributedURI;
                                                 ^
        ------------------
        Do you can help me that how I can to introduce needed package to
        my programs?
        Thanks.
        Omid.

        2008/8/13 Maciej Nowicki <[EMAIL PROTECTED]>

           Dnia 13-08-2008 o godz. 23:14 omid boroumand napisał(a):

           Surround line

           JobDescriptionType jobDescription =
           RSLHelper.readRSL(jobDescriptionFile);

           with try - catch (RSLParseException) block.

           I see you don't use any IDE like Eclipse - I strongly advise
        you to do
           so - it'll help you in dealing with errors like this one and
        therefore
           speed up your development.

           And remember submitting a job in java is much mroe than just
        those four
           lines of code - take a look on WS-GRAM documentation at
           www.globus.org/toolkit <http://www.globus.org/toolkit>
        <http://www.globus.org/toolkit>


            > Hi,
            > i installed GT4.2 and  want submit job with client API to
        globus.
            > but when i compile the ' SubmitJob.java '  , I see this
        error :
            > -------------
            > [EMAIL PROTECTED]:/usr/local/GT4-examples> javac -classpath
           ./build/stubs/classes/:$CLASSPATH SubmitJob.java
            > SubmitJob.java:71: unreported exception
           org.globus.exec.utils.rsl.RSLParseException; must be caught
        or declared
           to be thrown
            >                 JobDescriptionType jobDescription =
           RSLHelper.readRSL(jobDescriptionFile);

            > public class SubmitJob {
            >
            >
            >     public static void main(String[] args)
            >     {
            >         File jobDescriptionFile = new File("Test_Job.xml");
            >     JobDescriptionType jobDescription =
           RSLHelper.readRSL(jobDescriptionFile);
            >
            >     GramJob TestJob=new GramJob(jobDescription);
            >     TestJob.submit(omid:8443);
            >     }
            > }
           pozdrawiam / kind regards
           Maciej Nowicki

           ----------------------------------------------------
           Efekciarskie auta, noweczesne gadżety, wytworne szmatki.
           Lajfstajlowy serwis dla koneserów prawdziwego luksusu.
           Zobacz: http://klik.wp.pl/?adr=www.LuxClub.pl&sid=451
        <http://klik.wp.pl/?adr=www.LuxClub.pl&sid=451>
           <http://klik.wp.pl/?adr=www.LuxClub.pl&sid=451
        <http://klik.wp.pl/?adr=www.LuxClub.pl&sid=451>>






Reply via email to