<snip>

I've not tested it, but it should work if you placed spring stuff in the
james/SAR-INF/lib folder.

If you try and it works, please confirm it ;-)

I've already got this working, and it actually works quite well.

What I've got happening so far is as follows:

A project has two maven modules:

1) proj-james
2) proj-db

proj-james depends on proj-db. There are a number of spring
configuration files in proj-db and one separate spring configuration
file in proj-james. When maven builds the project it creates a jar for
proj-db, with all the spring configuration files in the root of this
jar.

proj-james is then built with all the dependency jars added into the
root of the jar as well amongst these dependencies is proj-db.jar. I
was hoping that perhaps I can just put this jar under
james_home/apps/james/SAR-INF/lib and everything would work. However
when deployed my mailets were found but as soon as I tried to access
classes out of proj-db.jar I was getting ClassNotFoundException.

The solution was to put all the jars separately under the lib
directory. Hence under the lib directory I have:

- proj-james-nodep.jar (which contains my mailets and the root of the
jar has a spring configuration XML file)
- proj-db.jar (which is all the database logic and a number of other
spring config XML files)
all other dependency jars.

So all the XML files are packaged within the jar files.

I then use an abstract BaseMailet class (which extends GenericMailet)
and in the init method I load all my spring configuration. In this
class I've also put a number of utility methods to get the beans from
Spring. My Mailets then extend the BaseMailet and access the spring
beans using utility method.

All the loading is done using similar code to that described by Bud.

This works, however what I was hoping to achieve was a system where
upon my mailets being instantiated by James, they would automatically
be injected with the required DAOs, etc.

If I wanted to get something like this working, I take it I would need
to modify James. Where should I be looking!

Thank you!

Gary

<snip>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to