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 Disha <di...@openskysoftware.com> on 2003/02/18 01:27:31 UTC

gets stuck in foreign class methods while in the custom mailet

Hi James users,
I am working with James for about 2 weeks now. I have downloaded the
latest james version.

I am trying to implement a mailet that is similar to the localDelivery
mailet which writes all the incoming local mails to a database.

I am running into this wierd problem where james seems to ignore any
reference to foreign classes in the mailet.
I have imported these classes in the mailet, I have also tried adding
the jar of these classes in the james.sar with the custom mailet that i
have written.
I know James is doing some kind of dynamic loading of the mailets and it
does not load the other classes I need for the mailet.
Nor does it throw any error or exception, it just gets stuck at the
method call and does not complain.

Here is an example:

import home.data.myInbox;

public class myMailet extends GenericMailet {
	public void service(Mail mail) throws MessagingException {

		System.out.println("In mailets ");
		myInbox inbox = new myInbox();

		System.out.println("out");
		mail.setState(Mail.GHOST);
    	}
}

When james processes a mail:
It outputs: In mailets
and then gets stuck at the line: myInbox inbox = new myInbox();


Can anyone please let me know how would I make the mailet load myInbox;	

Thanks,
Disha
  
-- 
Disha <di...@openskysoftware.com>


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


RE: gets stuck in foreign class methods while in the custom mailet

Posted by "Noel J. Bergman" <no...@devtech.com>.
> I have a mailet in say: home.application.myMailets and it imports third
> party classes.

Right now if you have mailets outside of the default package, you are asking
for grief.  James v3 will support custom matcher/mailet packages much
better.

The easiest thing to do today is to take the source distribution, and add
your custom matchers/mailets in the same package as the James
matchers/mailets.

There is an approach to using custom matchers/mailets described in the
following:

http://nagoya.apache.org/eyebrowse/ReadMsg?listName=james-user@jakarta.apach
e.org&msgId=505754

But I don't recommend it.

	--- Noel


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


RE: gets stuck in foreign class methods while in the custom mailet

Posted by Disha <di...@openskysoftware.com>.
On Tue, 2003-02-18 at 11:42, Noel J. Bergman wrote:
> > Though mailet.jar exists in the /lib
> 
> The mailet.jar is built during the build process, and is not located in
> lib/.  If you see mailet.jar in lib/, you are looking in the wrong directory
> (build/lib/).
> 
>    -- run ./build.sh clean (or build clean)
>    -- put your jar in lib/
>    -- do the build
> 
> To recap: you have a mailet in org.apache.james.transport.mailets, and it
> relies upon a third party jar.  The mailet should be built along with james,
> and the third party jar in lib/ prior to doing the build, along with the
> rest of the third party jar files.

I have a mailet in say: home.application.myMailets and it imports third
party classes. Initially I used to place my jar file containing the
myMailet jar and third party jar in build/lib and then re-build. 
Now when I place them in lib and re-build, it says:
Could not load mailet (myMailet)

I have put the right package in mailetPackages in the conf file.

Do we need to load the third party classes that the custom mailet uses
by using the classLoader the way mailet loader does it? maybe overwrite
the init() method of mailet.
This is the only thing I can figure out why it overlooks the third party
classes. 
> 
> 	--- Noel
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-user-help@jakarta.apache.org
-- 
Disha <di...@openskysoftware.com>


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


RE: gets stuck in foreign class methods while in the custom mailet

Posted by "Noel J. Bergman" <no...@devtech.com>.
> Though mailet.jar exists in the /lib

The mailet.jar is built during the build process, and is not located in
lib/.  If you see mailet.jar in lib/, you are looking in the wrong directory
(build/lib/).

   -- run ./build.sh clean (or build clean)
   -- put your jar in lib/
   -- do the build

To recap: you have a mailet in org.apache.james.transport.mailets, and it
relies upon a third party jar.  The mailet should be built along with james,
and the third party jar in lib/ prior to doing the build, along with the
rest of the third party jar files.

	--- Noel


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


