cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with custom taglib (PD4ML)

Former Member
0 Kudos

I'm tying to convert html to pdf with PD4ML taglb in a

portal. But I get a NullpointerException when I try to

use the taglib.

I'm running 6.20 SP2

Configuration as follows:

PORTAL-INF/Pagelet/

convert.jsp (see below)

PORTAL-INF/lib

pd4ml_demo.jar (included in the .classpath)

pd4ml_tl_demo.jar

PORTAL-INF/taglib/

pd4ml.tld

In the portalapp.xml

-


<application>

<application-config>

<property name="SharingReference" value="knowledgemanagement,htmlb,com.sap.km.bs.ui.wdf,com.sap.km.cm.ui.flex,com.sap.portal.usermanagement,com.sap.portal.useragent,com.sap.portal.pagebuilder,org.zefer.pd4ml"/>

<property name="ServicesReference" value="com.sap.netweaver.coll.appl.room"/>

<property name="releasable" value="false"/>

<property name="startup" value="true"/>

<property name="ClassLoadingPolicy" value="CoreAccessInAPI,transitive"/>

<property name="DeploymentPolicy" value="5.0"/>

<property name="SharingReference" value="knowledgemanagement, landscape, htmlb, exportalJCOclient, exportal,pd4ml"/>

</application-config>

<component name="pd4ml">

<component-config>

<property name="ComponentType" value="jspnative"/>

<property name="JSP" value="pagelet/convert.jsp"/>

<property name="SecurityZone" value="com.tetrapak.neworbis.dist.PORTAL-INF/low_safety"/>

</component-config>

<component-profile>

<property name="pd4ml" value="../taglib/pd4ml.tld"/>

</component-profile>

</component>

-


convert.jsp

-


<%@ taglib uri="../taglib/pd4ml.tld" prefix="pd4ml"%><%@page

contentType="text/html; charset=ISO8859_1"%><pd4ml:transform

screenWidth="400"

pageFormat="A5"

pageOrientation="landscape"

pageInsets="100,100,100,100,points"

enableImageSplit="false">

<html>

<head>

<title>pd4ml test</title>

<style type="text/css">

body

</style>

</head>

<body>

<img src="images/logos.gif" width="125" height="74">

<p>

Hello, World!

<pd4ml:page_break/>

<table width="100%" style="background-color: #f4f4f4; color: #000000">

<tr>

<td>

Hello, New Page!

</td>

</tr>

</table>

</body>

</html>

</pd4ml:transform>

-


Exception from system log (pd4ml in debug mode)

-


Exception ID:01:04_13/06/05_0003

com.sapportals.portal.prt.component.PortalComponentException: Error in service call of Portal Component

Component : com.tetrapak.neworbis.pd4ml

Component class : pagelet._sapportalsjsp_convert

User : SELOFBERGM

at com.sapportals.portal.prt.core.PortalRequestManager.handlePortalComponentException(PortalRequestManager.java:853)

at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:311)

at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:138)

at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:191)

at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:217)

at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:580)

at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:301)

at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:138)

at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:191)

at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:670)

at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:229)

at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:555)

at java.security.AccessController.doPrivileged(Native Method)

at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:415)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.inqmy.services.servlets_jsp.server.InvokerServlet.service(InvokerServlet.java:126)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.inqmy.services.servlets_jsp.server.RunServlet.runSerlvet(RunServlet.java:149)

at com.inqmy.services.servlets_jsp.server.ServletsAndJspImpl.startServlet(ServletsAndJspImpl.java:833)

at com.inqmy.services.httpserver.server.RequestAnalizer.checkFilename(RequestAnalizer.java:672)

at com.inqmy.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:314)

at com.inqmy.services.httpserver.server.Response.handle(Response.java:173)

at com.inqmy.services.httpserver.server.HttpServerFrame.request(HttpServerFrame.java:1288)

at com.inqmy.core.service.context.container.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:36)

at com.inqmy.core.cluster.impl5.ParserRunner.run(ParserRunner.java:55)

at com.inqmy.core.thread.impl0.ActionObject.run(ActionObject.java:46)

at java.security.AccessController.doPrivileged(Native Method)

at com.inqmy.core.thread.impl0.SingleThread.run(SingleThread.java:148)

Caused by: com.sapportals.portal.prt.component.PortalComponentException: Original exception:

at pagelet._sapportalsjsp_convert.doContent(_sapportalsjsp_convert.java:105)

at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)

