You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Hugh Field-Richards <h....@eris.qinetiq.com> on 2003/12/08 11:05:40 UTC

JXForms and uploading

Hi

Having read all the posts and advice on file uploading I am still
experiencing some trouble with the whole process. Any help in
pointing out my stupidities would be gratefully received. I have
followed the formula suggested ...

I have a cocoon app which I have called "niscc". All else works,
serving pages, talking to an eXist database, transforms etc, only
the uploads do not. ALl the following is bas3ed on the excellent
examples given in the posts over the last few weeks ...

The niscc.xconf file has

	<cocoon version="2.1" user-roles="/WEB-INF/user.xroles">
		...


web.xml

	<?xml version="1.0" encoding="UTF-8"?>
	<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web  
Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

	<web-app>

		...

	    <init-param>
	      <param-name>enable-uploads</param-name>
	      <param-value>true</param-value>
	    </init-param>

	    <init-param>
	      <param-name>upload-directory</param-name>
	      <param-value>docs/pdf</param-value>
	    </init-param>

	    <init-param>
	      <param-name>autosave-uploads</param-name>
	      <param-value>true</param-value>
	    </init-param>

	    <init-param>
	      <param-name>overwrite-uploads</param-name>
	      <param-value>allow</param-value>
	    </init-param>

		...
	
	</web-app>

user.xroles

	<?xml version="1.0"  encoding="UTF-8"?>

	<role-list>
	   <role name="uk.gov.niscc.FileUploadManager"
	      shorthand="upload_manager"
	      default-class="uk.gov.niscc.FileUploadManagerImpl" />
	</role-list>

FileUploadManager and FileUploadManagerImpl are identical to
the examples posted except that their package name is now

	package uk.gov.niscc;

I have a JXform which uses the following flowscript whose key
parts are

	cocoon.load(  
"resource://org/apache/cocoon/components/jxforms/flow/javascript/ 
JXForm.js" );

	var role = Packages.uk.gov.niscc.FileUploadManagerImpl.ROLE;

	function enterPDFWizard( form ) {

	   var enterPDFModel = {
			...
	   }

	   // associate your model with the form.
		form.setModel( enterPDFModel );

		form.sendView( "enterPDFMeta.html" );
	   cocoon.log.info( "role: " + role );
	   cocoon.log.info( "role: " +  
Packages.uk.gov.niscc.FileUploadManagerImpl.returnClass() );
	   var uploader = cocoon.getComponent( role );     // <-- error  
message below occurs here

	   ...

	}

The relevant parts of the form are

	<form xmlns:xf="http://apache.org/cocoon/jxforms/1.0"  
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
			enctype="multipart/form-data" method="post"  
id="enterPDFForm-feedback">
		<input value="" name="cocoon-xmlform-view" type="hidden">
		<input name="localDocRef" type="file" size="50">
	</form>

running all this gets the error message from

	org.apache.avalon.framework.component.ComponentException: Could not  
find component (key [uk.gov.niscc.nisccFileUploadManagerImpl])

from the indicated point in the flowscript. Since the flow.log shows

	... Thread-18/FOM_Cocoon$FOM_Log: role:  
uk.gov.niscc.FileUploadManagerImpl
	... Thread-18/FOM_Cocoon$FOM_Log: role: Upload class:  
uk.gov.niscc.FileUploadManagerImpl

it seems clear that the FileUploadManagerImpl class is being found.  
What is
the significance of the above error? I am sure that I have missed  
something
very simple but after several days of searching I am at a loss to know  
what.
Any help here would in restoring some sanity and restful nights :-)

TIA

Hugh F-R





Dr Hugh S. Field-Richards
Principle Scientist
QinetiQ, St Andrew's Road, Malvern, Worcs, WR14 3PS, UK
Tel: ++1684 895075   Fax: ++1684 896113
Email: h.field-richards@eris.qinetiq.com

The views expressed above area are entirely those of the writer and
do not represent the views, policy or understanding of any other
person or official body.


Re: JXForms and uploading

Posted by Hugh Field-Richards <h....@eris.qinetiq.com>.
Thanks for the help.

But ...

On Monday, December 8, 2003, at 03:09  pm, Geoff Howard wrote:

> Your test shows that the class is on the classpath, but the lookup  
> shows that it was not successfully found by the  
> ComponentManager/ServiceManager.
>
> - If you are using Tomcat (and perhaps the version of Jetty in very  
> current CVS of 2.1) try skipping the leading slash on your user-roles  
> attribute in niscc.xconf.  Refer to  
> http://cocoon.apache.org/2.1/faq/faq-configure-c2.html.

I am using Tomcat 4.1.24 and removing the leading slash make the whole  
thing fail.

> - Renaming cocoon.xconf is unusual - have you made other configuration  
> changes (I think web.xml?) tell Cocoon to use niscc.xconf instead of  
> cocoon.xconf?

