You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Alexander Smirnoff <as...@vistar.ca> on 2001/10/19 23:24:04 UTC

Using Custom Component in Cocoon2

Hi,

I have made custom Component and trying to access it from XSP file. It seems
that it passes OK all main steps of
composition/configuration/initialization, but somehow at the end I getting
the next exception:

org.apache.avalon.framework.component.ComponentException: Could not access
the Component
        at
org.apache.avalon.excalibur.component.ExcaliburComponentManager.lookup(Unkno
wn Source) <-- Why ? It seems that it found it ?
        at
org.apache.cocoon.www.xsp.messages_xsp.generate(messages_xsp.java:278)
        at
org.apache.cocoon.generation.ServerPagesGenerator.generate(ServerPagesGenera
tor.java:175)
        at
org.apache.cocoon.components.pipeline.CachingEventPipeline.process(CachingEv
entPipeline.java:214)
...

thats the way how I look for it in XSP file:

com.gwvas.manager.Manager myComponent = (com.gwvas.manager.Manager)
manager.lookup("com.gwvas.manager.Manager");

thats the way how I defined it in cocoon.xconf

<component role="com.gwvas.manager.Manager"
class="com.gwvas.manager.DBCoreManager">
        <dbpool>documents</dbpool>
</component>

Component itself is attached to this email... Any ideas?

Thanks,
alex

Re: Using Custom Component in Cocoon2

Posted by Berin Loritsch <bl...@apache.org>.
Alexander Smirnoff wrote:
> 
> O-o, I've missed the wall... Sorry for stupid question...
> 
> But I have possible candidate for another one:
> 
> In my application I have  heavily relly on database connection pool. I've
> look into xsp esql file and see that the way you get Database Connection is
> via DataSourceComponent select method. So I don't have to use
> JdbcConnectionPool directly? How all working behind JdbcDataSource? Are any
> monitoring options exist?


Correct.  The Cocoon.xconf file has an entry to describe multiple datasources,
and get the pool of connections by name.  Once your Component is Composed
(i.e. implements Composable and receives the ComponentManager), you can lookup
the following role:

ComponentSelector selector =
    (ComponentSelector) manager.lookup(DataSourceComponent.ROLE + "Selector");

DataSourceComponent datasource = (DataSourceComponent) selector.select("poolname");
Connection conn = datasource.getConnection();

// ... do your stuff

conn.close();



As to monitoring options, there is a keepalive query that happens behind the scenes.
It performs a quick query to see if the connection is still open.  Beyond that, there
isn't anything else at this point.

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

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


Re: Using Custom Component in Cocoon2

Posted by Alexander Smirnoff <as...@vistar.ca>.
O-o, I've missed the wall... Sorry for stupid question...

But I have possible candidate for another one:

In my application I have  heavily relly on database connection pool. I've
look into xsp esql file and see that the way you get Database Connection is
via DataSourceComponent select method. So I don't have to use
JdbcConnectionPool directly? How all working behind JdbcDataSource? Are any
monitoring options exist?

Thanks,
Alex.

----- Original Message -----
From: "Berin Loritsch" <bl...@apache.org>
To: <co...@xml.apache.org>
Sent: Monday, October 22, 2001 9:15 AM
Subject: Re: Using Custom Component in Cocoon2


> Alexander Smirnoff wrote:
> >
> > Hi,
> >
> > I have made custom Component and trying to access it from XSP file. It
seems
> > that it passes OK all main steps of
> > composition/configuration/initialization, but somehow at the end I
getting
> > the next exception:
>
>
> The most basic reason of all.  Your component must implement Component.
Otherwise
> it cannot possibly return it to you.  The return type for the lookup()
command
> is a Component.  Component is a marker interface (no methods):
>
> org.apache.avalon.framework.component.Component
>
> >
> > org.apache.avalon.framework.component.ComponentException: Could not
access
> > the Component
> >         at
> >
org.apache.avalon.excalibur.component.ExcaliburComponentManager.lookup(Unkno
> > wn Source) <-- Why ? It seems that it found it ?
> >         at
> > org.apache.cocoon.www.xsp.messages_xsp.generate(messages_xsp.java:278)
> >         at
> >
org.apache.cocoon.generation.ServerPagesGenerator.generate(ServerPagesGenera
> > tor.java:175)
> >         at
> >
org.apache.cocoon.components.pipeline.CachingEventPipeline.process(CachingEv
> > entPipeline.java:214)
> > ...
> >
> > thats the way how I look for it in XSP file:
> >
> > com.gwvas.manager.Manager myComponent = (com.gwvas.manager.Manager)
> > manager.lookup("com.gwvas.manager.Manager");
> >
> > thats the way how I defined it in cocoon.xconf
> >
> > <component role="com.gwvas.manager.Manager"
> > class="com.gwvas.manager.DBCoreManager">
> >         <dbpool>documents</dbpool>
> > </component>
> >
> > Component itself is attached to this email... Any ideas?
> >
> > Thanks,
> > alex
> >
>
  --------------------------------------------------------------------------
