Problem with MessageConsumers under TomEE 8.0.0

2019-09-27 Thread Ihsan Ecemis

Hello Everyone,

We recently upgraded our staging environment from TomEE 8.0.0-M3 to 8.0.0 and 
things started to break.  

After some troubleshooting, we realized that we cannot dequeue JMS messages 
from our ActiveMQ server using MessageConsumers.


We dequeue messages in 2 different ways:  We use MessageDriven beans for most 
of our queues.  But with some others, we periodically poll by creating a 
MessageConsumer (please see the code below for that second case)

MessageDriven beans work without any problems but we cannot receive any 
messages via MessageConsumers.  That same backend code is working fine with 
8.0.0-M3.


We tested this with different versions of ActiveMQ server (5.15.6, 5.15.9, 
5.15.10) but TomEE  8.0.0 did not work with any of them.


Below is redacted code snippets showing where we have the problem.

Any help will be greatly appreciated.   Please let me know if you have any 
questions about our setup.  

Thanks,

Ihsan.



@Stateless
public class LogService {

@EJB
private CustomJmsService customJmsService;

@javax.ejb.Schedule(second = "*/30", minute = "*", hour = "*")
public void pollLogQueue() throws Exception {
final TextMessage logMessage = customJmsService.receiveLogMessage(1000);
if (logMessage != null) {
persistLogMessages(logMessages);
}
}
}

