james-server-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Charles <e...@apache.org>
Subject Re: Small question about mailets development
Date Thu, 16 Sep 2010 10:31:12 GMT
  Hi Max,
javac needs a list of dependency (external jars) but maven with its 
pom.xml will ease your life.
If you go to a your project (mailets, or your new project with same 
pom.xml), you can compile with "mvn compile".
Tks,
Eric


On 16/09/2010 11:53, Max Levinson wrote:
> Hi guys, thanks for your help.
>
> I am going to ask very newbie questions right now,because I am switching
> from C++ to Java and don't understand some basic concepts,however I am
> reading books and manuals but still need to ask you some questions.
>
> As far as I understand you need to compile your java code with javac
> compiler before you will put it into .jar file,is that right?
>
> After compilation you'll receive a byte code like MyMailet.class and this
> file you need to put into .jar file.
>
> My question is where I need to compile MyMailet.java file to fulfill all
> dependencies, because when I compile it in random place obviously compiler
> gives me loads of errors like:
>
> [root@km-01 james_test]# javac MyMailet.java
> ReleaseSpam.java:8: package org.apache.mailet does not exist
> import org.apache.mailet.Mail;
>                          ^
> ReleaseSpam.java:11: package org.apache.james.util.sql does not exist
> import org.apache.james.util.sql.JDBCUtil;
>                                  ^
> ReleaseSpam.java:23: cannot find symbol
> symbol: class GenericMailet
> public class ReleaseSpam extends GenericMailet {
>                                   ^
> ReleaseSpam.java:26: cannot find symbol
> symbol  : class DataSourceSelector
> location: class org.apache.james.transport.mailets.ReleaseSpam
>      private DataSourceSelector selector;
>              ^
> ReleaseSpam.java:36: cannot find symbol
> symbol  : class DataSourceSelector
> location: class org.apache.james.transport.mailets.ReleaseSpam
>      public void setDataSourceSelector(DataSourceSelector selector) {
>                                        ^
> ReleaseSpam.java:41: cannot find symbol
> symbol  : class JDBCUtil
> location: class org.apache.james.transport.mailets.ReleaseSpam
>      private final JDBCUtil theJDBCUtil =
>                    ^
> ReleaseSpam.java:50: cannot find symbol
> symbol  : class MessagingException
> location: class org.apache.james.transport.mailets.ReleaseSpam
>      public void init() throws MessagingException {
>                                ^
> ReleaseSpam.java:95: cannot find symbol
> symbol  : class Mail
> location: class org.apache.james.transport.mailets.ReleaseSpam
>      public void service(Mail mail) {
>                          ^
> ReleaseSpam.java:35: cannot find symbol
> symbol  : class Resource
> location: class org.apache.james.transport.mailets.ReleaseSpam
>      @Resource(name="database-connections")
>       ^
> ReleaseSpam.java:42: cannot find symbol
> symbol  : class JDBCUtil
> location: class org.apache.james.transport.mailets.ReleaseSpam
>              new JDBCUtil() {
>                  ^
> ReleaseSpam.java:58: cannot find symbol
> symbol  : class MessagingException
> location: class org.apache.james.transport.mailets.ReleaseSpam
>                  throw new MessagingException("Can't get datasource", e);
>                            ^
> ReleaseSpam.java:75: cannot find symbol
> symbol  : class MailetException
> location: class org.apache.james.transport.mailets.ReleaseSpam
>                  throw new MailetException(exceptionBuffer.toString());
>                            ^
> ReleaseSpam.java:87: cannot find symbol
> symbol  : class MessagingException
> location: class org.apache.james.transport.mailets.ReleaseSpam
>              throw new MessagingException("Error initializing ReleaseSpam",
> e);
>                        ^
> 13 errors
>
>
>
> 2010/9/16 Ranjib Dey<ranjibd@thoughtworks.com>
>
>> james 3 is deployed using spring, instead of phoneix , hence you wont get
>> SAR-INF. In james 3 you can deploy your custom mailet  through the
>> setenv.sh(or .bat) by specifying the folder where your jar file is located.
>> This way you only need to build your custom mailet and deploy it as a jar
>> in
>> that folder and restart it. James will automatically pick it up.
>>
>> regards
>> ranjib
>>
>> On Thu, Sep 16, 2010 at 2:30 PM, Nitin Gupta<nitingupta183@gmail.com
>>> wrote:
>>> Yes, I was talking about James 2. However, IMO the approach to write&
>>> deploy custom mailets should not have differed a lot between the two
>>> versions. Developers of version 3 should shed more light into this.
>>>
>>> rgds
>>>
>>> -----Original Message-----
>>> From: Max Levinson [mailto:max.levinson@gmail.com]
>>> Sent: Thursday, September 16, 2010 1:42 AM
>>> To: James Users List
>>> Subject: Re: Small question about mailets development
>>>
>>> Hi Nitin,
>>>
>>> Thanks for a quick answer, I was talking about James version 3 from
>> trunk,
>>> I believe you refer to James 2.
>>>
>>> There is just no /apps directory in James 3 from trunk.
>>>
>>> 2010/9/16 Nitin Gupta<nitingupta183@gmail.com>
>>>
>>>> I do not need your requirement to write a custom mailet in mail james
>>>> project. What you can also do is write your custom mailet using the
>> base
>>>> mailet api&  deploy the compiled jar other dependencies in the
>> following
>>>> directory:
>>>>
>>>> <james-home>/apps/james/SAR-INF/lib directory. (you will need to create
>> a
>>>> lib directory)
>>>>
>>>> With this approach you will just be required to build your mailets jar
>> &
>>>> not
>>>> the whole James project. I hope this helps.
>>>>
>>>> Rgds
>>>> nitin
>>>>
>>>> -----Original Message-----
>>>> From: Max Levinson [mailto:max.levinson@gmail.com]
>>>> Sent: Thursday, September 16, 2010 1:23 AM
>>>> To: James Users List
>>>> Subject: Small question about mailets development
>>>>
>>>> Hi list,
>>>>
>>>> I have a really small question about mailet development.
>>>>
>>>> When I am adding a new mailet to james into
>>>> /mailets/src/main/java/org/apache/james/transport/malets
>>>>
>>>> Should I everytime rebuild the whole james project like mvn -U clean
>>>> package
>>>> -Dmaven.test.skip.exec=true
>>>>
>>>> Because this is what I do every time and it makes a process of
>>> development
>>>> and debugging quite slow.
>>>>
>>>> Sorry for this silly question I am quite new to this :)
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>>
>>>


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


Mime
View raw message