You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Aaron Bortman <ba...@hotmail.com> on 2005/11/30 00:38:50 UTC

ComponentSelector could not find the component Error

Hello,
    I am relatively new with Cocoon and have been going through the book 
"Cocoon Developer's handbook" by Lajos Moczar and Jeremy aston.  The book 
goes through an example of a website that a business might use.  I am trying 
to add authentication to this website by adding an xsp page called login.xsp 
and an html page called login.html.  I am running Cocoon with apache tomcat 
4.0 and am using cocoon 2.0.4, on windows xp.  When I try to display the 
page login.html I get a fatal error that looks like the following:

type fatal

message UnnamedSelector: ComponentSelector could not find the component for 
hint [resources]

description org.apache.avalon.framework.component.ComponentException: 
UnnamedSelector: ComponentSelector could not find the component for hint 
[resources]

sender org.apache.cocoon.servlet.CocoonServlet

source Cocoon servlet

stack-trace

org.apache.avalon.framework.component.ComponentException: UnnamedSelector: 
ComponentSelector could not find the component for hint [resources]
	at 
org.apache.avalon.excalibur.component.ExcaliburComponentSelector.select(ExcaliburComponentSelector.java:198)
	at 
org.apache.cocoon.sitemap.DefaultSitemapComponentSelector.select(DefaultSitemapComponentSelector.java:101)
	at 
org.apache.cocoon.sitemap.DefaultSitemapComponentSelector.select(DefaultSitemapComponentSelector.java:104)
	at 
org.apache.cocoon.sitemap.DefaultSitemapComponentSelector.select(DefaultSitemapComponentSelector.java:104)
	at 
org.apache.cocoon.components.pipeline.AbstractStreamPipeline.setReader(AbstractStreamPipeline.java:140)
	at 
org.apache.cocoon.components.pipeline.CachingStreamPipeline.setReader(CachingStreamPipeline.java:123)
	at org.apache.cocoon.www.abc.sitemap_xmap.matchN1006C(C:\Program 
Files\Apache Tomcat 
4.0\work\Standalone\localhost\cocoon\cocoon-files\org/apache/cocoon/www/abc\sitemap_xmap.java:877)
	at org.apache.cocoon.www.abc.sitemap_xmap.process(C:\Program Files\Apache 
Tomcat 
4.0\work\Standalone\localhost\cocoon\cocoon-files\org/apache/cocoon/www/abc\sitemap_xmap.java:426)
	at org.apache.cocoon.www.abc.sitemap_xmap.process(C:\Program Files\Apache 
Tomcat 
4.0\work\Standalone\localhost\cocoon\cocoon-files\org/apache/cocoon/www/abc\sitemap_xmap.java:342)
	at org.apache.cocoon.sitemap.Handler.process(Handler.java:227)
	at org.apache.cocoon.sitemap.Manager.invoke(Manager.java:173)
	at 
org.apache.cocoon.sitemap.AbstractSitemap.invoke(AbstractSitemap.java:308)
	at org.apache.cocoon.www.sitemap_xmap.matchN102C5(C:\Program Files\Apache 
Tomcat 
4.0\work\Standalone\localhost\cocoon\cocoon-files\org/apache/cocoon/www\sitemap_xmap.java:3270)
	at org.apache.cocoon.www.sitemap_xmap.process(C:\Program Files\Apache 
Tomcat 
4.0\work\Standalone\localhost\cocoon\cocoon-files\org/apache/cocoon/www\sitemap_xmap.java:2555)
	at org.apache.cocoon.www.sitemap_xmap.process(C:\Program Files\Apache 
Tomcat 
4.0\work\Standalone\localhost\cocoon\cocoon-files\org/apache/cocoon/www\sitemap_xmap.java:2501)
	at org.apache.cocoon.sitemap.Handler.process(Handler.java:227)
	at org.apache.cocoon.sitemap.Manager.invoke(Manager.java:173)
	at 
