on 10-07-2008 4:14 PM
HI All,
i am creating a jspdynpage and tryiong to get data int it using beans.
I wrote code looking at the sample examples given in sap help sites but my bean was not accessible initially though every thing was fine in code. so when i checked the sdn forums saw that the ComponentType ans JSP elements need to be deleted from the portalapp.xml.....but when i removed them the JSP is not able to find the classfiles at all......
find below my code.....please help me
<?xml version="1.0" encoding="utf-8"?>
<application>
<application-config>
<property name="PrivateSharingReference" value="com.sap.portal.htmlb"/>
</application-config>
<components>
<component name="TestJSPDynPage">
<component-config>
<property name="ClassName" value="testjspdynpage.TestJSPDynPage"/>
</component-config>
<component-profile>
<property name="tagLib" value="/SERVICE/htmlb/taglib/htmlb.tld"/>
</component-profile>
</component>
<component name="SamplePortalApplicationComponent">
<component-config>
<property name="ClassName" value="satyam.testpkg.SamplePortalApplicationComponent"/>
</component-config>
<component-profile/>
</component>
</components>
<services/>
</application>
my Java file is
public void doProcessBeforeOutput() throws PageException {
IUserContext userContext = null;
IUserMappingService userMappingService = null;
IUserMappingData userMappingData = null;
IPortalComponentRequest componentRequest = (IPortalComponentRequest)this.getRequest();
IPortalComponentContext componentContext = componentRequest.getComponentContext();
IPortalComponentProfile componentProfile = componentContext.getProfile();
Map userInfoMap = null; // map to contain the usermapping info retrieved from the usermapping service
String currentPortalUser = null;
String currentPortalUserDisplayName = null;
String mappedBackendUser = null;
/* this is the system alis which would represent the target back end
* The Value is hard coded to "SAP_R3_HumanResources" because for ESS 50.4 the SAP System configured in the
* Portal's System Landscape must contain the alias "SAP_R3_HumanResources".
*/
final String TARGET_BACKEND = "SAP_R3_HumanResources";
MyBean myUserDataBean = null;
myUserDataBean = new MyBean();
//get the IUserContext object from the current request and get the user's info from the object
userContext = ((IPortalComponentRequest) this.getRequest()).getUser();
//get the UserMapping info
userMappingService = (IUserMappingService)PortalRuntime.getRuntimeResources().getService(IUserMappingService.KEY);
userMappingData = userMappingService.getMappingData(TARGET_BACKEND, userContext);
userInfoMap = new HashMap ();
try {
userMappingData.enrich (userInfoMap);
}
catch (NoLogonDataAvailableException nldae) {
nldae.printStackTrace();// ... Error handling
}
//get the current logged on portal userid and display name and set the corresponsing bean values
currentPortalUser = userContext.getUniqueName();
myUserDataBean.setCurrentPortalUserName(currentPortalUser);
currentPortalUserDisplayName = userContext.getDisplayName();
myUserDataBean.setCurrentPortalUserDisplayName(currentPortalUserDisplayName);
myUserDataBean.setMappedBackendUserName((String)userInfoMap.get( "user" ));
myUserDataBean.setMappedBackendPassword((String)userInfoMap.get("mappedpassword"));
((IPortalComponentRequest) getRequest()).getNode().putValue("userDataObj", myUserDataBean);
((IPortalComponentRequest) getRequest()).getServletRequest().setAttribute("userData",myUserDataBean);
componentProfile.putValue("userDataObjInProfile",myUserDataBean);
this.setJspName("TestJSPDYNPage.jsp");
}
can any one please help me why is my class file not visible after removing the ComponentType and JSP tags from the portalapp.xml
i am getting the following exception after i made the changes
Caused by: java.lang.ClassNotFoundException: testjspdynpage.TestJSPDynPage
-
Loader Info -
ClassLoader name: [com.sapportals.portal.prt.util.ApplicationClassLoader@1ac8ae7]
Parent loader name: [com.sapportals.portal.prt.util.ApplicationClassLoader@517c21]
References:
not registered!
Resources:
C:
usr
sap
EPD
JC00
j2ee
cluster
server0
apps
sap.com
irj
servlet_jsp
irj
root
WEB-INF
portal
portalapps
SamplePortalApplication
private
lib
SamplePortalApplicationcore.jar
-
at com.sap.engine.frame.core.load.ReferencedLoader.loadClass(ReferencedLoader.java:382)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:219)
at com.sapportals.portal.prt.core.broker.PortalComponentItemFacade.getInstanceInternal(PortalComponentItemFacade.java:228)
... 30 more
#
#1.5 #FAF0F2F0F0F300400000001D0000122C000458AB14B1A070#1223391716696#com.sap.portal.prt.runtime#sap.com/irj#com.sap.portal.prt.runtime#Pavank#4885##n/a##a0d018a0948011ddcedffaf0f2f0f0f3#SAPEngine_Application_Thread[impl:3]_12##0#0#Error##Java###11:01_07/10/08_0011_8548050
[EXCEPTION]
#1#java.lang.ClassNotFoundException: testjspdynpage.TestJSPDynPage
-
Loader Info -
ClassLoader name: [com.sapportals.portal.prt.util.ApplicationClassLoader@1ac8ae7]
Parent loader name: [com.sapportals.portal.prt.util.ApplicationClassLoader@517c21]
References:
not registered!
Resources:
C:
usr
sap
EPD
JC00
j2ee
cluster
server0
apps
sap.com
irj
servlet_jsp
irj
root
WEB-INF
portal
portalapps
SamplePortalApplication
private
lib
SamplePortalApplicationcore.jar
-
at com.sap.engine.frame.core.load.ReferencedLoader.loadClass(ReferencedLoader.java:382)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:219)
at com.sapportals.portal.prt.core.broker.PortalComponentItemFacade.getInstanceInternal(PortalComponentItemFacade.java:228)
at com.sapportals.portal.prt.core.broker.PortalComponentItemFacade.getComponentInstance(PortalComponentItemFacade.java:160)
at com.sapportals.portal.prt.core.broker.PortalComponentItem.getComponentInstance(PortalComponentItem.java:732)
at com.sapportals.portal.prt.component.PortalComponentContext.getComponent(PortalComponentContext.java:103)
at com.sapportals.portal.prt.component.PortalComponentContext.init(PortalComponentContext.java:242)
at com.sapportals.portal.prt.core.broker.PortalComponentContextItem.refresh(PortalComponentContextItem.java:267)
at com.sapportals.portal.prt.core.broker.PortalComponentContextItem.getContext(PortalComponentContextItem.java:312)
at com.sapportals.portal.prt.component.PortalComponentRequest.getComponentContext(PortalComponentRequest.java:385)
at com.sapportals.portal.prt.connection.PortalRequest.getRootContext(PortalRequest.java:435)
at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:607)
at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:240)
at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:547)
at java.security.AccessController.doPrivileged(Native Method)
at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:407)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.servlet.InvokerServlet.service(InvokerServlet.java:156)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
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:102)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172)
#
regards,
--
PK
Can any one please help me in resolving my problem?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
What is SamplePortalApplicationComponent here. Seems problem there. If you are not using this or have deleted the component from the project, remove these lines from portalapp.xml
<component name="SamplePortalApplicationComponent">
<component-config>
<property name="ClassName" value="satyam.testpkg.SamplePortalApplicationComponent"/>
</component-config>
<component-profile/>
</component>
Regards,
Harini S
HI Harini.
thanks for your reply.
The SamplePortalApplicationComponent is another component i created which is present in the same project. I created this component to try creating a component by extending AbstractPortalComponent.It has nothing to do with the JSPDynPage I am trying to access.
Also when i inlcude the entries
<property name="ComponentType" value="jspnative"/>
<property name="JSP" value="pagelet/TestJSPDYNPage.jsp"/>
the JSPDynPage is loading fine...the problem is coming only when i remove the two entires.
Is this a problem because my class files are in core folder...not API....can this be a reason for the problem? if yes can you tell me how to move them to API?
thanks
--
PK
Hi,
But error displays problem with that component jar. If you remove the 2 lines from portalapp.xml or have the component inside core, it doesn't matter. I don't think those will be a problem. Remove those lines. Save it. CLose the project. Open it again and rebuild it. Then freshly deploy and check.
Regards,
Harini S
Hi Harini,
as you said i closed the project, rebuild it and then made a fresh deployment.
This time i removed all the custom code from my java class and the JSP also.....
no my doProcessBeforeOutput has just one single line that is
this.setJspName("TestJSPDYNPage.jsp");
and my JSP has only few htmlb controls......they r not getting data from any bean.....i just created the controls in the htmlb form....thats it....now my portalapp.xml looks like
<?xml version="1.0" encoding="utf-8"?>
<application>
<application-config>
<property name="PrivateSharingReference" value="com.sap.portal.htmlb"/>
</application-config>
<components>
<component name="TestJSPDynPage">
<component-config>
<property name="ClassName" value="testjspdynpage.TestJSPDynPage"/>
</component-config>
<component-profile>
<property name="tagLib" value="/SERVICE/htmlb/taglib/htmlb.tld"/>
</component-profile>
</component>
</components>
<services/>
</application>
even now i am getting the same problem......i still dont understand what is the reason for the error?
regards,
--
PK
Hi,
I don't see any problem here. It seems studio is not generating the par structure correctly. Which version of studio you are using? Is this the first project you are developing? You can create a new project. Give a message in JSP and deploy to test the output. DOn't change portalapp.xml. If it works fine, then there is no problem with studio. You can update the new project step by step and check when it is giving error.
Regards,
Harini S
Hi,
Your SharingReference is not complete, for example in your doProcessBeforeOutput method you use IUserMappingService class which is in com.sap.portal.usermapping application. So you should add this to your SharingReference as well. So I advice to check all classes you are using in your JSPDynPage and add corresponding applications to SharingReference.
Regards,
Praveen Gudapati
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.