You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by Simon Clark <si...@zebraspot.com> on 2007/12/01 22:27:30 UTC

Re: Custom mailet not getting recognized

ok, slowly, the problems are falling away.

I have created a custom mailet, but it is not recognizing on James  
restart, causing startup to fail.

Right now, it is essentially the AddFooter mailet.  I combined the  
code of AddFooter and AbstractAddFooter, figuring that I'd customize  
from there, once it is working. This is the resulting VTBList.java  
file: (sample at www.zebraspot.com/VTBList.java )

Next I created my jar file in SAR-INF/lib using :
     jar cf /si/james-2.3.2/apps/james/SAR-INF/lib/VTBList.jar /si/ 
VTBList.java
Some pages in my google searching mentioned using maven. Is this  
necessary?

Next I added:
       <mailetpackage>com.zebraspot.mailets</mailetpackage>
and later
         <mailet match="All" class="VTBList">
                 <text>Warning: Attachments may contain viruses!</text>
          </mailet>
to the config.xml.

Now, JAMES will not start up without error.  It looks in  
com.zebraspot.mailets for the VBTList mailet, but does not find it.  
 From phoenix.log:
         java.lang.ClassNotFoundException: Requested mailet not  
found: VTBList.  looked in [, org.apache.james.transport.mailets.,  
org.apache.james.transport.mailets.smime.,  
com.zebraspot.mailets.]).ERROR   2007-12-01 21:20:26.655 [Phoenix.]  
(): There was an error running phase "startup" for Block named  
"spoolmanager". (Reason: Component named "spoolmanager" failed to  
pass through the Starting stage. (Reason:  
org.apache.mailet.MailetException: Could not load mailet (VTBList);
...

  Googling has not given me any clues.

Any ideas?  I suspect it is something to do with how I am creating my  
mailet's .jar file.  Does it need to have a specific name?

Simon

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: Custom mailet not getting recognized

Posted by Simon Clark <si...@zebraspot.com>.
Success!

Not sure if I did everything the best way, or even the right way, but  
I have a mailet working. Yay!

Here's what I had to do, for the sake of documenting...

- Download the source files for Java5 SDK and unpack them into my  
$JAVA_HOME directory.

- Download the GlassFish code repository to get the sources for  
JavaMail and JAF (.jars weren't working. not sure if they should).  I  
ended up having to manually place a whole bunch of code folders into  
what I felt were the appropriate places in the JAVA_HOME folder (I  
took my hints from the javac output.

execute the following commands:
javac /si/james-2.3.2/apps/james/SAR-INF/classes/com/zebraspot/ 
mailets/VTBList.java -classpath /si/james-2.3.2/MailetSDK/src/java:/ 
usr/lib/jvm/java-1.5.0-sun -J-Xms256m -J-Xmx256m
jar cf /si/james-2.3.2/apps/james/SAR-INF/lib/ 
com.zebraspot.mailet.jar /si/james-2.3.2/apps/james/SAR-INF/classes/ 
com/zebraspot/mailets/VTBList.class
/etc/init.d/james restart

> You have to put a .class file (a compiled version of your VTBList.java
> file in the jar and it has to be placed in the "com/zebraspot/ 
> mailets/"
> folder inside the jar.
>
> If you don't want to create a jar you can even place the class file  
> in:
> si/james-2.3.2/apps/james/SAR-INF/classes/com/zebraspot/mailets/ 
> VTBList.class
>

Now onto trying to actually customize it...
Thanks for the help so far.

Simon

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: Custom mailet not getting recognized

Posted by Stefano Bagnara <ap...@bago.org>.
Simon Clark ha scritto:
> 
> On 2-Dec-07, at 5:47 AM, Norman Maurer wrote:
> 
>> Are you sure that your package name match ?
>> I never used jar directly to create a jar. But shouldn't the directory
>> layout looks like:
>>
>> /your/package/name/VTBList.java ?
> 
> You mean the directory structure within the .jar?  I tried to do this,
> adding my com directory to the jar file instead of the file directly. 
> It did not seem to make any difference.

You have to put a .class file (a compiled version of your VTBList.java
file in the jar and it has to be placed in the "com/zebraspot/mailets/"
folder inside the jar.

If you don't want to create a jar you can even place the class file in:
si/james-2.3.2/apps/james/SAR-INF/classes/com/zebraspot/mailets/VTBList.class


Stefano

> All the directions I have been able to find specifically for mailets
> simply say 'create your JAR file.', so combined with being pretty new to
> Java, I am running a little blind in that respect.  Once I get it
> running, I'll put together a simple tutorial for other inexperienced users.
> 
> Simon



---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: Custom mailet not getting recognized

Posted by Simon Clark <si...@zebraspot.com>.
On 2-Dec-07, at 5:47 AM, Norman Maurer wrote:

> Are you sure that your package name match ?
> I never used jar directly to create a jar. But shouldn't the directory
> layout looks like:
>
> /your/package/name/VTBList.java ?

You mean the directory structure within the .jar?  I tried to do  
this, adding my com directory to the jar file instead of the file  
directly.  It did not seem to make any difference.

All the directions I have been able to find specifically for mailets  
simply say 'create your JAR file.', so combined with being pretty new  
to Java, I am running a little blind in that respect.  Once I get it  
running, I'll put together a simple tutorial for other inexperienced  
users.

Simon

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: Custom mailet not getting recognized

Posted by Norman Maurer <no...@apache.org>.
Are you sure that your package name match ?
I never used jar directly to create a jar. But shouldn't the directory
layout looks like:

/your/package/name/VTBList.java ?

bye
Norman

Am Samstag, den 01.12.2007, 16:27 -0500 schrieb Simon Clark:
> ok, slowly, the problems are falling away.
> 
> I have created a custom mailet, but it is not recognizing on James  
> restart, causing startup to fail.
> 
> Right now, it is essentially the AddFooter mailet.  I combined the  
> code of AddFooter and AbstractAddFooter, figuring that I'd customize  
> from there, once it is working. This is the resulting VTBList.java  
> file: (sample at www.zebraspot.com/VTBList.java )
> 
> Next I created my jar file in SAR-INF/lib using :
>      jar cf /si/james-2.3.2/apps/james/SAR-INF/lib/VTBList.jar /si/ 
> VTBList.java
> Some pages in my google searching mentioned using maven. Is this  
> necessary?
> 
> Next I added:
>        <mailetpackage>com.zebraspot.mailets</mailetpackage>
> and later
>          <mailet match="All" class="VTBList">
>                  <text>Warning: Attachments may contain viruses!</text>
>           </mailet>
> to the config.xml.
> 
> Now, JAMES will not start up without error.  It looks in  
> com.zebraspot.mailets for the VBTList mailet, but does not find it.  
>  From phoenix.log:
>          java.lang.ClassNotFoundException: Requested mailet not  
> found: VTBList.  looked in [, org.apache.james.transport.mailets.,  
> org.apache.james.transport.mailets.smime.,  
> com.zebraspot.mailets.]).ERROR   2007-12-01 21:20:26.655 [Phoenix.]  
> (): There was an error running phase "startup" for Block named  
> "spoolmanager". (Reason: Component named "spoolmanager" failed to  
> pass through the Starting stage. (Reason:  
> org.apache.mailet.MailetException: Could not load mailet (VTBList);
> ...
> 
>   Googling has not given me any clues.
> 
> Any ideas?  I suspect it is something to do with how I am creating my  
> mailet's .jar file.  Does it need to have a specific name?
> 
> Simon
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org