@Stateless
public class CustomJmsService {

@Resource(name = "logQueue")
private Queue logQueue;

public void sendLogMessage(final LogMessage message) {
sendMessage(logQueue, message);
}

private void sendMessage(final Queue queue, final CustomJmsMessage message) 
{
try (final Connection connection = 
connectionFactory.createConnection()) {
connection.start();

final Session session = connection.createSession(true, 
Session.AUTO_ACKNOWLEDGE);
final MessageProducer producer = session.createProducer(queue);
final String serializedMessage = CustomJsonProvider.toJson(message);
final Message jmsMessage = 
session.createTextMessage(serializedMessage);

// This enqueues messages successfully with both 8.0.0-M3 and 8.0.0
producer.send(jmsMessage);
} catch (final Exception e) {
throw new RuntimeException("Caught exception from JMS when sending 
a message", e);
}
}

public TextMessage receiveLogMessage(final long receiveTimeoutMillis) {
return receiveMessage(logQueue, receiveTimeoutMillis);
}

private TextMessage receiveMessage(final Queue queue, final long 
receiveTimeoutMillis) {
try (final Connection connection = 
connectionFactory.createConnection()) {
connection.start();

final Session session = connection.createSession(true, 
Session.AUTO_ACKNOWLEDGE);
final MessageConsumer messageConsumer = 
session.createConsumer(queue);
final Message jmsMessage = 
messageConsumer.receive(receiveTimeoutMillis);

// PROBLEM: jmsMessage is always null with 8.0.0. This was working 
with 8.0.0-M3
if (jmsMessage == null) {
return null;
}

return (TextMessage) jmsMessage;
} catch (final Exception e) {
throw new RuntimeException("Caught exception from JMS when 
receiving a message", e);
}
}
}




Re: Does TomEE 8.0.0 run on Java 11?

2019-09-27 Thread Jonathan Gallimore
Thanks for the feedback - I'll take a look at that and get back to you.

Jon

On Fri, Sep 27, 2019 at 5:23 PM Paul Carter-Brown
 wrote:

> Hi Jon,
>
> I've tried with 8.0.1-SNAPSHOT and get an error:
>
> INFO: Configuring enterprise application:
>
> /home/paul/Source/jg-services/template-service/service/target/apache-tomee/webapps/jg-services-servicename-service
> Sep 27, 2019 3:58:30 PM org.apache.openejb.config.ReadDescriptors deploy
> SEVERE: Unable to load Persistence Unit from EAR:
>
> /home/paul/Source/jg-services/template-service/service/target/apache-tomee/webapps/jg-services-servicename-service,
> module:
>
> file:/home/paul/Source/jg-services/template-service/service/target/apache-tomee/webapps/jg-services-servicename-service/.
> Exception: class "javax.persistence.package-info"'s signer information does
> not match signer information of other classes in the same package
> java.lang.SecurityException: class "javax.persistence.package-info"'s
> signer information does not match signer information of other classes in
> the same package
> at java.base/java.lang.ClassLoader.checkCerts(ClassLoader.java:1150)
> at java.base/java.lang.ClassLoader.preDefineClass(ClassLoader.java:905)
> at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1014)
> at
>
> java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
> at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:550)
> ...
>
> I've checked and think the conflict could be due
> to jakarta.persistence-2.2.2.jar and eclipselink-2.7.4.jar both having the
> javax.persistence and jakarta.persistence-2.2.2.jar is signed
>
> Paul
>
>
> On Fri, Sep 27, 2019 at 11:26 AM Jonathan Gallimore <
> jonathan.gallim...@gmail.com> wrote:
>
> > Hi Paul
> >
> > Using 8.0.1-SNAPSHOT should work already - let me know if it doesn't.
> There
> > another pending fix for the standalone server - I was planning to
> propose a
> > release once that's in.
> >
> > Jon
> >
> > On Fri, Sep 27, 2019 at 10:19 AM Paul Carter-Brown
> >  wrote:
> >
> > > Hi Jon,
> > >
> > > Any chance 2.7.4 can be pushed into an official TomEE build so that we
> > can
> > > use the tomee maven plugin and get this fix. Right now we can manually
> > > upgrade for a normal deployment but our integration tests that use the
> > > tomee maven plugin use 2.7.3.
> > >
> > > Paul
> > >
> > >
> > > On Wed, Sep 25, 2019 at 10:31 PM Paul Carter-Brown
> > >  wrote:
> > >
> > > > Thanks Jon
> > > >
> > > > Worked a charm.
> > > >
> > > > Paul
> > > >
> > > >
> > > > On Wed, Sep 25, 2019 at 9:17 PM Jonathan Gallimore <
> > > > jonathan.gallim...@gmail.com> wrote:
> > > >
> > > >> Looks like the update to EclipseLink 2.7.4 I committed this morning
> > > fixes
> > > >> it. Could you try swapping out the EclipseLink jar in your Plume
> > > >> distribution lib directory for 2.7.4 and let us know how you get on?
> > > >>
> > > >>
> > > >>
> > >
> >
> https://repo1.maven.org/maven2/org/eclipse/persistence/eclipselink/2.7.4/eclipselink-2.7.4.jar
> > > >>
> > > >> Thanks
> > > >>
> > > >> Jon
> > > >>
> > > >> On Wed, Sep 25, 2019 at 4:57 PM Paul Carter-Brown
> > > >>  wrote:
> > > >>
> > > >> > Hi Jonathan,
> > > >> >
> > > >> > Seems like it's related to using PLUME (Eclipselink) where a
> > > >> > persistence.xml is present.
> > > >> >
> > > >> > Logs are as attached along with a simple war that fails. If I
> > comment
> > > >> out
> > > >> > the contents of my persistence.xml file then it boots fine (but
> > > >> > EntityManagers are all null).
> > > >> >
> > > >> > If I include persistence.xml and even comment out my EntityManager
> > > >> > injection points then it fails.
> > > >> >
> > > >> > Should if you need more info.
> > > >> >
> > > >> > Paul
> > > >> >
> > > >> >
> > > >> > On Wed, Sep 25, 2019 at 12:29 PM Jonathan Gallimore <
> > > >> > jonathan.gallim...@gmail.com> wrote:
> > > >> >
> > > >> >> The short answer is yes - TomEE 8.0.0 should work fine on Java
> 11.
> > We
> > > >> >> definitely want to know about your issue and dig into it.
> > > >> >>
> > > >> >> Can you provide your boot output? I did just double check with a
> > > >> vanilla
> > > >> >> TomEE 8.0.0 Plus and OpenJDK 11 from AdoptOpenJDK on my Mac here
> -
> > > its
> > > >> >> booted fine. Output is here:
> > > >> >>
> > https://gist.github.com/jgallimore/27997af50014229b702cf8b5710563ec
> > > >> >>
> > > >> >> I have actually successfully booted TomEE 8 on a self-built JDK
> 13
> > as
> > > >> >> well.
> > > >> >> I wouldn't expect it to work with apps whose classes are compiled
> > > with
> > > >> >> Java
> > > >> >> 13 as a target as I suspect that will need an ASM update, but it
> > did
> > > >> boot
> > > >> >> and run an application.
> > > >> >>
> > > >> >> Jon
> > > >> >>
> > > >> >> On Tue, Sep 24, 2019 at 9:44 PM Paul Carter-Brown
> > > >> >>  wrote:
> > > >> >>
> > > >> >> > Hi,
> > > >> >> >
> > > >> >> > Does tomEE 8.0.0 support OpenJDK 11? I've tried and get errors
> > upon
> > > >> >> 