RE: gets stuck in foreign class methods while in the custom mailet

Posted by Disha <di...@openskysoftware.com>.
On Tue, 2003-02-18 at 10:18, Noel J. Bergman wrote:
> > I put the jar in build/lib with the james.sar and build it.
> > I then put the james.sar in james-2.1/apps.

> 
> Try putting it into lib/, along with the rest of the third party jars.

  I put my jar in lib/ and it threw this exception while restarting
james:
	 Component named "spoolmanager" failed to pass through the
Initialization stage. (Reason: java.lang.NoClassDefFoundError:
org/apache/mailet/GenericMailet)

Though mailet.jar exists in the /lib
Now if I remove my jar out of lib it does not throw any exception, even
though I havnt touched the mailet.jar. I am completely lost
-Disha

> 
> 	--- Noel
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-user-help@jakarta.apache.org
-- 
Disha <di...@openskysoftware.com>


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


RE: gets stuck in foreign class methods while in the custom mailet

Posted by "Noel J. Bergman" <no...@devtech.com>.
> I put the jar in build/lib with the james.sar and build it.
> I then put the james.sar in james-2.1/apps.

Try putting it into lib/, along with the rest of the third party jars.

	--- Noel

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


RE: gets stuck in foreign class methods while in the custom mailet

Posted by Disha <di...@openskysoftware.com>.
I put the jar in build/lib with the james.sar and build it.
I then put the james.sar in james-2.1/apps.

This is the phoenix log I got last evening after I build the .sar,
Any suggestions,

INFO    2003-02-17 17:53:23.850 [Phoenix ] (): Logger started
WARN    2003-02-17 17:53:24.144 [Phoenix ] (): Phoenix was not started
by the daemon thus it will not be possible to restart the JVM via the
Management interface.
INFO    2003-02-17 17:53:27.672 [Phoenix.] (): Installing Sar located at
file:/home/public/Downloads/James/james-2.1/apps/james.sar.
WARN    2003-02-17 17:53:29.352 [Phoenix.] (): The file
SAR-INF/lib/mm.mysql.LICENCE can not be extracted from the Sar
"file:/home/public/Downloads/James/james-2.1/apps/james.sar" into
directory
/home/public/Downloads/James/james-2.1/apps/james/SAR-INF/lib/mm.mysql.LICENCE because there is a file in the way.
WARN    2003-02-17 17:53:29.373 [Phoenix.] (): The file
conf/sqlResources.xml can not be extracted from the Sar
"file:/home/public/Downloads/James/james-2.1/apps/james.sar" into
directory
/home/public/Downloads/James/james-2.1/apps/james/conf/sqlResources.xml
because there is a file in the way.
WARN    2003-02-17 17:53:29.385 [Phoenix.] (): The file
SAR-INF/config.xml can not be extracted from the Sar
"file:/home/public/Downloads/James/james-2.1/apps/james.sar" into
directory
/home/public/Downloads/James/james-2.1/apps/james/SAR-INF/config.xml
because there is a file in the way.
WARN    2003-02-17 17:53:29.396 [Phoenix.] (): The file
SAR-INF/assembly.xml can not be extracted from the Sar
"file:/home/public/Downloads/James/james-2.1/apps/james.sar" into
directory
/home/public/Downloads/James/james-2.1/apps/james/SAR-INF/assembly.xml
because there is a file in the way.
WARN    2003-02-17 17:53:29.410 [Phoenix.] (): The file
SAR-INF/environment.xml can not be extracted from the Sar
"file:/home/public/Downloads/James/james-2.1/apps/james.sar" into
directory
/home/public/Downloads/James/james-2.1/apps/james/SAR-INF/environment.xml because there is a file in the way.
INFO    2003-02-17 17:53:29.913 [Phoenix.] (): No policy specified in
server.xml, giving full permissions to ServerApplication.
INFO    2003-02-17 17:53:32.662 [Phoenix.] (): Verifying that the name
specified for Blocks and BlockListeners are valid.
INFO    2003-02-17 17:53:32.664 [Phoenix.] (): Verifying that the name
specified for Blocks and BlockListeners are unique.
INFO    2003-02-17 17:53:32.665 [Phoenix.] (): Verifying that the
specified Dependencies are valid according to BlockInfo.
INFO    2003-02-17 17:53:32.666 [Phoenix.] (): Verifying that the
dependencies of Blocks are valid with respect to other Blocks.
INFO    2003-02-17 17:53:32.668 [Phoenix.] (): Verifying that there are
no circular dependencies between Blocks.
INFO    2003-02-17 17:53:32.678 [Phoenix.] (): Verifying that the
specified Blocks have valid types.
INFO    2003-02-17 17:53:32.863 [Phoenix.] (): Verifying that the
specified BlockListeners have valid types.
INFO    2003-02-17 17:53:33.637 [Phoenix.] (): 17 Blocks to process for
phase "startup". Order of processing = [dnsserver, objectstorage,
database-connections, mailstore, users-store, thread-manager,
connections, sockets, scheduler, James, spoolmanager, remotemanager,
pop3server, smtpserver, nntp-repository, nntpserver, fetchpop].
INFO    2003-02-17 18:31:56.974 [Phoenix.] (): 17 Blocks to process for
phase "shutdown". Order of processing = [spoolmanager, remotemanager,
pop3server, smtpserver, fetchpop, James, dnsserver, nntpserver,
nntp-repository, mailstore, users-store, objectstorage, connections,
sockets, scheduler, database-connections, thread-manager].
WARN    2003-02-17 18:31:59.217 [Phoenix.] (): Error deleting Work
Directory
"/home/public/Downloads/James/james-2.1/work/james-1045526007711".
(Reason: Directory
/home/public/Downloads/James/james-2.1/work/james-1045526007711/SAR-INF/lib unable to be deleted.)
java.io.IOException: Directory
/home/public/Downloads/James/james-2.1/work/james-1045526007711/SAR-INF/lib unable to be deleted.
	at