org.apache.cocoon.sitemap.SitemapManager.process(SitemapManager.java:152)
	at org.apache.cocoon.Cocoon.process(Cocoon.java:579)
	at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1043)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
	at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
	at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at 
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at 
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
	at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at 
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
	at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
	at 
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at 
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
	at 
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
	at java.lang.Thread.run(Thread.java:595)


request-uri

/cocoon/abc/login.html

path-info

abc/login.html



I don't know where exactly to look to fix this.  If anyone could give me a 
place to look I would appreciate it.  Below I have the files that I am 
using.

Thanks for your time,

Aaron


--Sitemap------------------------------------------------

<?xml version="1.0"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<map:components>
	<map:generators default="file"/>
	<map:transformers default="xslt"/>
	<map:readers default="resources"/>
	<map:serializers default="html"/>
	<map:selectors default="browser"/>
	<map:matchers default="wildcard"/>
</map:components>

<map:pipelines>

	<map:pipeline>
		<map:match pattern="index.html">
			<map:generate type="file" src="content/main.xml"/>
			<map:transform type="xslt" src="style/main.xsl"/>
			<map:serialize type="html"/>
		</map:match>

		<map:match pattern="index.wml">
			<map:generate type="file" src="content/main.xml"/>
			<map:transform type="wml" src="style/main-wml.xsl"/>
			<map:serialize type="wml"/>
		</map:match>

		<map:match pattern="index.pdf">
			<map:generate type="file" src="content/main.xml"/>
			<map:transform type="xslt" src="style/main-pdf.xsl"/>
			<map:serialize type="fo2pdf"/>
		</map:match>

		<map:match pattern="index.ps">
			<map:generate type="file" src="content/main.xml"/>
			<map:transform type="xslt" src="style/main-pdf.xsl"/>
			<map:serialize type="fo2ps"/>
		</map:match>

		<map:match pattern="index.xsp">
			<map:generate type="serverpages" src="content/main.xsp"/>
			<map:transform type="xslt" src="style/main.xsl"/>
			<map:serialize type="html"/>
		</map:match>

		<map:match pattern="login.html">
			<map:read mime-type="text/html" src="content/login.html"/>
		</map:match>

		<map:match pattern="login">
			<map:generate type="serverpages" src="xsp/login.xsp"/>
			<map:transform type="xslt" src="style/main.xsl"/>
			<map:serialize type="html"/>
		</map:match>

	</map:pipeline>

</map:pipelines>

</map:sitemap>

--Login.xsp--------------------------------

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsp:page language="java"
	xmlns:xsp="http://apache.org/xsp"
	xmlns:xsp-request="http://apache.org/xsp/request/2.0"
	xmlns:xsp-session="http://apache.org/xsp/session/2.0"
	create-session="true">

	<page>

		<xsp:logic>
			String msg= "";
			String user = <xsp-request:get-parameter name="user"/>;
			String pwd = <xsp-request:get-parameter name="pass"/>;

			if(user.equals("BigCorp") &amp;&amp; pwd.equals("secret"))
			{
				msg = "user '" + user + "' has been authenticated" +
					" - you can now proceed to the support page.";
				<xsp-session:set-attribute name="user">
					<xsp:expr>user</xsp:expr>
				</xsp-session:set-attribute>;
			}
			else
			{
				msg = "Login failed";
			}
		</xsp:logic>

		<page-title>Login results</page-title>
		<content>
			<title>Login results</title>
			<paragraph>
				<xsp:expr>msg</xsp:expr>
			</paragraph>
		</content>

	</page>

	</xsp:page>


--login.html-------------------------------------------------------------

<html>
   <head>
      <title>Enter Login information</title>
      <style type="text/css">
		  <!-- body {font-family: verdana, helvitica, sans serif; font size: 
10pt;}
				td {font-family: verdana, helvitica, sans serif; font size: 10pt;}-->
      </style>
   </head>

   <body>
	<br/>
	<center>
		<h3>Please login to acces your trouble ticket information</h3>
	<!--</center>-->
	<br/>

	<form action="login" method="post">

		<table>
			<tr>
				<td align="right">User:</td>
				<td align="left"><input type="text" name="user"/></td>
			</tr>
			<tr>
				<td align="right">Password:</td>
				<td align="left"><input type="password" name="pass"/></td>
			</tr>
			<tr>
				<td colspan="2" align="center"><input type="submit" value="Login"/></td>
			</tr>
		</table>

	</form>

   </body>