I renamed it as I had a cocoon webapp sharing the same webapp directory  
as the
niscc webapp so that I can run both. I believe that I have got all the  
bits in web.xml
suitably changed. At least, everything else in quite a complex site  
works just fine.

> - It's also possible that the Manager has successfully associated your  
> role and class, but an error occurs during one of the lifecycle  
> events.  Adding logging to your component and configuring logkit.xconf  
> with a low enough log level threshold should turn this up.   
> Alternatively, you should also be able to so System.out.println() just  
> for temporary quick diagnosis.

It does not even get into my component to activate any logging.

> You can also try skipping the .roles file and adding your component to  
> cocoon.xconf/niscc.xconf directly with the component-instance element.  
> There are examples in the standard cocoon.xconf which should work.  If  
> you go this route, you should look into using the XPatch ant task  
> either as used in the standard Cocoon build or by including it into  
> your own build script using ant's taskdef.

Does not seem to make much difference to the error if I add it there. I  
guess that
it is not even recognising my class. It is difficult to know where to  
go from here.
I intend to keep looking and hoping that something surfaces in the days  
to come.

Hugh F-R

>
> Geoff
>
> Hugh Field-Richards wrote:
>> Hi
>> Having read all the posts and advice on file uploading I am still
>> experiencing some trouble with the whole process. Any help in
>> pointing out my stupidities would be gratefully received. I have
>> followed the formula suggested ...
>> I have a cocoon app which I have called "niscc". All else works,
>> serving pages, talking to an eXist database, transforms etc, only
>> the uploads do not. ALl the following is bas3ed on the excellent
>> examples given in the posts over the last few weeks ...
>> The niscc.xconf file has
>> <cocoon version="2.1" user-roles="/WEB-INF/user.xroles">
>> ...
>> web.xml
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web  
>> Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
>> <web-app>
>> ...
>> <init-param>
>> <param-name>enable-uploads</param-name>
>> <param-value>true</param-value>
>> </init-param>
>> <init-param>
>> <param-name>upload-directory</param-name>
>> <param-value>docs/pdf</param-value>
>> </init-param>
>> <init-param>
>> <param-name>autosave-uploads</param-name>
>> <param-value>true</param-value>
>> </init-param>
>> <init-param>
>> <param-name>overwrite-uploads</param-name>
>> <param-value>allow</param-value>
>> </init-param>
>> ...
>> </web-app>
>> user.xroles
>> <?xml version="1.0" encoding="UTF-8"?>
>> <role-list>
>> <role name="uk.gov.niscc.FileUploadManager"
>> shorthand="upload_manager"
>> default-class="uk.gov.niscc.FileUploadManagerImpl" />
>> </role-list>
>> FileUploadManager and FileUploadManagerImpl are identical to
>> the examples posted except that their package name is now
>> package uk.gov.niscc;
>> I have a JXform which uses the following flowscript whose key
>> parts are
>> cocoon.load(  
>> "resource://org/apache/cocoon/components/jxforms/flow/javascript/ 
>> JXForm.js" );
>> var role = Packages.uk.gov.niscc.FileUploadManagerImpl.ROLE;
>> function enterPDFWizard( form ) {
>> var enterPDFModel = {
>> ...
>> }
>> // associate your model with the form.
>> form.setModel( enterPDFModel );
>> form.sendView( "enterPDFMeta.html" );
>> cocoon.log.info( "role: " + role );
>> cocoon.log.info( "role: " +  
>> Packages.uk.gov.niscc.FileUploadManagerImpl.returnClass() );
>> var uploader = cocoon.getComponent( role ); // <-- error message  
>> below occurs here
>> ...
>> }
>> The relevant parts of the form are
>> <form xmlns:xf="http://apache.org/cocoon/jxforms/1.0"  
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> enctype="multipart/form-data" method="post"  
>> id="enterPDFForm-feedback">
>> <input value="" name="cocoon-xmlform-view" type="hidden">
>> <input name="localDocRef" type="file" size="50">
>> </form>
>> running all this gets the error message from
>> org.apache.avalon.framework.component.ComponentException: Could not  
>> find component (key [uk.gov.niscc.nisccFileUploadManagerImpl])
>> from the indicated point in the flowscript. Since the flow.log shows
>> ... Thread-18/FOM_Cocoon$FOM_Log: role:  
>> uk.gov.niscc.FileUploadManagerImpl
>> ... Thread-18/FOM_Cocoon$FOM_Log: role: Upload class:  
>> uk.gov.niscc.FileUploadManagerImpl
>> it seems clear that the FileUploadManagerImpl class is being found.  
>> What is
>> the significance of the above error? I am sure that I have missed  
>> something
>> very simple but after several days of searching I am at a loss to  
>> know what.
>> Any help here would in restoring some sanity and restful nights :-)
>> TIA
>> Hugh F-R
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


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


Re: JXForms and uploading

