cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominic Reynolds <domi...@lantnern.com>
Subject Re: NullPointerException with SunShine -- user and password not stored in context?
Date Wed, 24 Jul 2002 19:50:56 GMT
I think that this is due to jdk1.4 + xml library problems. 

Previously on this list someone said to move the xerces*jar, xalan*jar, and 
xml-api*jar from the cocoon distribution to ${JAVA_HOME}/jre/lib/endorsed 
directory and then pass '-DJAVA_ENDORSED_DIRS=${JAVA_HOME}/jre/lib/endorsed' 
to java in the catalina.sh script.
This worked for me and I was seeing the same stack trace.

-dom



On Wednesday 24 July 2002 12:21 pm, David Cameron wrote:
> I've been getting a NullPointerException using SunShine with both the demo
> and a little custom test based on the material at
> http://www.need-a-cake.com/stories/2002/02/28/usingTheSunriseComponents.htm
>l
>
> I found a note to the mailing list from Keil, who seemed to be having the
> exact same problem in May, but there were no replies to it.
>
> I'm using
> Java 1.4.0
> Tomcat 4.0.4
> Cocoon 2.0.3 (from source or the 1.4 binary build)
>
> I'm speculating that the error is caused because the authentication
> information is not getting stored to the session context after the user is
> authed.
>
> Here's some of the stack trace:
> java.lang.NullPointerException
> 	at
> org.apache.cocoon.sunshine.xml.XMLUtil.getNodesFromPath(XMLUtil.java:869)
> 	at
> org.apache.cocoon.sunshine.xml.XMLUtil.getNodesFromPath(XMLUtil.java:871)
> 	at
> org.apache.cocoon.sunshine.xml.XMLUtil.getNodesFromPath(XMLUtil.java:871)
> 	at
> org.apache.cocoon.sunshine.xml.XMLUtil.getNodeListFromPath(XMLUtil.java:836
>) at
> org.apache.cocoon.sunshine.context.SimpleSessionContext.getXML(SimpleSessio
>n Context.java:173)
> 	at
> org.apache.cocoon.sunshine.sunrise.SunRise.isAuthenticated(SunRise.java:691
>) at
> org.apache.cocoon.sunshine.sunrise.SunRise.checkAuthentication(SunRise.java
>: 766)
> 	at
> org.apache.cocoon.sunshine.sunrise.acting.AuthAction.act(AuthAction.java:12
>2 )
> 	at
> org.apache.cocoon.www.sitemap_xmap.matchN4004A5(F:\tomcat-4.0.4-win\work\St
>a
> ndalone\localhost\cocoon\cocoon-files\org/apache/cocoon/www\sitemap_xmap.ja
>v a:5363)
> 	at
> org.apache.cocoon.www.sitemap_xmap.process(F:\tomcat-4.0.4-win\work\Standal
>o
> ne\localhost\cocoon\cocoon-files\org/apache/cocoon/www\sitemap_xmap.java:33
>3 0)
> 	at
> org.apache.cocoon.www.sitemap_xmap.process(F:\tomcat-4.0.4-win\work\Standal
>o
> ne\localhost\cocoon\cocoon-files\org/apache/cocoon/www\sitemap_xmap.java:31
>0 0)
>
> Now some sections from the sitemap, these were all copied nearly verbatim
> from the above link. I switched target for redirect after a sucessful login
> to ags-authuser in an effort to see if it was returning the proper info.
> This doesn't seem to work though because it requires a name and password
> parameter in the request. My understanding is that it should be able to get
> this info from the session context after a successful login, but it clearly
> isn't.
>
> <!-- definition for the auth action -->
>     <map:action name="sunRise-auth"
> src="org.apache.cocoon.sunshine.sunrise.acting.AuthAction">
>       <handlers>
>         <handler name="ags-handler"
> xmlns:map="http://apache.org/cocoon/sitemap/1.0"
> xmlns:sunshine="http://sunshine.sundn.de/sunshine/1.0">
>              <redirect-to uri="cocoon://ags-loginpage"/>
>              <authentication uri="cocoon:raw://ags-authuser" />
>         </handler>
>       </handlers>
>     </map:action>
>
> <!-- pipelines -->
>    <map:match pattern="ags-loginpage">
>               <map:generate src="loginpage.xml" />
>               <map:transform src="loginpage.xsl" />
>               <map:transform type="encodeURL" />
>               <map:serialize />
>    </map:match>
>
>    <map:match pattern="ags-login">
>       <map:act type="sunRise-login">
>            <map:parameter name="handler" value="ags-handler"/>
>            <map:parameter name="parameter_name" value="request:name"/>
>            <map:parameter name="parameter_password"
> value="request:password"/>
>            <!-- If the authentication is successfull then this redirect
> will be performed -->
>            <map:redirect-to uri="ags-authuser"/>
>       </map:act>
>       <!-- authentication failed: -->
>       <map:generate src="login-failed.xml"/>
>       <map:transform src="login-failed.xsl"/>
>       <map:serialize/>
>    </map:match>
>
>    <map:match pattern="ags-authuser">
>             <map:generate src="ags-user.xml" />
>             <map:transform src="ags-user.xsl">
>                <map:parameter name="use-request-parameters" value="true" />
>             </map:transform>
>             <map:serialize type="xml"/>
>    </map:match>
>
>    <map:match pattern="ags-protected">
>            <map:act type="sunRise-auth">
>                <map:parameter name="handler" value="ags-handler"/>
>                <map:generate src="temp.html"/>
>            </map:act>
>        <map:serialize />
>    </map:match>
>
> <!-- end of sitemap -->
>
> I can get authentication information by handcrafting URLs to auth user. For
> example ags-authuser?name=cocoon&password=cocoon gives me back the xml:
>   <?xml version="1.0" encoding="UTF-8" ?>
> - <authentication>
>   <ID>cocoon</ID>
>   <role>admin</role>
> - <data>
>   <name>cocoon</name>
>   <role>admin</role>
>   <ID>cocoon</ID>
>   <user>cocoon</user>
>   <title />
>   <firstname />
>   <lastname />
>   <company />
>   <street />
>   <zipcode />
>   <city />
>   <country />
>   <phone />
>   <fax />
>   <email />
>   <bankid />
>   <bankname />
>   <accountid />
>   </data>
>   </authentication>
>
> Which seems to be correct. However going to ags-protected and then logging
> in causes the null pointer exception.
>
> The reason I think the information is not being stored in the context is
> because after going through the source along the stack trace I came across
> this:
> SunRise.java line 691:
>                             DocumentFragment id = context.getXML("/" + name
> + "/authentication/ID");
>
> name is the handler name. The ags-authuser pipeline is returning the proper
> snippets as shown above, but then later when this call is made, the
> fragment isn't available.
>
> Any ideas of how I can fix this or get around it? Is something broken in
> SunShine?
>
> Dave
>
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>


Mime
View raw message