Benoit,
Below is the method that generated the error. This code is in:
org.apache.james.queue.jms.JMSMailQueue.deQueue(JMSMailQueue.java:171)
Looking at this code, it seems that if message is null, it will always generate
an error because the while(true){} loop will never exit otherwise. For your
debugging purposes, the message consumer is expecting a message and does not
receive it within the timeout value, so it generates an error. I do not know
why the message never comes through, but that’s where you should look for the
problem.
HTH
Robert
public MailQueueItem deQueue() throws MailQueueException {
Connection connection = null;
Session session = null;
Message message;
MessageConsumer consumer = null;
while (true) {
try {
connection = connectionFactory.createConnection();
connection.start();
session = connection.createSession(true,
Session.SESSION_TRANSACTED);
Queue queue = session.createQueue(queueName);
consumer = session.createConsumer(queue, getMessageSelector());
message = consumer.receive(10000);
if (message != null) {
return createMailQueueItem(connection, session, consumer,
message);
} else {
session.commit();
if (consumer != null) {
try {
consumer.close();
} catch (JMSException e1) {
// ignore on rollback
}
}
try {
if (session != null)
session.close();
} catch (JMSException e1) {
// ignore here
}
try {
if (connection != null)
connection.close();
} catch (JMSException e1) {
// ignore here
}
}
} catch (Exception e) {
if (session != null) {
try {
session.rollback();
} catch (JMSException e1) {
// ignore on rollback
}
}
if (consumer != null) {
try {
consumer.close();
} catch (JMSException e1) {
// ignore on rollback
}
}
try {
if (session != null)
session.close();
} catch (JMSException e1) {
// ignore here
}
try {
if (connection != null)
connection.close();
} catch (JMSException e1) {
// ignore here
}
throw new MailQueueException("Unable to dequeue next message",
e);
}
}
}
On Jan 12, 2015, at 9:37 AM, Benoit Tellier <[email protected]> wrote:
> Yes, I have well placed my jar in the conf/lib directory of my working
> james directory.
>
> I tested it again today and I still get the exact same behaviour...
>
> Thanks for the reply,
>
> Benoit
>
> On 01/12/15 14:04, Markus Moldaschl wrote:
>> Did you put the jar with your custom matcher in the proper directory?? e.g.
>> with 3.0.0-beta3 you have to put it in [JAMES_HOME]/conf/lib
>>
>> kr
>> Markus
>>
>>
>>
>>> Am 09.01.2015 um 15:10 schrieb Benoit Tellier <[email protected]>:
>>>
>>> Hi,
>>>
>>> I am trying to deploy a custom mailet and a custom matcher on my running
>>> James server.
>>>
>>> When adding my mailet or my matcher in the mailetcontainer.xml file, I
>>> have a strange error ( repeted thousand of times ). I added the
>>> stacktrace as an attachement for readability.
>>>
>>> Here is how my code looks like :
>>>
>>> package com.linagora.openpaas.mailet;
>>>
>>> public class PostMailOnESN extends GenericMailet {
>>>
>>> public void init() throws MessagingException {
>>> // ...
>>> }
>>>
>>> public void service(Mail mail) throws MessagingException {
>>> // ...
>>> }
>>>
>>> public void destroy() {
>>> // ...
>>> }
>>> }
>>>
>>> I added the generated jar in conf/lib directory.
>>>
>>> Here is the section of mailetcontainer.xml file involving this mailet :
>>>
>>> <mailet
>>> match="com.linagora.openpaas.matcher.ESNPostmasterMailMatcher=http://127.0.0.1:8080/api/messages/email/check%esn.james.minet.net"
>>> class="com.linagora.openpaas.mailet.PostMailOnESN">
>>> <esnip>127.0.0.1</esnip>
>>> <port>8080</port>
>>> <api>api/james/mail</api>
>>> </mailet>
>>>
>>> Note that it works fine if I replace this mailet by :
>>>
>>> <mailet match="All" class="Null"/>
>>>
>>> And That I get the same kind of stacktraces using the following non
>>> existing mailet and matcher :
>>>
>>> <mailet match="Al" class="Null"/>
>>>
>>> Or :
>>>
>>> <mailet match="All" class="Nul"/>
>>>
>>> Oh and I am running james 3.0.0-beta5, on openjdk-7-jre ( I have the
>>> same problem using openjdk-6-jre )
>>>
>>> My question is :
>>> - have I made something wrong ? ( I have the impression
>>> - have someone deployed a custom mailet successfully on James
>>> 3.0.0-beta5 ? Does you have any tips ?
>>>
>>> Thank you by advance,
>>>
>>> Benoit
>>>
>>>
>>> <stacktrace.txt>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>