Skip to Content
0
Former Member
Mar 12, 2015 at 04:32 AM

How to handle Destination exception

212 Views

Hi Champs,

I am using destination service. When I am throwing or catching Destination exception it is giving error

No exception of type DestinationException can be thrown; an exception type must be a subclass of Throwable

NWDS 7.3 SP 8

Dependency : tc/bl/security/destinations/api

Examples for Using the Destination Service API - Using Java - SAP Library

import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
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;

Context ctx = new InitialContext();
DestinationService dstService = (DestinationService)
ctx.lookup(DestinationService.JNDI_KEY);

if (dstService == null)
throw new NamingException("Destination Service not available");

Destination destination = dstService.getDestination("HTTP","dst-1");
//for HTTP destination: cast
HTTPDestination httpDestination = (HTTPDestination) destination;
//obtain a HTTPUrlConnection from the destinationHttpURLConnection
httpConnection = httpDestination.getURLConnection();



Please help me how to fix this issue