org.apache.avalon.excalibur.io.FileUtil.deleteDirectory(FileUtil.java:767)
	at
org.apache.avalon.excalibur.io.FileUtil.forceDelete(FileUtil.java:630)
	at
org.apache.avalon.excalibur.io.FileUtil.cleanDirectory(FileUtil.java:806)
	at
org.apache.avalon.excalibur.io.FileUtil.deleteDirectory(FileUtil.java:762)
	at
org.apache.avalon.excalibur.io.FileUtil.forceDelete(FileUtil.java:630)
	at
org.apache.avalon.excalibur.io.FileUtil.cleanDirectory(FileUtil.java:806)
	at
org.apache.avalon.excalibur.io.FileUtil.deleteDirectory(FileUtil.java:762)
INFO    2003-02-17 18:31:59.530 [Phoenix ] (): Shutting down because
there are not any applications running.

Thanks,
Disha

On Mon, 2003-02-17 at 18:46, Noel J. Bergman wrote:
> > I am running into this wierd problem where james seems
> > to ignore any reference to foreign classes in the mailet.
> 
> Where are you putting the jar containing these extra classes?
> 
> > Nor does it throw any error or exception, it just gets stuck at the
> > method call and does not complain.
> 
> Did you check phoenix's logs?  Unfortunately, there is code in various parts
> of Avalon that discards exceptions, but I wouldn't expect it to discard that
> one.
> 
> 	--- Noel
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-user-help@jakarta.apache.org
-- 
Disha <di...@openskysoftware.com>


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


RE: gets stuck in foreign class methods while in the custom mailet

Posted by "Noel J. Bergman" <no...@devtech.com>.
> I am running into this wierd problem where james seems
> to ignore any reference to foreign classes in the mailet.

Where are you putting the jar containing these extra classes?

> Nor does it throw any error or exception, it just gets stuck at the
> method call and does not complain.

Did you check phoenix's logs?  Unfortunately, there is code in various parts
of Avalon that discards exceptions, but I wouldn't expect it to discard that
one.

	--- Noel


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