on 10-09-2007 4:01 PM
Dear All,
I have just written a small program using NWDS (Netweaver developer Studio). The code includes the following line:-
HttpRequestSender requestSender = new HttpRequestSender(url,"user1","abc");
The program has the following imports:-
import com.sap.lcr.api.cimclient.CIMClient;
import com.sap.lcr.api.cimclient.CIMOMClient;
import com.sap.lcr.api.cimclient.ClientFactory;
import com.sap.lcr.api.cimclient.HttpRequestSender;
import com.sap.lcr.api.sapmodel.SAP_AppServJCODestination;
import com.sap.lcr.api.sapmodel.SAP_JCODestination;
import com.sap.lcr.api.sapmodel.SAP_JCODestinationAccessor;
import com.sap.lcr.api.sapmodel.SAP_MsgServJCODestination;
import com.sap.mw.jco.JCO;
import com.tssap.dtr.client.lib.protocol.URL;
I get the following error when I build the project:-
The constructor HttpRequestSender(URL, String, String) is deprecated
Can anyone kindly tell me why I am getting this message and how to resolve it?
Kind Regards
Chris Jackson
Hi C. Jackson!
Try this:
At NWDS go to Window->Preferences->Java->Compiler, and mark the combo 'Usage of Deprecated API' with 'Warning'.
Note that this only will let you build your project, the greatest solution is finding out another non-deprecated method...
Hope this helps you.
Eneko.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Eneko,
Thanks for that. By the way, I am now trying to compile the following .java program.....
/*
Created on 01-Oct-2007
*
To change the template for this generated file go to
Window>Preferences>Java>Code Generation>Code and Comments
*/
/**
@author chris.jackson
*
To change the template for this generated type comment go to
Window>Preferences>Java>Code Generation>Code and Comments
*/
import com.sap.lcr.api.cimclient.CIMClient;
import com.sap.lcr.api.cimclient.CIMClientHandle;
import com.sap.lcr.api.cimclient.CIMOMClient;
import com.sap.lcr.api.cimclient.ClientFactory;
import com.sap.lcr.api.sapmodel.SAP_AppServJCODestination;
import com.sap.lcr.api.sapmodel.SAP_JCODestination;
import com.sap.lcr.api.sapmodel.SAP_JCODestinationAccessor;
import com.sap.lcr.api.sapmodel.SAP_MsgServJCODestination;
import com.sap.mw.jco.JCO;
import com.tssap.dtr.client.lib.protocol.URL;
public class sldpoke {
public void main() {
ClientFactory factory = ClientFactory.newInstance();
try {
final URL url = new URL("http://ex1d002a.eu.unilever.com:58300/sld/cimom");
String sldUsername = "cjacks01";
String sldPassword = "password";
CIMOMClient cimomClient = factory.createClient (url, sldUsername, sldPassword);
CIMClient cc = new CIMClient(cimomClient);
CIMClientHandle cch = (CIMClientHandle) cc;
SAP_JCODestinationAccessor jcoAccessor = new SAP_JCODestinationAccessor(cc);
SAP_JCODestination[] jcoDestinations = jcoAccessor.enumerateSAP_JCODestinationInstances();
JCO.Client jcoClient = null;
String user = null;
String pwd = null;
// iterate over all destinations
for (int i = 0; i < jcoDestinations.length; i++)
{
SAP_JCODestination jcoDestination = jcoDestinations<i>;
user = jcoDestination.getLogonUser();
pwd = jcoDestination.getLogonPwd();
if (jcoDestination instanceof SAP_AppServJCODestination)
{
SAP_AppServJCODestination jcoDest = (SAP_AppServJCODestination) jcoDestination;
jcoClient = JCO.createClient(jcoDest.getLogonBCClient(),
user,
pwd,
jcoDest.getLogonLanguage(),
jcoDest.getAppServHost(),
jcoDest.getAppServNumber());
}
else if (jcoDestination instanceof SAP_MsgServJCODestination)
{
SAP_MsgServJCODestination jcoDest = (SAP_MsgServJCODestination) jcoDestination;
jcoClient = JCO.createClient(jcoDest.getLogonBCClient(),
user,
pwd,
jcoDest.getLogonLanguage(),
jcoDest.getMsgServHost(),
jcoDest.getSAPSystemName(),
jcoDest.getLogonGroup());
}
}
} catch (Exception e) {
}
}
}
and I am getting the message "The selection does not contain a main type". Any ideas how I progress?
Kind Regards
Chris Jackson.
> Hi Eneko,
>
> Thanks for that. By the way, I am now trying to
> compile the following .java program.....
>
> [...]
>
> public class sldpoke {
>
> public void main() {
>
> [...]
>
> }
The "main" method of a class must have a specific signature, try
public static void main(String[] args) {
...
}
instead.
Regards,
Jens
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.