</html>


-----cocoon.xconf--------------------------------- I also added this  
segment to this file

        <builtin-logicsheet>
          <parameter name="prefix" value="abc"/>
          <parameter name="uri" value="http://samspublishing.com/abc/1.0"/>
          <parameter name="href" value="file:///c:/Program Files/Apache 
Tomcat 4.0/webapps/cocoon/abc/style/abc.xsl"/>
        </builtin-logicsheet>

--abc.xsl------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:xsp="http://apache.org/xsp"
	xmlns:abc="http://samspublishing.com/abc/1.0"
	version="1.0" >

	<xsl:template match="xsp:page">
		<xsp:page>
			<xsl:apply-templates select="@*"/>

			<xsp:structure>
				<xsp:include>java.util.Date</xsp:include>
			</xsp:structure>

			<xsp:logic>
				Date now = new Date();
			</xsp:logic>

			<xsl:apply-templates/>
		</xsp:page>
	</xsl:template>

	<xsl:template match="abc:datetime">
		The current time is <xsp:expr>now</xsp:expr>
	</xsl:template>

	<xsl:template match="@*|node()">
		<xsl:copy>
			<xsl:apply-templates select="@*|node()"/>
		</xsl:copy>
	</xsl:template>

	<xsl:template match="text()">
		<xsl:value-of select="." />
	</xsl:template>


</xsl:stylesheet>



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


Re: ComponentSelector could not find the component Error

Posted by Bertrand Delacretaz <bd...@apache.org>.
Le 30 nov. 05, à 00:57, Mark Lundquist a écrit :
> ...To learn the new stuff, the best sources are (a) the samples, (b) 
> the docs, (c) this list! (including archives), and (d) the Wiki...

And (here's my daily plug for this) don't forget the bricks-cms example 
application, which demonstrates many of the current best practices, see 
http://wiki.apache.org/cocoon/BricksCms

-Bertrand

Re: ComponentSelector could not find the component Error

Posted by Mark Lundquist <ml...@wrinkledog.com>.
On Nov 29, 2005, at 3:38 PM, Aaron Bortman wrote:

> When I try to display the page login.html I get a fatal error that 
> looks like the following:
>
> message UnnamedSelector: ComponentSelector could not find the 
> component for hint [resources]

Hi Aaron,

You sort of have a typo.  Change this

	<map:readers default="resources"/>

to this:

	<map:readers default="resource"/>

and that problem will go away.

Now then...

>    I am relatively new with Cocoon and have been going through the 
> book "Cocoon Developer's handbook" by Lajos Moczar and Jeremy aston.  
> The book goes through an example of a website that a business might 
> use.  I am trying to add authentication to this website by adding an 
> xsp page called login.xsp and an html page called login.html.

OK, you should be aware that while this book was a good book for its 
time, it's really seriously obsolete in several important aspects.  In 
particular, XSP was important in Cocoon when that book was written, but 
now, while still supported, it's totally not recommended.  Generally 
speaking, for a newbie to spend time learning XSP is pretty much a 
waste.  Turn back now!! :-)

Most significantly:

• The approach now recognized as best-practice in the Cocoon community 
for building Cocoon apps is Flowscript + POJOs + the JXTemplate 
Generator (and input modules).  This cocktail of technologies didn't 
exist when Moczar & Aston was published!  Their recommended approaches 
of XSP and/or custom Generators and Actions are no longer considered to 
represent best-practice.

• Everything they say about forms has been obviated by the Cocoon Forms 
framework (which didn't exist then).

To learn the new stuff, the best sources are (a) the samples, (b) the 
docs, (c) this list! (including archives), and (d) the Wiki.  Consult 
them early and often! :-)

Cheers,
—ml—


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