Archived
This forum has been archived. Please start a new discussion on GitHub.
slice2java task source code
xdm
La Coruña, Spain
in Help Center
Hello Zeroc
is slice2javaTask code open
is slice2javaTask code open
0
Comments
-
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 seeApache 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/INSTALLThe 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é0 -
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é0 -
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 useModule C { interface Foo { ::A::B* getB(); }; };
But inside module A you can simple use Bmodule 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,
Jose0 -
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
thanks0 -
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.0 -
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:2590 -
Please see this FAQ.0
-
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)0