at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)

at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:301)

at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:138)

at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:191)

at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:217)

at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:580)

at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:301)

at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:138)

at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:191)

at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:670)

at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:229)

at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:555)

at java.security.AccessController.doPrivileged(Native Method)

at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:415)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.inqmy.services.servlets_jsp.server.InvokerServlet.service(InvokerServlet.java:126)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.inqmy.services.servlets_jsp.server.RunServlet.runSerlvet(RunServlet.java:149)

at com.inqmy.services.servlets_jsp.server.ServletsAndJspImpl.startServlet(ServletsAndJspImpl.java:833)

at com.inqmy.services.httpserver.server.RequestAnalizer.checkFilename(RequestAnalizer.java:672)

at com.inqmy.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:314)

at com.inqmy.services.httpserver.server.Response.handle(Response.java:173)

at com.inqmy.services.httpserver.server.HttpServerFrame.request(HttpServerFrame.java:1288)

at com.inqmy.core.service.context.container.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:36)

at com.inqmy.core.cluster.impl5.ParserRunner.run(ParserRunner.java:55)

at com.inqmy.core.thread.impl0.ActionObject.run(ActionObject.java:46)

at java.security.AccessController.doPrivileged(Native Method)

at com.inqmy.core.thread.impl0.SingleThread.run(SingleThread.java:148)

Caused by: java.lang.NullPointerException

at org.zefer.pd4ml.taglib.PD4MLTransformerTag.doStartTag(PD4MLTransformerTag.java:87)

at pagelet._sapportalsjsp_convert.doContent(_sapportalsjsp_convert.java:47)

at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)

at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)

at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:301)

at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:138)

at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:191)

at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:217)

at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:580)

at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:301)

at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:138)

at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:191)

at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:670)

at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:229)

at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:555)

at java.security.AccessController.doPrivileged(Native Method)

at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:415)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.inqmy.services.servlets_jsp.server.InvokerServlet.service(InvokerServlet.java:126)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.inqmy.services.servlets_jsp.server.RunServlet.runSerlvet(RunServlet.java:149)

at com.inqmy.services.servlets_jsp.server.ServletsAndJspImpl.startServlet(ServletsAndJspImpl.java:833)

at com.inqmy.services.httpserver.server.RequestAnalizer.checkFilename(RequestAnalizer.java:672)

at com.inqmy.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:314)

at com.inqmy.services.httpserver.server.Response.handle(Response.java:173)

at com.inqmy.services.httpserver.server.HttpServerFrame.request(HttpServerFrame.java:1288)

at com.inqmy.core.service.context.container.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:36)

at com.inqmy.core.cluster.impl5.ParserRunner.run(ParserRunner.java:55)

at com.inqmy.core.thread.impl0.ActionObject.run(ActionObject.java:46)

at java.security.AccessController.doPrivileged(Native Method)

at com.inqmy.core.thread.impl0.SingleThread.run(SingleThread.java:148)

com.sapportals.portal.prt.connection.ContentExceptionHandler@3aa4a4 #

-


Any ideas or suggestions to solve this problem would be much appreciated.

Tanks

M.Lofberg

Accepted Solutions (0)

Answers (1)

Answers (1)

detlev_beutner
Active Contributor
0 Kudos

Hi Mikael,

even if the taglib reference is maybe somewhat strange, it seems to work so far. The problem will be within this tag, I suppose:

<pd4ml:transform
  screenWidth="400"
  pageFormat="A5"
  pageOrientation="landscape"
  pageInsets="100,100,100,100,points"
  enableImageSplit="false">

==>

java.lang.NullPointerException
at org.zefer.pd4ml.taglib.PD4MLTransformerTag.doStartTag(PD4MLTransformerTag.java:87)

I would suggest to have a look into this implementation to get idea what's missing.

Hope it helps

Detlev

Former Member
0 Kudos

Thanks for your answer Detlev

I was in contact with Zefer and their first suggestion was:

"For the time being, the situaltion looks like the following:

The exception is thrown, because very standard for JSP/taglibs call ServletResponse

sr = pageContext.getResponse(); returns null. For me it looks strange and I can suspect only configuration

problems: for instance, your JSP and PD4ML were loaded by different class loaders or run in different security scopes (and can not share the response object) etc."

And when I try the same code/config/libs/tdls in a

Tomcat enviroment it works just fine.

So any more suggestions, ideas and input, and I'll be

very greatefull.

Regards

M Lofberg

