Bug 1283962

Summary: Unable to use CDI extension in Tomcat
Product: [JBoss] JBoss Data Grid 6 Reporter: Martin Gencur <mgencur>
Component: InfinispanAssignee: Tristan Tarrant <ttarrant>
Status: VERIFIED --- QA Contact: Martin Gencur <mgencur>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.6.0CC: jdg-bugs, vjuranek
Target Milestone: ER3   
Target Release: 6.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Detailed test output none

Description Martin Gencur 2015-11-20 12:10:00 UTC
Created attachment 1097139 [details]
Detailed test output

Deploying an application to Tomcat7/8 after the CDI package split fails. The following errors can be seen in the log.

1) 
SEVERE: Exception sending context initialized event to listener instance of class org.jboss.weld.environment.servlet.Listener
org.jboss.weld.exceptions.DeploymentException: com/sun/jdi/request/EventRequest
...
Caused by: java.lang.ClassNotFoundException: com.sun.jdi.request.EventRequest

2) 
SEVERE: Exception sending context destroyed event to listener instance of class org.jboss.weld.environment.servlet.Listener
java.lang.NullPointerException
	at org.jboss.weld.servlet.WeldInitialListener.contextDestroyed(WeldInitialListener.java:102)
	at org.jboss.weld.servlet.api.helpers.ForwardingServletListener.contextDestroyed(ForwardingServletListener.java:30)
	at org.jboss.weld.environment.servlet.Listener.contextDestroyed(Listener.java:85)

3) 
SEVERE: Exception sending context initialized event to listener instance of class org.jboss.weld.environment.servlet.Listener
org.jboss.weld.exceptions.DeploymentException: javax/persistence/EntityNotFoundException

4)
There are also a number of log errors similar to this one:
INFO: WELD-000119: Not generating any bean definitions from infinispan.org.jboss.logging.Log4jLogger because of underlying class loading error: Type org.apache.log4j.Priority not found.  If this is unexpected, enable DEBUG logging to see the full error.


Detailed test output can be found in the attached log.

Comment 2 Sebastian Łaskawiec 2015-11-23 12:52:24 UTC
Unfortunately we are a bit constrained here since it is very likely that if we fix Tomcat error, we will cause some EAP error and vice versa. 

Addressing those comments in order:
Ad1. com.sun.jdi.request.EventRequest errors

As you mentioned we have no JDK dependency from Tomcat Classloader. Also, this class seems to be shipped as a part of Protostream and it's JavaAssist integration. Since I'm not sure what's the impact - I would recommend leaving this for now (in DR phase I would remove it without hesitation). 

Ad2. org.jboss.weld.environment.servlet.Listener while redeploying

It seems this is a Weld error. For some reason WeldInitialListener.lifecycle is null when calling WeldInitialListener#contextDestroyed. That one should probably go to Weld upstream.

Ad3. javax/persistence/EntityNotFoundException errors

I can't reproduce this one. Maybe it's related to your test?

Ad4. org.jboss.logging.Log4jLogger errors

This one will probably need to stay. If I include log4j jar - I would need to pull a lot of dependencies which are not needed. If I remove it - JBoss logging - Log4J integration will not work...

The easiest fix might be applied by the user. He might add Log4J jar to his application or provide SLF4J-Log4J bridge. In JDG7 we will have a better approach since newer Log4J is split into api and implementation.

Comment 3 Sebastian Łaskawiec 2015-11-23 13:58:35 UTC
JPA related errors will probably need JPA provider on classpath.

Comment 5 Vojtech Juranek 2015-12-03 16:21:47 UTC
Works on Tomcat, also tested on EAP, that it's not broken there.