You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-dev@portals.apache.org by Elliot Metsger <em...@jhu.edu> on 2006/07/27 04:51:39 UTC

Castor and XML namespaces (was Moving toward a Pluto 1.1 beta release)

Craig,

Thanks for the hints below.  I did have to update
DeployWarService.updateWebXml() for PLUTO-219 (distributable handling), but
for PLUTO-216 the problem is related to how Castor deals with namespaces
when unmarshalling (I don't know perhaps after I get past this immediate
issue with Castor I'll need to take another look at
DeployWarService.updateWebXml() if additional elements have been added as
you noted below)

Just to backtrack a second/refresh - the problem that I'm trying to solve is
that you get an NPE when attempting to deploy a portlet using a servlet 2.4
webapp with the admin portlet:
SEVERE: Error in Portlet
java.lang.NullPointerException
        at
org.apache.pluto.invoker.impl.PortletInvokerImpl.invoke(PortletInvokerImpl.java:109)
        at
org.apache.pluto.invoker.impl.PortletInvokerImpl.load(PortletInvokerImpl.java:80)
        at
org.apache.pluto.PortletContainerImpl.portletLoad(PortletContainerImpl.java:218)

This occurs because Castor doesn't map the servlet or servletMapping fields
of WebApplicationDefinitionImpl (in
PortletDefinitionRegistryServiceContextImpl.loadApplicationDefinition) when
unmarshalling a servlet 2.4 xml.

I finally figured out that if you feed Castor a servlet 2.4 xml with a
default namespace, the mapping fails, but if you feed it one with a null
namespace, it works.

So when I upload a portlet with a servlet descriptor like:
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" 
    version="2.4">
        <display-name>Servlet 2.4 Webapp</display-name>
        <description>A 2.4 Servlet</description>    
</web-app>

the mapping fails and I get the NPE.  If I use 
<web-app version="2.4">
        <display-name>Servlet 2.4 Webapp</display-name>
        <description>A 2.4 Servlet</description>    
</web-app>

I get past the NPE and my hello world renders.  I suspect the same issue
will apply when deploying portlets from the command line using the
descriptors sub-project.

I'll dig into Castor and their list archives and see if there's an easy
solution.  Thanks again for the pointers,

Elliot



 


CDoremus wrote:
> 
> Hi Elliot,
> 
> I thought that there would be a problem.  There might be a problem in 
> DeployWarService.updateWebXml(), which
> adds the PortletServlet info to web.xml. In doing so, it makes sure that 
> the servlet and servlet-mapping elements for PortletServlet are placed in 
> the proper order, which requires that it iterate through every element 
> web.xml before servlet or servlet-mapping. There might be a problem if 
> there are new elements in the servlet 2.4 spec. So take a look to see 
> whether the PortletServlet elements got added properly. If there are other 
> issues, please let me know.
> 
> TIA
> /Craig
> 
> 
> 
> 
> 
> Elliot Metsger <em...@jhu.edu> 
> 04/19/2006 10:14 AM
> Please respond to
> pluto-dev@portals.apache.org
> 
> 
> To
> pluto-dev@portals.apache.org
> cc
> 
> Subject
> Re: Moving toward a Pluto 1.1 beta release
> 
> 
> 
> 
> 
> 
> Elliot Metsger wrote:
>> Hi Craig,
>> 
>> I'll perform both tests below; I totally understand the prioritation - 
>> no problem there :-)  I'll report back.
> 
> Definitly a problem which manifests itself in the Pluto Portal invoker 
> when deploying a 2.4 servlet via the admin portlet app.  I'm digging...
> 
> 
>> Elliot
>> 
>> CDoremus@hannaford.com wrote:
>> 
>>> Hi Elliot,
>>>
>>> Thanks for the update on your patches to Pluto 1.0.1. Right now I am 
>>> concentrating on getting Pluto 1.1-beta1 out the door.
>>>
>>> I hope to get to your applying your patches to the 1.0.2 branch, but 
>>> that is not a big priority right now.  One thing that I am concerned 
>>> about is how your patch effects the Admin Portlets in Pluto 1.0.1. 
>>> Have you tested this? If not, can you test an Admin Portlet deployment 
>>> with 1). A portlet bundled with a Servlet 2.3 compliant web.xml and 
>>> 2). A portlet bundled with a Servlet 2.4 compliant web.xml?
>>>
>>> TIA
>>> /Craig
> 
> <snip>
> 
> 
> 
-- 
View this message in context: http://www.nabble.com/Moving-toward-a-Pluto-1.1-beta-release-tf1451971.html#a5514504
Sent from the Pluto - Dev forum at Nabble.com.


Re: Castor and XML namespaces (was Moving toward a Pluto 1.1 beta releas

Posted by Elliot Metsger <em...@jhu.edu>.

Elliot Metsger wrote:
> 
> I finally figured out that if you feed Castor a servlet 2.4 xml with a
> default namespace, the mapping fails, but if you feed it one with a null
> namespace, it works.
> 

Ah - this behavior appears to be governed by the
"org.exolab.castor.parser.namespaces" property in
portal/webapp/WEB-INF/classes/castor.properties.

By default the property is false, but for the portal subproject it is true. 
This results in failed deployment of portlets using a 2.4 servlet descriptor
using the admin portlet, but the same portlet would deploy just fine (with
PLUTO-216 applied) using the descriptors project (maven deploy goal).

So I'll investigate the ramifications of switching the
"org.exolab.castor.parser.namespaces" property to "false" for the portal
subproject, either programatically or via the properties file.  

I'm not sure what the list thinks about this - any thoughts on switching
this property value to false for pluto 1.0.2?  If it is too big or risky
change, I could write up some documentation for the website for the eventual
1.0.2 maintenance release.

Thanks,
Elliot

-- 
View this message in context: http://www.nabble.com/Moving-toward-a-Pluto-1.1-beta-release-tf1451971.html#a5533949
Sent from the Pluto - Dev forum at Nabble.com.