detlev_beutner
Active Contributor
0 Kudos

Hi Mikael,

see http://help.sap.com/saphelp_erp2004/helpdata/en/7d/1e1e405d21c442e10000000a1550b0/frameset.htm -- for the pageContext object, "not all functionnality are supported". Just today I had a discussion via an OSS note with SAP Development why the JSP specification is violated and why this is not considered as a bug - it was very disappointing that there doesn't seem to be any perception of how important this is :-((( They just closed the OSS message!

Anyhow, I would like to encourage you to do the same (opening an OSS message) - even if you'll get a bad answer like me today. Only if many developers complain about this attitude, we'll have a chance that it'll change within the future.

Hope it helps

Detlev

PS: Please consider rewarding points for helpful answers on SDN. Thanks in advance!

Former Member
0 Kudos

Hi Detlev

Thanks for the answer. I'll consider to open an OSS message. The solution for me, as it seems right now, would probably be to run a Tomcatserver beside the portal to take care of JSP pages in a proper way. But it shouldn't be like that, the portal should handle JSP according to the specifications. And I would consider this as a bug.

Best regards

Mikael Lofberg

Former Member
0 Kudos

Hi Mikael,

the portal's jsp compiler will always return null for a pageContext.getResponse() call. If you have a look at the com.sapportals.portal.prt.servlets_jsp.server.page.PageContextImpl class, you will see that it's not a bug but intended (for whatever reason).

You might deploy your jsp app on the portal's J2EE Engine. At least, the engine's compiler should stick to the specification, so there is no need for an additional tomcat.

Regards, Karsten

Former Member
0 Kudos

Hi Karsten

Thanks for your answer.

Could you please tell me how I should deploy on the portal J2EE Engine, or point me to some documentation regarding this. As I'm working now I use Eclipse and deploy a large project with export PAR.

Thanks in advance

Best regards

Mikael Lofberg

Former Member
detlev_beutner
Active Contributor
0 Kudos

Hi Karsten,

as I have just written in detail within the OSS message mentioned in this thread earlier, I'm really estonished about SAP's perception of what role specifications and standards play within the J2EE world. And as is seen within this thread as well as in many others (or what you can learn when talking to J2EE developers, getting in touch with SAP), this perception is not something which raises SAP's standing among these (in my opinion: important, also for SAP) people.

> it's not a bug but intended

Being generous, I would call it an "intended bug"...

> (for whatever reason)

If at least there would be someone giving a real reason, one could start discussing if this reason is so unalterable that we developers can say "OK, it's not nice, but that's a reason I can acknowledge".

The problem arises when someone states "it's intended - for whatever reason". It's not personally, Karsten. But that's the same attitude I got yesterday with the OSS message. Someone closes the message, saying "it works that way". Period. No reason. Nothing. And that's really poor! (I don't expect you to give me the reasons, and it's not your task to do, especially not within some nonsignificant SDN thread. But people closing an OSS message, which reports a violation of the JSP specification should! Anyhow, this combination "not a bug ... intended ... for whatever reason" stands for a special SAP attitude I experience the whole two years I'm working now in this area, and I can say: This is no fun.)

To be not only criticising: On a first glance

public ServletResponse getResponse() {
  return componentRequest.getServletResponse(false);
}

could do it, maybe. <i>Maybe</i> there is some possible problem arising, but nobody told so far...

For the reponse object, it seems that this parameter <i>answering</i> (and the logic behind it) could be considered as a problem. Looking at the exampe given - why shouldn't the taglib write something into the (original) response (without the runtime skipping all further content processing)? Maybe this could be the point where the discussion could start (mainly, among SAP development!).

Best regards,

and no hard feelings

Detlev

Former Member
0 Kudos

Detlev, in my case "for whatever reason" just means that I don't know it and likely never get to know. (And as you said, I don't have to know.)

I'm almost as far away from development as you are. Believe me, I often encounter issues where I just want to grab the person(s) in charge and shake'em.

Seems like I'm your wailing wall right now

Unfortunately, you won't meet the persons in charge here.

> But people

> closing an OSS message, which reports a violation of

> the JSP specification should!

In my opinion the portal jsp compiler is not standard and isn't supposed to be. Even basic requirements are not met by the portal jsp compiler who simply translates the jsp into an AbstractPortalComponent.

But who knows, maybe the bad bad jsp compiler will stop its poor non-standard existence soon? Uuuh, it wasn't me who told this...

Regards, Karsten