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: [EMAIL PROTECTED]

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.

Reply via email to