Home Help Center

slice2java task source code

xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
Hello Zeroc

is slice2javaTask code open

Comments

  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Yes, look in the ant subdirectory of the IceJ archive.

    - Mark
  • lakshmiKlakshmiK Member Lakshmi kondapiOrganization: ItechU.SProject: Printer
    slice2javaTask

    I tried to build build.xml file. I got the below error

    taskdef class Slice2JavaTask cannot be found
  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    You need to ensure that ant-jar.jar is in your CLASSPATH.
  • lakshmiKlakshmiK Member Lakshmi kondapiOrganization: ItechU.SProject: Printer
    slice2javaTask

    Yes, the ant-1.6.5.jar is in the path. I'm using the MyEclipse IDE, It has got default ant. Still it is saying the taskdef class Slice2JavaTask cannot be found.
  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    You need to ensure that ant-ice.jar (not ant-jar.jar, or ant-1.6.5.jar) from the Ice distribution, which contains the implementation for the slice2java task, is your in CLASSPATH.
  • lakshmiKlakshmiK Member Lakshmi kondapiOrganization: ItechU.SProject: Printer
    build.xml

    When I was trying to build build.xml. I got this error

    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/Main


    Thanks
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi Lakshmi

    From the error message seems that your ant distribution is not working fine.

    What is the output of ant -version in your system

    if ant is property installed you should see
    Apache Ant version 1.7.0 compiled on December 13 2006

    Note you need ant 1.7.0 or later for build Ice Java, quoted from Ice-3.3.0/java/INSTALL
    The Ice for Java build system requires Apache Ant 1.7.0 or later. Ant
    is available at the link below:

    Apache Ant - Welcome

    Regards,
    José
  • lakshmiKlakshmiK Member Lakshmi kondapiOrganization: ItechU.SProject: Printer
    build.xml

    I'm using Myelipse ide . So ant comes automaticlaly with that right?
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi lakshmiK,

    I´m not use Eclipse Ide and can help you with that, by the way seems that the problem is the ant eclipse integration, you should check Eclipse help for ant builds.

    Regards,
    José
  • lakshmiKlakshmiK Member Lakshmi kondapiOrganization: ItechU.SProject: Printer
    builtinsequences

    How would I set the path for the Builtinsequences.ice in the build.xml file?

    Could you please let me know the examples ?

    thanks
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi LakshmiK

    You need to use appropiate includepath in your Slice2Java task
        <target name="generate">
            <!-- Create the output directory for generated code -->
            <mkdir dir="generated"/>
            <slice2java outputdir="generated">
                <fileset dir="slice" includes="*.ice"/>
                [B]<includepath>
                    <pathelement path="c:\Ice-3.3.0-VC90\slice"/>
                </includepath>[/B]
            </slice2java>
        </target>
    

    Then in your slice definitions you only need to wrote
    #include <Ice/BuiltinSequences.ice>
    

    Regards,
    José
  • lakshmiKlakshmiK Member Lakshmi kondapiOrganization: ItechU.SProject: Printer
    Sequences

    I'm Learning ICe.
    Is sequence<FileSystemPr::PrStruct>optPr; same as
    sequence<PrStruct>optPr; If not, what is the differnce between two?

    I need some examples simliar to this.

    thanks.
  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    They may or may not be the same, depending on the module in which they are being referenced. One is using a fully qualified name, the other is not.
  • lakshmiKlakshmiK Member Lakshmi kondapiOrganization: ItechU.SProject: Printer
    Sequences

    sequence<FileSystemPr::PrStruct>optPr

    what is :: mean ?
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi lakshmiK

    :: is used to separate module names in slice definitions;
    module A
    {
       Interface B
       {
             //...
       };
    };
    

    To refer to interface B in ohter module than A you should use
    Module C
    {
         interface Foo
         {
             ::A::B* getB();
         };
    };
    

    But inside module A you can simple use B
    module A
    {
         interface Foo
         {
             B* getB();
         };
    };
    

    in both case getB returns a proxy to an interface of type B defined inside module A.

    The concept is similar to what namespaces are in c++ or packages in java.

    I first edited your post, i moved the reply to a new post

    Regards,
    Jose
  • lakshmiKlakshmiK Member Lakshmi kondapiOrganization: ItechU.SProject: Printer
    slice2javaTask

    Thanks for your reply. In the below code. the interface Reser has a method getdata right? Is it going to return the PStruct or void?

    Actually I want to call this method in my java file.
    First.ice

    module printer
    {
    enum enumtype{type1,dataType,DetailsType};

    struct PrStruct
    {
    enumtype memberType;
    string errorMsg;
    PRData data;
    };

    }





    second.ice


    #include <First.ice>

    module ReserInfo
    {

    enum SearchType {Exact,Contain};
    sequence<First::PnrStruct> OptPr;
    struct Info
    {
    string RecLoc;

    string CreationDateTime;
    };
    sequence<Info> MList;

    exception PrException
    {
    string errMessage;
    };

    exception PrNotFound extends PrException
    {
    };

    exception OldPrException extends PrException
    {
    };


    Interface Reser
    {


    ["nonmutating"] idempotent First::PStruct getdata(string RecLoc) throws PrException;
    OptPr setPr(Ice::ByteSeq Pr) throws PrException;

    };

    };


    #endif

    thanks
  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    It returns First::PStruct, not void. If it was to return a void it would be void getdata.

    I strongly suggest you read the slice mapping chapter of the Ice manual. It answers all of these questions, and more. Without studying this chapter, along with the java mapping chapter then you'll never really understand how things hang together.
  • lakshmiKlakshmiK Member Lakshmi kondapiOrganization: ItechU.SProject: Printer
    Connection error

    I'm trying to connect to the Iceserver. I got the below errors:

    Ice.ConnectionRefusedException
    error = 0
    at IceInternal.Network.doConnect(Network.java:284)
    at IceInternal.TcpConnector.connect(TcpConnector.java:25)
    at IceInternal.OutgoingConnectionFactory.create(OutgoingConnectionFactory.java:308)
    at IceInternal.RoutableReference.createConnection(RoutableReference.java:379)
    at IceInternal.DirectReference.getConnection(DirectReference.java:192)
    at Ice._ObjectDelM.setup(_ObjectDelM.java:258)
    at Ice.ObjectPrxHelperBase.__getDelegate(ObjectPrxHelperBase.java:905)
    at Ice.ObjectPrxHelperBase.ice_isA(ObjectPrxHelperBase.java:73)
    at Ice.ObjectPrxHelperBase.ice_isA(ObjectPrxHelperBase.java:61)
    at Resfo.ReseHelper.checkedCast(ReseHelper.java:298)
    Caused by: java.net.ConnectException: Connection refused: no further information
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(Unknown Source)
    at IceInternal.Network.doConnect(Network.java:259
  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    Please see this FAQ.
  • lakshmiKlakshmiK Member Lakshmi kondapiOrganization: ItechU.SProject: Printer
    slice2javaTask

    Hi,

    What could be the cause for the below error:?


    Exception in thread "main" Ice.ObjectNotExistException
    id.name = "Ice"
    id.category = ""
    facet = ""
    operation = "ice_isA"
    at IceInternal.Outgoing.invoke(Outgoing.java:148)
    at Ice._ObjectDelM.ice_isA(_ObjectDelM.java:31)
    at Ice.ObjectPrxHelperBase.ice_isA(ObjectPrxHelperBase.java:74)
    at Ice.ObjectPrxHelperBase.ice_isA(ObjectPrxHelperBase.java:61)
    at Res.ResPrxHelper.checkedCast(ResPrxHelper.java:298)
  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    Please read the manual! This forum cannot serve as a substitute for reading our documentation.
  • lancepwlancepw Member Lance WelshOrganization: BooyahProject: iPhone
    basic Slice2JavaTask ant question

    What's the proper way to add an arg, such as --tie, to the slice compiler using the build.xml and config/common.xml structures like in the demos?
  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi,

    If you're using our slice2java ant task, you would pass options to the task like this:
    <slice2java outputdir="${generated.dir}" tie="on" stream="on">
        ...
    </slice2java>
    
    Hope that helps,
    Mark
Sign In or Register to comment.