Re: Does TomEE 8.0.0 run on Java 11?

2019-09-27 Thread Paul Carter-Brown
Hi Jon,

I've tried with 8.0.1-SNAPSHOT and get an error:

INFO: Configuring enterprise application:
/home/paul/Source/jg-services/template-service/service/target/apache-tomee/webapps/jg-services-servicename-service
Sep 27, 2019 3:58:30 PM org.apache.openejb.config.ReadDescriptors deploy
SEVERE: Unable to load Persistence Unit from EAR:
/home/paul/Source/jg-services/template-service/service/target/apache-tomee/webapps/jg-services-servicename-service,
module:
file:/home/paul/Source/jg-services/template-service/service/target/apache-tomee/webapps/jg-services-servicename-service/.
Exception: class "javax.persistence.package-info"'s signer information does
not match signer information of other classes in the same package
java.lang.SecurityException: class "javax.persistence.package-info"'s
signer information does not match signer information of other classes in
the same package
at java.base/java.lang.ClassLoader.checkCerts(ClassLoader.java:1150)
at java.base/java.lang.ClassLoader.preDefineClass(ClassLoader.java:905)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1014)
at
java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:550)
...

I've checked and think the conflict could be due
to jakarta.persistence-2.2.2.jar and eclipselink-2.7.4.jar both having the
javax.persistence and jakarta.persistence-2.2.2.jar is signed

Paul


On Fri, Sep 27, 2019 at 11:26 AM Jonathan Gallimore <
jonathan.gallim...@gmail.com> wrote:

> Hi Paul
>
> Using 8.0.1-SNAPSHOT should work already - let me know if it doesn't. There
> another pending fix for the standalone server - I was planning to propose a
> release once that's in.
>
> Jon
>
> On Fri, Sep 27, 2019 at 10:19 AM Paul Carter-Brown
>  wrote:
>
> > Hi Jon,
> >
> > Any chance 2.7.4 can be pushed into an official TomEE build so that we
> can
> > use the tomee maven plugin and get this fix. Right now we can manually
> > upgrade for a normal deployment but our integration tests that use the
> > tomee maven plugin use 2.7.3.
> >
> > Paul
> >
> >
> > On Wed, Sep 25, 2019 at 10:31 PM Paul Carter-Brown
> >  wrote:
> >
> > > Thanks Jon
> > >
> > > Worked a charm.
> > >
> > > Paul
> > >
> > >
> > > On Wed, Sep 25, 2019 at 9:17 PM Jonathan Gallimore <
> > > jonathan.gallim...@gmail.com> wrote:
> > >
> > >> Looks like the update to EclipseLink 2.7.4 I committed this morning
> > fixes
> > >> it. Could you try swapping out the EclipseLink jar in your Plume
> > >> distribution lib directory for 2.7.4 and let us know how you get on?
> > >>
> > >>
> > >>
> >
> https://repo1.maven.org/maven2/org/eclipse/persistence/eclipselink/2.7.4/eclipselink-2.7.4.jar
> > >>
> > >> Thanks
> > >>
> > >> Jon
> > >>
> > >> On Wed, Sep 25, 2019 at 4:57 PM Paul Carter-Brown
> > >>  wrote:
> > >>
> > >> > Hi Jonathan,
> > >> >
> > >> > Seems like it's related to using PLUME (Eclipselink) where a
> > >> > persistence.xml is present.
> > >> >
> > >> > Logs are as attached along with a simple war that fails. If I
> comment
> > >> out
> > >> > the contents of my persistence.xml file then it boots fine (but
> > >> > EntityManagers are all null).
> > >> >
> > >> > If I include persistence.xml and even comment out my EntityManager
> > >> > injection points then it fails.
> > >> >
> > >> > Should if you need more info.
> > >> >
> > >> > Paul
> > >> >
> > >> >
> > >> > On Wed, Sep 25, 2019 at 12:29 PM Jonathan Gallimore <
> > >> > jonathan.gallim...@gmail.com> wrote:
> > >> >
> > >> >> The short answer is yes - TomEE 8.0.0 should work fine on Java 11.
> We
> > >> >> definitely want to know about your issue and dig into it.
> > >> >>
> > >> >> Can you provide your boot output? I did just double check with a
> > >> vanilla
> > >> >> TomEE 8.0.0 Plus and OpenJDK 11 from AdoptOpenJDK on my Mac here -
> > its
> > >> >> booted fine. Output is here:
> > >> >>
> https://gist.github.com/jgallimore/27997af50014229b702cf8b5710563ec
> > >> >>
> > >> >> I have actually successfully booted TomEE 8 on a self-built JDK 13
> as
> > >> >> well.
> > >> >> I wouldn't expect it to work with apps whose classes are compiled
> > with
> > >> >> Java
> > >> >> 13 as a target as I suspect that will need an ASM update, but it
> did
> > >> boot
> > >> >> and run an application.
> > >> >>
> > >> >> Jon
> > >> >>
> > >> >> On Tue, Sep 24, 2019 at 9:44 PM Paul Carter-Brown
> > >> >>  wrote:
> > >> >>
> > >> >> > Hi,
> > >> >> >
> > >> >> > Does tomEE 8.0.0 support OpenJDK 11? I've tried and get errors
> upon
> > >> >> boot.
> > >> >> > Will elaborate if it is supposed to support java 11.
> > >> >> >
> > >> >> > Paul
> > >> >> >
> > >> >>
> > >> >
> > >>
> > >
> >
>


