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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to