on 04-14-2006 10:54 AM
Hi all,
I inserted an HTTP destination in the Destination Service (Visual administrator) and I need to get it in my Java Web Dympro. I found this code:
DestinationService dstService = (DestinationService)
ctx.lookup(DestinationService.JNDI_KEY);
if (dstService == null)
throw new NamingException("Destination Service not available");
Destination destination = dstService.getDestination("HTTP","sso_givaudan_OpportunityLink");
// for HTTP destination: cast
HTTPDestination httpDestination = (HTTPDestination) destination;
// obtain a HTTPUrlConnection from the destinationHttpURLConnection
httpConnection = httpDestination.getURLConnection();
I imported all the libraries, but NetWeaver underline in red the follow:
ctx : cannot be resolved
Why?? Thanks for your help.
Vito
Hi,
>>"httpConncetion cannot be resolved!!!" what type is httpConnection ?? WHat library I have to import??
The type of httpConnection is HttpURLConnection.
You need to import this <b>java.net.HttpURLConnection</b>.
Regards,
Uma
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Uma,
I'm tring to catch the URL set in the Visual Administrator, in the Destination service.
I added the following code with no sintax error:
try {
InitialContext ctx = new InitialContext();
DestinationService dstService = (DestinationService) ctx.lookup(DestinationService.JNDI_KEY);
if (dstService == null)
throw new NamingException("Destination Service not available");
try{
Destination destination = dstService.getDestination("HTTP","sso_givaudan_OpportunityLink");
//for HTTP destination: cast
HTTPDestination httpDestination = (HTTPDestination) destination;
//obtain a HTTPUrlConnection from the destinationHttpURLConnection
HttpURLConnection httpConnection = httpDestination.getURLConnection();
urlOpportunityLink = httpConnection.toString(); //return the http address
} catch (IDException ex) {}
catch (RemoteException ex) {};
} catch (NamingException e) {};
wdContext.getCurrentElement().setAttributeValue("OpportunityLink",urlOpportunityLink);
When I launch the application (Java WD) I have the follow exception:
An error has occurred:
"Failed to process the request."
Please contact your system administrator.
--------------------------------------------------------------------------------
Hide details
This page was created by SAP NetWeaver. All rights reserved.
Web Dynpro client:
HTML Client
Web Dynpro client capabilities:
User agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322), client type: msie6, client type profile: ie6, ActiveX: enabled, Cookies: enabled, Frames: enabled, Java applets: enabled, JavaScript: enabled, Tables: enabled, VB Script: enabled
Accessibility mode: false
Web Dynpro runtime:
Vendor: SAP, build ID: 7.0004.20050812153807.0000 (release=645_VAL_REL, buildtime=2005-09-21:09:00:55[UTC], changelist=362988, host=pwdfm101), build date: Thu Jan 19 11:02:30 CET 2006
Web Dynpro code generators of DC local/GivaudanNavigation:
SapDictionaryGenerationCore: 7.0004.20050713144105.0000 (release=645_VAL_REL, buildtime=2005-09-19:09:56:45[UTC], changelist=357691, host=PWDFM101.wdf.sap.corp)
SapMetamodelWebDynpro: 7.0004.20050713144450.0000 (release=645_VAL_REL, buildtime=2005-09-19:09:58:47[UTC], changelist=357707, host=PWDFM101.wdf.sap.corp)
SapMetamodelCore: 7.0004.20050713144259.0000 (release=645_VAL_REL, buildtime=2005-09-19:09:50:51[UTC], changelist=357699, host=PWDFM101.wdf.sap.corp)
SapWebDynproGenerationTemplates: 7.0004.20050812153807.0000 (release=645_VAL_REL, buildtime=2005-09-19:10:17:37[UTC], changelist=362988, host=pwdfm101)
SapWebDynproGenerationCTemplates: 7.0004.20050812153807.0000 (release=645_VAL_REL, buildtime=2005-09-19:10:17:37[UTC], changelist=362988, host=pwdfm101)
SapGenerationFrameworkCore: 7.0004.20050713144242.0000 (release=645_VAL_REL, buildtime=2005-09-19:09:50:22[UTC], changelist=357697, host=PWDFM101.wdf.sap.corp)
SapIdeWebDynproCheckLayer: 7.0004.20050713144412.0000 (release=645_VAL_REL, buildtime=2005-09-19:10:01:14[UTC], changelist=357705, host=PWDFM101.wdf.sap.corp)
SapMetamodelDictionary: 7.0004.20050509170017.0000 (release=645_VAL_REL, buildtime=2005-09-19:09:54:51[UTC], changelist=346508, host=PWDFM101.wdf.sap.corp)
SapMetamodelCommon: 7.0004.20050713144259.0000 (release=645_VAL_REL, buildtime=2005-09-19:09:50:57[UTC], changelist=357699, host=PWDFM101.wdf.sap.corp)
SapWebDynproGenerationCore: 7.0004.20050713144412.0000 (release=645_VAL_REL, buildtime=2005-09-19:10:01:24[UTC], changelist=357705, host=PWDFM101.wdf.sap.corp)
SapDictionaryGenerationTemplates: (unknown)
Web Dynpro code generators of DC sap.com/tc~wd~dispwda: No information available!
Web Dynpro code generators of DC sap.com/tc~wd~corecomp: No information available!
J2EE Engine:
7.00 patchlevel
Java VM:
Java HotSpot(TM) Server VM, version: 1.4.2_09-b05, vendor: Sun Microsystems Inc.
Operating system:
Windows 2003, version: 5.2, architecture: x86
--------------------------------------------------------------------------------
Error stacktrace:
java.lang.ClassCastException
at com.sap.givaudan.navigation.comp.NavigationComp.wdDoInit(NavigationComp.java:127)
at com.sap.givaudan.navigation.comp.wdp.InternalNavigationComp.wdDoInit(InternalNavigationComp.java:115)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingComponent.doInit(DelegatingComponent.java:95)
at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)
at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)
at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.init(ClientComponent.java:417)
at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:401)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.getApplicationHandle(AbstractClient.java:143)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.prepareTasks(AbstractClient.java:216)
at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:647)
at com.sap.tc.webdynpro.clientserver.cal.ClientManager.parseRequest(ClientManager.java:144)
at com.sap.tc.webdynpro.clientserver.session.core.ApplicationHandle.parseRequest(ApplicationHandle.java:79)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:62)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doGet(DispatcherServlet.java:43)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:95)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:159)
Could you help me, please?? Thanks a lot.
Vito
Vito,
This could be caused by class loading issues.
Please check the following document: http://help.sap.com/saphelp_nw04/helpdata/en/17/d609b48ea5f748b47c0f32be265935/content.htm
Section "Prerequisites" outlines necessary references that must be added.
Also make sure that you are using classes from package com.sap.security.core.server.destinations.api, not from others.
VS
Hi Valery,
just others two questions for you.
1. In the documentation you suggested me is used:
httpConnection = httpDestination.getURLConnection();
This give me an error, because no library exist. Where I can find the right library for this?
2. This is a more complex question
My application is a Portal Panel that contains three tabs. When the user click on each tab a BSP is called. I do this setting a bsp http address for each tab. Now I will get the address, us string, using httpConnection.getUrl
I don't known if this is a correct way to call an external bsp, because <u>I need to call the BSP warranting the single sign-on.</u>
Perhaps, I need to open a connection to Destination URL (Note that I have: VisualAdministrator->Destination->LogonTicket authentication, and in the Security Providere->Ticket->CreateTicketLoginModule in oreder to assure the sso for my Web Dynpro).
How can I to open the BSP into the tab, using the HTTP Destination API??
This is the first time I'm working on this. I will appreciate your help.
Thanks,
Vito
Vito,
Sorry, it seems that I give you only one link instead of two.
First one:
http://help.sap.com/saphelp_nw04/helpdata/en/8b/8e7dac1e661d44bf2a676fd3948cc6/content.htm
Cut from the text:
<i><b>Prerequisites</b>
All Destinations
Your application needs classloader references to tcsecdestinationsservice and tcsecdestinationsinterface.
- For J2EE applications, add the references in the Developer Studio as described in Referencing Libraries in Applications.
- For Web Dynpro applications, add the components security.class and tc/sec/destinations/interface to your projects classpaths as described in Implementing the Server Abstraction Layer. Add the references as service and interface references accordingly.</i>
Second:
http://help.sap.com/saphelp_nw04/helpdata/en/17/d609b48ea5f748b47c0f32be265935/content.htm
Cut from its text:
<i>To be able to import those classes and compile your sources, you have to first include these libraries in your project. Choose Set Additional Libraries from the context menu for your project and add the items security.class and tc/sec/destinations/interface.</i>
VS
Valery,
I have inserted the follow in the JWD (but seems to be the same):
WedDynproReferences:
->Interface references: tc/sec/destinations/
->Service references: security.class
Is this right??
My code is:
import java.net.InetAddress;
import java.net.UnknownHostException;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import com.sap.givaudan.navigation.comp.wdp.IPrivateNavigationComp;
import com.sap.security.api.IUser;
import com.sap.security.core.server.destinations.api.Destination;
import com.sap.security.core.server.destinations.api.DestinationService;
import com.sap.security.core.server.destinations.api.HTTPDestination;
import com.sap.tc.webdynpro.services.sal.um.api.IWDClientUser;
import com.sap.tc.webdynpro.services.sal.um.api.WDClientUser;
import com.sap.tc.webdynpro.services.sal.um.api.WDUMException;
InitialContext 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();
//String url = httpDestination.getUrl();
I have the error on this row:
<i>httpConnection = httpDestination.getURLConnection();</i>
<i>"httpConnection cannot be resolved"!!!</i>
I have imported libraries: "Java build path -> Add external JARs"
I really don't understand what I wrong.
Thanks,
Vito
Vito,
Do you get this error at build time or when you deploy appliation and run it???
Also your references is wrong:
Interface references:
<b>tcsecdestinations~interface</b>
(according to "destinations_api" interface properties shown in VisualAdministrator)
Library references (it is not service!):
<b>security.class</b>
Also I provide references without "sap.com/" prefix (vendor name) you may try both reference <b>with</b> such prefix in case of errors.
VS
Sorry Valery, I'm not so smart in this.
I have set as you suggested:
- Interface references: tcsecdestinations~interface
- Library references: security.class
TRegarding the error, the netweaver underline in red the httpConnection in the line:
httpConnection = httpDestination.getURLConnection();
and says: "http connection cannot be resolved". Perhaps I have to imort a particular library (??) and give a type to httpConnection (fpr example HttpURLConncetion ??)
Thanx,
Vito
Vito,
Now it is clear: you get error at build-time.
Keep references as I suggested, but now please clarify the following:
<i>I have imported libraries: "Java build path -> Add external JARs"</i>
Could you name libraries you have added??? (exact jar names with path, you can ommit path till ".dtc" or "eclipse" directory).
VS
Valery,
I have added the follow external Jar:
C:\Program Files\SAP\IDE\IDE70\eclipse\plugins\com.sap.tc.ap_2.0.0\comp\SAP-JEE\DCs\sap.com\tc\sec\destinations\interface\_comp\gen\default\public\default\lib\java\tc_sec_destinations_interface.jar
for the follow import (like suggest the documentation):
-import com.sap.security.core.server.destinations.api.DestinationService;
-import com.sap.security.core.server.destinations.api.Destination;
-import com.sap.security.core.server.destinations.api.HTTPDestination;
Instead the following seems that are not used:
-import com.sap.security.core.server.destinations.api.DestinationException;
-import com.sap.security.core.server.destinations.api.RFCDestination;
The problem is on the follow line yet:
httpConnection = httpDestination.getURLConnection();
"cannot be resolved"
thx,
Vito
Vito,
Indeed, you need
C:\Program Files\SAP\IDE\IDE70\eclipse\plugins\com.sap.tc.ap_2.0.0\comp\SAP-JEE\DCs\sap.com\tc\sec\destinations\interface\_comp\gen\default\public\default\lib\java\tc_sec_destinations_interface.jar
Plus all jars located in:
C:\Program Files\SAP\IDE\IDE70\eclipse\plugins\com.sap.tc.ap_2.0.0\comp\SAP-JEE\DCs\sap.com\security.class\_comp\gen\default\public\default\lib
Could you post exact error message as it appears in "Tasks" pane? (right-click and open details for error message)
VS
Valery,
no more errors. The code now is:
try {
InitialContext ctx = new InitialContext();
DestinationService dstService = (DestinationService)
ctx.lookup(DestinationService.JNDI_KEY);
if (dstService == null)
throw new NamingException("Destination Service not available");
try{
Destination destination = dstService.getDestination("HTTP","dst-1");
//for HTTP destination: cast
HTTPDestination httpDestination = (HTTPDestination) destination;
try {
//obtain a HTTPUrlConnection from the destinationHttpURLConnection
java.net.HttpURLConnection httpConnection = httpDestination.getURLConnection();
} catch (ConfigurationException e) {};
}catch (DestinationException e) {}
catch (RemoteException e) {};
} catch (NamingException e) {};
Now, what I need, is that when the user click the tab the BSP must appears. The BSP link is in the Destination sercice us HTTP. For this I would like to use:
httpConnection.connect();
on the tab click event. Do you know this is the correct way to call the BSP? Or exist others methods more convenient?
Note that i need the HTTp destination because it use LOgonTicket for single sign-on from the java stack and the abap stack.
Thanks,
Vito
Valery,
in any case, when I run the application I have the follow error:
An error has occurred:
"Failed to process the request."
Please contact your system administrator.
--------------------------------------------------------------------------------
Hide details
This page was created by SAP NetWeaver. All rights reserved.
Web Dynpro client:
HTML Client
Web Dynpro client capabilities:
User agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322), client type: msie6, client type profile: ie6, ActiveX: enabled, Cookies: enabled, Frames: enabled, Java applets: enabled, JavaScript: enabled, Tables: enabled, VB Script: enabled
Accessibility mode: false
Web Dynpro runtime:
Vendor: SAP, build ID: 7.0004.20050812153807.0000 (release=645_VAL_REL, buildtime=2005-09-21:09:00:55[UTC], changelist=362988, host=pwdfm101), build date: Thu Jan 19 11:02:30 CET 2006
Web Dynpro code generators of DC local/GivaudanNavigation:
SapDictionaryGenerationCore: 7.0004.20050713144105.0000 (release=645_VAL_REL, buildtime=2005-09-19:09:56:45[UTC], changelist=357691, host=PWDFM101.wdf.sap.corp)
SapMetamodelWebDynpro: 7.0004.20050713144450.0000 (release=645_VAL_REL, buildtime=2005-09-19:09:58:47[UTC], changelist=357707, host=PWDFM101.wdf.sap.corp)
SapMetamodelCore: 7.0004.20050713144259.0000 (release=645_VAL_REL, buildtime=2005-09-19:09:50:51[UTC], changelist=357699, host=PWDFM101.wdf.sap.corp)
SapWebDynproGenerationTemplates: 7.0004.20050812153807.0000 (release=645_VAL_REL, buildtime=2005-09-19:10:17:37[UTC], changelist=362988, host=pwdfm101)
SapWebDynproGenerationCTemplates: 7.0004.20050812153807.0000 (release=645_VAL_REL, buildtime=2005-09-19:10:17:37[UTC], changelist=362988, host=pwdfm101)
SapGenerationFrameworkCore: 7.0004.20050713144242.0000 (release=645_VAL_REL, buildtime=2005-09-19:09:50:22[UTC], changelist=357697, host=PWDFM101.wdf.sap.corp)
SapIdeWebDynproCheckLayer: 7.0004.20050713144412.0000 (release=645_VAL_REL, buildtime=2005-09-19:10:01:14[UTC], changelist=357705, host=PWDFM101.wdf.sap.corp)
SapMetamodelDictionary: 7.0004.20050509170017.0000 (release=645_VAL_REL, buildtime=2005-09-19:09:54:51[UTC], changelist=346508, host=PWDFM101.wdf.sap.corp)
SapMetamodelCommon: 7.0004.20050713144259.0000 (release=645_VAL_REL, buildtime=2005-09-19:09:50:57[UTC], changelist=357699, host=PWDFM101.wdf.sap.corp)
SapWebDynproGenerationCore: 7.0004.20050713144412.0000 (release=645_VAL_REL, buildtime=2005-09-19:10:01:24[UTC], changelist=357705, host=PWDFM101.wdf.sap.corp)
SapDictionaryGenerationTemplates: (unknown)
Web Dynpro code generators of DC sap.com/tc~wd~dispwda: No information available!
Web Dynpro code generators of DC sap.com/tc~wd~corecomp: No information available!
J2EE Engine:
7.00 patchlevel
Java VM:
Java HotSpot(TM) Server VM, version: 1.4.2_09-b05, vendor: Sun Microsystems Inc.
Operating system:
Windows 2003, version: 5.2, architecture: x86
--------------------------------------------------------------------------------
Error stacktrace:
java.lang.ClassCastException
at com.sap.givaudan.navigation.comp.NavigationComp.wdDoInit(NavigationComp.java:129)
at com.sap.givaudan.navigation.comp.wdp.InternalNavigationComp.wdDoInit(InternalNavigationComp.java:115)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingComponent.doInit(DelegatingComponent.java:95)
at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)
at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)
at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.init(ClientComponent.java:417)
at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:401)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.getApplicationHandle(AbstractClient.java:143)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.prepareTasks(AbstractClient.java:216)
at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:647)
at com.sap.tc.webdynpro.clientserver.cal.ClientManager.parseRequest(ClientManager.java:144)
at com.sap.tc.webdynpro.clientserver.session.core.ApplicationHandle.parseRequest(ApplicationHandle.java:79)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:62)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doGet(DispatcherServlet.java:43)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:95)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:159)
What do you think?? Thanks, Vito
Vito,
Re-write your code to debug exact reason:
Destination destination = dstService.getDestination("HTTP","dst-1");
wdComponentAPI.getMessageManager().reportSuccess
(
"Destination class: " + destination.getClass().getName()
);
//for HTTP destination: cast
if ( !(destination instanceof HTTPDestination) ) return;
HTTPDestination httpDestination = (HTTPDestination) destination;
What is an output of message manager in browser?
VS
The output is:
An error has occurred:
"Failed to process the request."
Please contact your system administrator.
--------------------------------------------------------------------------------
Hide details
This page was created by SAP NetWeaver. All rights reserved.
Web Dynpro client:
HTML Client
Web Dynpro client capabilities:
User agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322), client type: msie6, client type profile: ie6, ActiveX: enabled, Cookies: enabled, Frames: enabled, Java applets: enabled, JavaScript: enabled, Tables: enabled, VB Script: enabled
Accessibility mode: false
Web Dynpro runtime:
Vendor: SAP, build ID: 7.0004.20050812153807.0000 (release=645_VAL_REL, buildtime=2005-09-21:09:00:55[UTC], changelist=362988, host=pwdfm101), build date: Thu Jan 19 11:02:30 CET 2006
Web Dynpro code generators of DC local/GivaudanNavigation:
SapDictionaryGenerationCore: 7.0004.20050713144105.0000 (release=645_VAL_REL, buildtime=2005-09-19:09:56:45[UTC], changelist=357691, host=PWDFM101.wdf.sap.corp)
SapMetamodelWebDynpro: 7.0004.20050713144450.0000 (release=645_VAL_REL, buildtime=2005-09-19:09:58:47[UTC], changelist=357707, host=PWDFM101.wdf.sap.corp)
SapMetamodelCore: 7.0004.20050713144259.0000 (release=645_VAL_REL, buildtime=2005-09-19:09:50:51[UTC], changelist=357699, host=PWDFM101.wdf.sap.corp)
SapWebDynproGenerationTemplates: 7.0004.20050812153807.0000 (release=645_VAL_REL, buildtime=2005-09-19:10:17:37[UTC], changelist=362988, host=pwdfm101)
SapWebDynproGenerationCTemplates: 7.0004.20050812153807.0000 (release=645_VAL_REL, buildtime=2005-09-19:10:17:37[UTC], changelist=362988, host=pwdfm101)
SapGenerationFrameworkCore: 7.0004.20050713144242.0000 (release=645_VAL_REL, buildtime=2005-09-19:09:50:22[UTC], changelist=357697, host=PWDFM101.wdf.sap.corp)
SapIdeWebDynproCheckLayer: 7.0004.20050713144412.0000 (release=645_VAL_REL, buildtime=2005-09-19:10:01:14[UTC], changelist=357705, host=PWDFM101.wdf.sap.corp)
SapMetamodelDictionary: 7.0004.20050509170017.0000 (release=645_VAL_REL, buildtime=2005-09-19:09:54:51[UTC], changelist=346508, host=PWDFM101.wdf.sap.corp)
SapMetamodelCommon: 7.0004.20050713144259.0000 (release=645_VAL_REL, buildtime=2005-09-19:09:50:57[UTC], changelist=357699, host=PWDFM101.wdf.sap.corp)
SapWebDynproGenerationCore: 7.0004.20050713144412.0000 (release=645_VAL_REL, buildtime=2005-09-19:10:01:24[UTC], changelist=357705, host=PWDFM101.wdf.sap.corp)
SapDictionaryGenerationTemplates: (unknown)
Web Dynpro code generators of DC sap.com/tc~wd~dispwda: No information available!
Web Dynpro code generators of DC sap.com/tc~wd~corecomp: No information available!
J2EE Engine:
7.00 patchlevel
Java VM:
Java HotSpot(TM) Server VM, version: 1.4.2_09-b05, vendor: Sun Microsystems Inc.
Operating system:
Windows 2003, version: 5.2, architecture: x86
--------------------------------------------------------------------------------
Error stacktrace:
java.lang.ClassCastException
at com.sap.givaudan.navigation.comp.NavigationComp.wdDoInit(NavigationComp.java:128)
at com.sap.givaudan.navigation.comp.wdp.InternalNavigationComp.wdDoInit(InternalNavigationComp.java:115)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingComponent.doInit(DelegatingComponent.java:95)
at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)
at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)
at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.init(ClientComponent.java:417)
at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:401)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.getApplicationHandle(AbstractClient.java:143)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.prepareTasks(AbstractClient.java:216)
at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:647)
at com.sap.tc.webdynpro.clientserver.cal.ClientManager.parseRequest(ClientManager.java:144)
at com.sap.tc.webdynpro.clientserver.session.core.ApplicationHandle.parseRequest(ApplicationHandle.java:79)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:62)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doGet(DispatcherServlet.java:43)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:95)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:159)
I get the ctx using import javax.naming.InitialContext;
Is this right??
thx, Vito
Vito,
Rewrite it as following:
final Object o = ctx.lookup(DestinationService.JNDI_KEY);
wdComponentAPI.getMessageManager().reportSuccess
(
"DestinationService class: " + o.getClass().getName()
);
if ( !(o instanceof DestinationService) ) return;
DestinationService dstService = (DestinationService)o;
What is shown?
VS
Valery,
now the application appears without error
try {
InitialContext ctx = new InitialContext();
final Object o = ctx.lookup(DestinationService.JNDI_KEY);
wdComponentAPI.getMessageManager().reportSuccess
(
"DestinationService class: " + o.getClass().getName()
);
if ( !(o instanceof DestinationService) ) return;
DestinationService dstService = (DestinationService)o;
try{
Destination destination = dstService.getDestination("HTTP","dst-1");
wdComponentAPI.getMessageManager().reportSuccess
(
"Destination class: " + destination.getClass().getName()
);
//for HTTP destination: cast
if ( !(destination instanceof HTTPDestination) ) return;
HTTPDestination httpDestination = (HTTPDestination) destination;
try {
//obtain a HTTPUrlConnection from the destinationHttpURLConnection
java.net.HttpURLConnection httpConnection = httpDestination.getURLConnection();
} catch (ConfigurationException e) {};
}catch (DestinationException e) {}
catch (RemoteException e) {};
} catch (NamingException e) {};
But I don't see the BSP!! This is a problem. Something is missing??
Thankx, Vito
Vito,
Ok, it seems that what you actually get from JNDI lookup here is a remote object proxy, it has to be "narrowed" to actual interface. Your code must be:
String url = null;
try
{
final InitialContext ctx = new InitialContext();
final Object o = ctx.lookup(DestinationService.JNDI_KEY);
final DestinationService dstService =
(DestinationService)javax.rmi.PortableRemoteObject.narrow
(
o, DestinationService.class
);
try
{
final Destination destination = dstService.getDestination("HTTP","dst-1");
/* for HTTP destination: cast */
final HTTPDestination httpDestination = (HTTPDestination) destination;
try
{
url = httpDestination.getUrl();
}
catch (final ConfigurationException e)
{
/* @TODO Handle Exception */
};
}
catch (DestinationException e)
{
/* @TODO Handle Exception */
}
catch (RemoteException e)
{
/* @TODO Handle Exception */
};
}
catch (NamingException e)
{
/* @TODO Handle Exception */
};
if ( null != url )
wdComponentAPI.getMessageManager().reportSuccess
(
"BSP Application URL: " + url
);
else
wdComponentAPI.getMessageManager().reportWarning
(
"Unnable to find BSP Application URL!"
);
Try this code, if it works then you will see URL of target BSP application. Loading this URL is a separate complex question...
VS
Valery,
it's the same error:
An error has occurred:
"Failed to process the request."
Please contact your system administrator.
--------------------------------------------------------------------------------
Hide details
This page was created by SAP NetWeaver. All rights reserved.
Web Dynpro client:
HTML Client
Web Dynpro client capabilities:
User agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322), client type: msie6, client type profile: ie6, ActiveX: enabled, Cookies: enabled, Frames: enabled, Java applets: enabled, JavaScript: enabled, Tables: enabled, VB Script: enabled
Accessibility mode: false
Web Dynpro runtime:
Vendor: SAP, build ID: 7.0004.20050812153807.0000 (release=645_VAL_REL, buildtime=2005-09-21:09:00:55[UTC], changelist=362988, host=pwdfm101), build date: Thu Jan 19 11:02:30 CET 2006
Web Dynpro code generators of DC local/GivaudanNavigation:
SapDictionaryGenerationCore: 7.0004.20050713144105.0000 (release=645_VAL_REL, buildtime=2005-09-19:09:56:45[UTC], changelist=357691, host=PWDFM101.wdf.sap.corp)
SapMetamodelWebDynpro: 7.0004.20050713144450.0000 (release=645_VAL_REL, buildtime=2005-09-19:09:58:47[UTC], changelist=357707, host=PWDFM101.wdf.sap.corp)
SapMetamodelCore: 7.0004.20050713144259.0000 (release=645_VAL_REL, buildtime=2005-09-19:09:50:51[UTC], changelist=357699, host=PWDFM101.wdf.sap.corp)
SapWebDynproGenerationTemplates: 7.0004.20050812153807.0000 (release=645_VAL_REL, buildtime=2005-09-19:10:17:37[UTC], changelist=362988, host=pwdfm101)
SapWebDynproGenerationCTemplates: 7.0004.20050812153807.0000 (release=645_VAL_REL, buildtime=2005-09-19:10:17:37[UTC], changelist=362988, host=pwdfm101)
SapGenerationFrameworkCore: 7.0004.20050713144242.0000 (release=645_VAL_REL, buildtime=2005-09-19:09:50:22[UTC], changelist=357697, host=PWDFM101.wdf.sap.corp)
SapIdeWebDynproCheckLayer: 7.0004.20050713144412.0000 (release=645_VAL_REL, buildtime=2005-09-19:10:01:14[UTC], changelist=357705, host=PWDFM101.wdf.sap.corp)
SapMetamodelDictionary: 7.0004.20050509170017.0000 (release=645_VAL_REL, buildtime=2005-09-19:09:54:51[UTC], changelist=346508, host=PWDFM101.wdf.sap.corp)
SapMetamodelCommon: 7.0004.20050713144259.0000 (release=645_VAL_REL, buildtime=2005-09-19:09:50:57[UTC], changelist=357699, host=PWDFM101.wdf.sap.corp)
SapWebDynproGenerationCore: 7.0004.20050713144412.0000 (release=645_VAL_REL, buildtime=2005-09-19:10:01:24[UTC], changelist=357705, host=PWDFM101.wdf.sap.corp)
SapDictionaryGenerationTemplates: (unknown)
Web Dynpro code generators of DC sap.com/tc~wd~dispwda: No information available!
Web Dynpro code generators of DC sap.com/tc~wd~corecomp: No information available!
J2EE Engine:
7.00 patchlevel
Java VM:
Java HotSpot(TM) Server VM, version: 1.4.2_09-b05, vendor: Sun Microsystems Inc.
Operating system:
Windows 2003, version: 5.2, architecture: x86
--------------------------------------------------------------------------------
Error stacktrace:
java.lang.ClassCastException: com.sap.security.core.server.destinations.api.DestinationService
at com.sap.engine.services.cross.PortableRemoteObjectContainer.narrow(PortableRemoteObjectContainer.java:179)
at com.sap.engine.system.PortableRemoteObjectProxy.narrow(PortableRemoteObjectProxy.java:24)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
at com.sap.givaudan.navigation.comp.NavigationComp.wdDoInit(NavigationComp.java:132)
at com.sap.givaudan.navigation.comp.wdp.InternalNavigationComp.wdDoInit(InternalNavigationComp.java:115)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingComponent.doInit(DelegatingComponent.java:95)
at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)
at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)
at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.init(ClientComponent.java:417)
at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:401)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.getApplicationHandle(AbstractClient.java:143)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.prepareTasks(AbstractClient.java:216)
at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:647)
at com.sap.tc.webdynpro.clientserver.cal.ClientManager.parseRequest(ClientManager.java:144)
at com.sap.tc.webdynpro.clientserver.session.core.ApplicationHandle.parseRequest(ApplicationHandle.java:79)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:62)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doGet(DispatcherServlet.java:43)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:95)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:159)
I really don't know!! Seems to be all correct.
Vito
Try this first:
InitialContext ctx = new InitialContext();
Then do Source-->Organize Improts to the import statement from the javax.naming.InitialContext class.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Vito,
Declare ctx befor using it.,
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;
try
{
InitialContext ctx = new InitialContext();
}
hope it helps..,
regards,
Vinoth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
8 | |
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.