Re: Does TomEE 8.0.0 run on Java 11?

2019-09-27 Thread Jonathan Gallimore
Hi Paul

Using 8.0.1-SNAPSHOT should work already - let me know if it doesn't. There
another pending fix for the standalone server - I was planning to propose a
release once that's in.

Jon

On Fri, Sep 27, 2019 at 10:19 AM Paul Carter-Brown
 wrote:

> Hi Jon,
>
> Any chance 2.7.4 can be pushed into an official TomEE build so that we can
> use the tomee maven plugin and get this fix. Right now we can manually
> upgrade for a normal deployment but our integration tests that use the
> tomee maven plugin use 2.7.3.
>
> Paul
>
>
> On Wed, Sep 25, 2019 at 10:31 PM Paul Carter-Brown
>  wrote:
>
> > Thanks Jon
> >
> > Worked a charm.
> >
> > Paul
> >
> >
> > On Wed, Sep 25, 2019 at 9:17 PM Jonathan Gallimore <
> > jonathan.gallim...@gmail.com> wrote:
> >
> >> Looks like the update to EclipseLink 2.7.4 I committed this morning
> fixes
> >> it. Could you try swapping out the EclipseLink jar in your Plume
> >> distribution lib directory for 2.7.4 and let us know how you get on?
> >>
> >>
> >>
> https://repo1.maven.org/maven2/org/eclipse/persistence/eclipselink/2.7.4/eclipselink-2.7.4.jar
> >>
> >> Thanks
> >>
> >> Jon
> >>
> >> On Wed, Sep 25, 2019 at 4:57 PM Paul Carter-Brown
> >>  wrote:
> >>
> >> > Hi Jonathan,
> >> >
> >> > Seems like it's related to using PLUME (Eclipselink) where a
> >> > persistence.xml is present.
> >> >
> >> > Logs are as attached along with a simple war that fails. If I comment
> >> out
> >> > the contents of my persistence.xml file then it boots fine (but
> >> > EntityManagers are all null).
> >> >
> >> > If I include persistence.xml and even comment out my EntityManager
> >> > injection points then it fails.
> >> >
> >> > Should if you need more info.
> >> >
> >> > Paul
> >> >
> >> >
> >> > On Wed, Sep 25, 2019 at 12:29 PM Jonathan Gallimore <
> >> > jonathan.gallim...@gmail.com> wrote:
> >> >
> >> >> The short answer is yes - TomEE 8.0.0 should work fine on Java 11. We
> >> >> definitely want to know about your issue and dig into it.
> >> >>
> >> >> Can you provide your boot output? I did just double check with a
> >> vanilla
> >> >> TomEE 8.0.0 Plus and OpenJDK 11 from AdoptOpenJDK on my Mac here -
> its
> >> >> booted fine. Output is here:
> >> >> https://gist.github.com/jgallimore/27997af50014229b702cf8b5710563ec
> >> >>
> >> >> I have actually successfully booted TomEE 8 on a self-built JDK 13 as
> >> >> well.
> >> >> I wouldn't expect it to work with apps whose classes are compiled
> with
> >> >> Java
> >> >> 13 as a target as I suspect that will need an ASM update, but it did
> >> boot
> >> >> and run an application.
> >> >>
> >> >> Jon
> >> >>
> >> >> On Tue, Sep 24, 2019 at 9:44 PM Paul Carter-Brown
> >> >>  wrote:
> >> >>
> >> >> > Hi,
> >> >> >
> >> >> > Does tomEE 8.0.0 support OpenJDK 11? I've tried and get errors upon
> >> >> boot.
> >> >> > Will elaborate if it is supposed to support java 11.
> >> >> >
> >> >> > Paul
> >> >> >
> >> >>
> >> >
> >>
> >
>