----------------------------------------------------------
> >                          Name: DBCoreManager.java
> >    DBCoreManager.java    Type: Java Class (java/*)
> >                      Encoding: quoted-printable
> >
>
  --------------------------------------------------------------------------
----------------------------------------------------------
> > ---------------------------------------------------------------------
> > Please check that your question has not already been answered in the
> > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> >
> > To unsubscribe, e-mail: <co...@xml.apache.org>
> > For additional commands, e-mail: <co...@xml.apache.org>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>


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

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


Re: Using Custom Component in Cocoon2

Posted by Berin Loritsch <bl...@apache.org>.
Alexander Smirnoff wrote:
> 
> Hi,
> 
> I have made custom Component and trying to access it from XSP file. It seems
> that it passes OK all main steps of
> composition/configuration/initialization, but somehow at the end I getting
> the next exception:


The most basic reason of all.  Your component must implement Component.  Otherwise
it cannot possibly return it to you.  The return type for the lookup() command
is a Component.  Component is a marker interface (no methods):

org.apache.avalon.framework.component.Component

> 
> org.apache.avalon.framework.component.ComponentException: Could not access
> the Component
>         at
> org.apache.avalon.excalibur.component.ExcaliburComponentManager.lookup(Unkno
> wn Source) <-- Why ? It seems that it found it ?
>         at
> org.apache.cocoon.www.xsp.messages_xsp.generate(messages_xsp.java:278)
>         at
> org.apache.cocoon.generation.ServerPagesGenerator.generate(ServerPagesGenera
> tor.java:175)
>         at
> org.apache.cocoon.components.pipeline.CachingEventPipeline.process(CachingEv
> entPipeline.java:214)
> ...
> 
> thats the way how I look for it in XSP file:
> 
> com.gwvas.manager.Manager myComponent = (com.gwvas.manager.Manager)
> manager.lookup("com.gwvas.manager.Manager");
> 
> thats the way how I defined it in cocoon.xconf
> 
> <component role="com.gwvas.manager.Manager"
> class="com.gwvas.manager.DBCoreManager">
>         <dbpool>documents</dbpool>
> </component>
> 
> Component itself is attached to this email... Any ideas?
> 
> Thanks,
> alex
> 
>   ------------------------------------------------------------------------------------------------------------------------------------
>                          Name: DBCoreManager.java
>    DBCoreManager.java    Type: Java Class (java/*)
>                      Encoding: quoted-printable
> 
>   ------------------------------------------------------------------------------------------------------------------------------------
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> 
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>

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

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


Re: JSP Example With Cocoon2

Posted by Earl Bingham <ea...@yahoo.com>.
I am using tomcat4.0+cocoon2.2b on Windows 2000

I receive the following error when trying to run the JSP example that comes 
with cocoon:

java.lang.NoClassDefFoundError: org/apache/jasper/JasperException at 
java.lang.Class.newInstance0(Native Method) at 
java.lang.Class.newInstance(Class.java:237)




At 04:44 PM 10/20/2001 +0100, Sergio Carvalho wrote:

>Did you copy jasper-compiler.jar to cocoon/WEB-INF/lib ?
>
>On Fri, 19 Oct 2001 16:56:47 -0700, Earl Bingham wrote:
>From: Earl Bingham <ea...@yahoo.com>
>--
>
> >
> > I have the latest and the 2.2b release build of Cocoon2. The JSP example
> > the comes with the release that uses the JspGenerator doesn't work. I have
> > tried it on Windows 2000 with Tomcat4.0 and RedHat Linux with Tomcat4.0
> >
> > Is there something wrong with the example or do I not have something
> > configured correctly?
> >
> > Best Regards,
> >
> > Earl Bingham
> >
> >
> > _________________________________________________________
> > Do You Yahoo!?
> > Get your free @yahoo.com address at http://mail.yahoo.com
> >
> >
> > ---------------------------------------------------------------------
> > Please check that your question has not already been answered in the
> > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> >
> > To unsubscribe, e-mail: <co...@xml.apache.org>
> > For additional commands, e-mail: <co...@xml.apache.org>
> >
>
>
>--
>Sergio Carvalho
>---------------
>sergio.carvalho@acm.org
>
>If at first you don't succeed, skydiving is not for you
>
>---------------------------------------------------------------------
>Please check that your question has not already been answered in the
>FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
>To unsubscribe, e-mail: <co...@xml.apache.org>
>For additional commands, e-mail: <co...@xml.apache.org>

Best Regards,

Earl Bingham

---
Earl Bingham            http://www.sdforum.org/sigs/xml
Software Architect      Cell: 650.303.1695
earl_bingham1@yahoo.com


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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

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


Re: JSP Example With Cocoon2

Posted by Sergio Carvalho <se...@acm.org>.
Did you copy jasper-compiler.jar to cocoon/WEB-INF/lib ?

On Fri, 19 Oct 2001 16:56:47 -0700, Earl Bingham wrote:
From: Earl Bingham <ea...@yahoo.com>
--

> 
> I have the latest and the 2.2b release build of Cocoon2. The JSP example 
> the comes with the release that uses the JspGenerator doesn't work. I have 
> tried it on Windows 2000 with Tomcat4.0 and RedHat Linux with Tomcat4.0
> 
> Is there something wrong with the example or do I not have something 
> configured correctly?
> 
> Best Regards,
> 
> Earl Bingham
> 
> 
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
> 
> 
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> 
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
> 


--
Sergio Carvalho
---------------
sergio.carvalho@acm.org

If at first you don't succeed, skydiving is not for you

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

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


JSP Example With Cocoon2

Posted by Earl Bingham <ea...@yahoo.com>.
I have the latest and the 2.2b release build of Cocoon2. The JSP example 
the comes with the release that uses the JspGenerator doesn't work. I have 
tried it on Windows 2000 with Tomcat4.0 and RedHat Linux with Tomcat4.0

Is there something wrong with the example or do I not have something 
configured correctly?

Best Regards,

Earl Bingham


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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

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