on 02-04-2015 12:07 PM
Hi,
I was creating a HTTP destination but getting below exception.
OUTPUT:
Start line
ctx : javax.naming.InitialContext@f32b694
Completed Step 1
tc~sec~destinations~service
Completed Step 2
Inside if of dstService
com.sap.engine.services.jndi.persistent.exceptions.NamingException: <--Localization failed: ResourceBundle='com.sap.engine.services.jndi.persistent.JNDIResourceBundle', ID='Destination Service not available', Arguments: []--> : Can't find resource for bundle java.util.PropertyResourceBundle, key Destination Service not available
at Client.main(Client.java:46)
-----------------------------------------------------------------------------------------------------
below is the code. I think the code is not getting destination service object from server. What is the step to add "destinationservice" in SAP NW 731 portal?
import java.rmi.RemoteException;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import com.sap.engine.services.jndi.persistent.exceptions.NamingException;
import com.sap.security.core.server.destinations.api.DestinationException;
import com.sap.security.core.server.destinations.api.DestinationService;
import com.sap.security.core.server.destinations.api.HTTPDestination;
public class Client {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Hashtable<String, String> env = new Hashtable<String, String>();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");
env.put(Context.PROVIDER_URL, "<HostName>:<P4_port>");
env.put(Context.SECURITY_PRINCIPAL, "<user>");
env.put(Context.SECURITY_CREDENTIALS, "<password>");
try{
System.out.println("Start line");
Context ctx = new InitialContext(env);
System.out.println("ctx : " +ctx.toString());
System.out.println("Completed Step 1");
System.out.println(DestinationService.JNDI_KEY);
DestinationService dstService = (DestinationService)ctx.lookup(DestinationService.JNDI_KEY); //getting null at this line
System.out.println("Completed Step 2");
if (dstService == null){
System.out.println("Inside if of dstService");
ctx.close();
throw new NamingException("Destination Service not available");
}
//Note: this only created the destination
//it needs to be stored using dstService.storeDestination
System.out.println("Completed Step 4");
HTTPDestination destination = (HTTPDestination)
dstService.createDestination("HTTP");
destination.setUrl("http://<host>:<HTTP_port>");
destination.setName("UMEConnection");
destination.setUsernamePassword("<userName>", "<password>");
dstService.storeDestination("HTTP", destination);
}catch(DestinationException | RemoteException | javax.naming.NamingException e){
e.printStackTrace();
}
}
}
The ctx is coming as null.
Hi Aligan,
Have you checked your stub (DestinationService.JNDI_KEY)? Please try by passing as a hard coded value.
Thanks,
Hamendra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Hamendra,
Even after hard coding DestinationService.JNDI_KEY to tc~sec~destinations~service in the code, I am getting dstService = null.
Is there anything else I need to change in SAP portal NWA?
Is there any way to check the destination services that are available in SAP Portal?
Thanks
Alingan Patra
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.