Re: Does TomEE 8.0.0 run on Java 11?

2019-09-27 Thread Paul Carter-Brown
Hi Jon,

Any chance 2.7.4 can be pushed into an official TomEE build so that we can
use the tomee maven plugin and get this fix. Right now we can manually
upgrade for a normal deployment but our integration tests that use the
tomee maven plugin use 2.7.3.

Paul


On Wed, Sep 25, 2019 at 10:31 PM Paul Carter-Brown
 wrote:

> Thanks Jon
>
> Worked a charm.
>
> Paul
>
>
> On Wed, Sep 25, 2019 at 9:17 PM Jonathan Gallimore <
> jonathan.gallim...@gmail.com> wrote:
>
>> Looks like the update to EclipseLink 2.7.4 I committed this morning fixes
>> it. Could you try swapping out the EclipseLink jar in your Plume
>> distribution lib directory for 2.7.4 and let us know how you get on?
>>
>>
>> https://repo1.maven.org/maven2/org/eclipse/persistence/eclipselink/2.7.4/eclipselink-2.7.4.jar
>>
>> Thanks
>>
>> Jon
>>
>> On Wed, Sep 25, 2019 at 4:57 PM Paul Carter-Brown
>>  wrote:
>>
>> > Hi Jonathan,
>> >
>> > Seems like it's related to using PLUME (Eclipselink) where a
>> > persistence.xml is present.
>> >
>> > Logs are as attached along with a simple war that fails. If I comment
>> out
>> > the contents of my persistence.xml file then it boots fine (but
>> > EntityManagers are all null).
>> >
>> > If I include persistence.xml and even comment out my EntityManager
>> > injection points then it fails.
>> >
>> > Should if you need more info.
>> >
>> > Paul
>> >
>> >
>> > On Wed, Sep 25, 2019 at 12:29 PM Jonathan Gallimore <
>> > jonathan.gallim...@gmail.com> wrote:
>> >
>> >> The short answer is yes - TomEE 8.0.0 should work fine on Java 11. We
>> >> definitely want to know about your issue and dig into it.
>> >>
>> >> Can you provide your boot output? I did just double check with a
>> vanilla
>> >> TomEE 8.0.0 Plus and OpenJDK 11 from AdoptOpenJDK on my Mac here - its
>> >> booted fine. Output is here:
>> >> https://gist.github.com/jgallimore/27997af50014229b702cf8b5710563ec
>> >>
>> >> I have actually successfully booted TomEE 8 on a self-built JDK 13 as
>> >> well.
>> >> I wouldn't expect it to work with apps whose classes are compiled with
>> >> Java
>> >> 13 as a target as I suspect that will need an ASM update, but it did
>> boot
>> >> and run an application.
>> >>
>> >> Jon
>> >>
>> >> On Tue, Sep 24, 2019 at 9:44 PM Paul Carter-Brown
>> >>  wrote:
>> >>
>> >> > Hi,
>> >> >
>> >> > Does tomEE 8.0.0 support OpenJDK 11? I've tried and get errors upon
>> >> boot.
>> >> > Will elaborate if it is supposed to support java 11.
>> >> >
>> >> > Paul
>> >> >
>> >>
>> >
>>
>