Posted by Geoff Howard <co...@leverageweb.com>.
Your test shows that the class is on the classpath, but the lookup shows 
that it was not successfully found by the ComponentManager/ServiceManager.

- If you are using Tomcat (and perhaps the version of Jetty in very 
current CVS of 2.1) try skipping the leading slash on your user-roles 
attribute in niscc.xconf.  Refer to 
http://cocoon.apache.org/2.1/faq/faq-configure-c2.html.
- Renaming cocoon.xconf is unusual - have you made other configuration 
changes (I think web.xml?) tell Cocoon to use niscc.xconf instead of 
cocoon.xconf?
- It's also possible that the Manager has successfully associated your 
role and class, but an error occurs during one of the lifecycle events. 
  Adding logging to your component and configuring logkit.xconf with a 
low enough log level threshold should turn this up.  Alternatively, you 
should also be able to so System.out.println() just for temporary quick 
diagnosis.

You can also try skipping the .roles file and adding your component to 
cocoon.xconf/niscc.xconf directly with the component-instance element. 
There are examples in the standard cocoon.xconf which should work.  If 
you go this route, you should look into using the XPatch ant task either 
as used in the standard Cocoon build or by including it into your own 
build script using ant's taskdef.

Geoff

Hugh Field-Richards wrote:
> Hi
> 
> Having read all the posts and advice on file uploading I am still
> experiencing some trouble with the whole process. Any help in
> pointing out my stupidities would be gratefully received. I have
> followed the formula suggested ...
> 
> I have a cocoon app which I have called "niscc". All else works,
> serving pages, talking to an eXist database, transforms etc, only
> the uploads do not. ALl the following is bas3ed on the excellent
> examples given in the posts over the last few weeks ...
> 
> The niscc.xconf file has
> 
> <cocoon version="2.1" user-roles="/WEB-INF/user.xroles">
> ...
> 
> 
> web.xml
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 
> 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
> 
> <web-app>
> 
> ...
> 
> 
> <init-param>
> <param-name>enable-uploads</param-name>
> <param-value>true</param-value>
> </init-param>
> 
> 
> <init-param>
> <param-name>upload-directory</param-name>
> <param-value>docs/pdf</param-value>
> </init-param>
> 
> <init-param>
> <param-name>autosave-uploads</param-name>
> <param-value>true</param-value>
> </init-param>
> 
> <init-param>
> <param-name>overwrite-uploads</param-name>
> <param-value>allow</param-value>
> </init-param>
> 
> ...
> 
> 
> </web-app>
> 
> user.xroles
> 
> <?xml version="1.0" encoding="UTF-8"?>
> 
> <role-list>
> <role name="uk.gov.niscc.FileUploadManager"
> shorthand="upload_manager"
> default-class="uk.gov.niscc.FileUploadManagerImpl" />
> </role-list>
> 
> FileUploadManager and FileUploadManagerImpl are identical to
> the examples posted except that their package name is now
> 
> package uk.gov.niscc;
> 
> I have a JXform which uses the following flowscript whose key
> parts are
> 
> cocoon.load( 
> "resource://org/apache/cocoon/components/jxforms/flow/javascript/JXForm.js" 
> );
> 
> var role = Packages.uk.gov.niscc.FileUploadManagerImpl.ROLE;
> 
> function enterPDFWizard( form ) {
> 
> var enterPDFModel = {
> ...
> }
> 
> // associate your model with the form.
> form.setModel( enterPDFModel );
> 
> form.sendView( "enterPDFMeta.html" );
> cocoon.log.info( "role: " + role );
> cocoon.log.info( "role: " + 
> Packages.uk.gov.niscc.FileUploadManagerImpl.returnClass() );
> var uploader = cocoon.getComponent( role ); // <-- error message below 
> occurs here
> 
> ...
> 
> }
> 
> The relevant parts of the form are
> 
> <form xmlns:xf="http://apache.org/cocoon/jxforms/1.0" 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> enctype="multipart/form-data" method="post" id="enterPDFForm-feedback">
> <input value="" name="cocoon-xmlform-view" type="hidden">
> <input name="localDocRef" type="file" size="50">
> </form>
> 
> running all this gets the error message from
> 
> org.apache.avalon.framework.component.ComponentException: Could not find 
> component (key [uk.gov.niscc.nisccFileUploadManagerImpl])
> 
> from the indicated point in the flowscript. Since the flow.log shows
> 
> ... Thread-18/FOM_Cocoon$FOM_Log: role: uk.gov.niscc.FileUploadManagerImpl
> ... Thread-18/FOM_Cocoon$FOM_Log: role: Upload class: 
> uk.gov.niscc.FileUploadManagerImpl
> 
> it seems clear that the FileUploadManagerImpl class is being found. What is
> the significance of the above error? I am sure that I have missed something
> very simple but after several days of searching I am at a loss to know 
> what.
> Any help here would in restoring some sanity and restful nights :-)
> 
> TIA
> 
> Hugh F-R


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