Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CDI EJB Field producers' validation fail with incompatible types #668

Closed
pdudits opened this issue Feb 19, 2016 · 10 comments
Closed

CDI EJB Field producers' validation fail with incompatible types #668

pdudits opened this issue Feb 19, 2016 · 10 comments
Assignees
Labels
Type: Bug Label issue as a bug defect

Comments

@pdudits
Copy link
Contributor

pdudits commented Feb 19, 2016

I'm deploying an EAR, within which there is a war with producer:

public class ServiceProducer {
    @EJB(lookup = "java:/app/ejb-module/EjbInterfaceImpl")
    @Produces
    @AlternativeStereotype // stereotype enabled in beans.xml
    EjbInterface contractService;
}

Deployment fails with

[2016-02-19 17:14:17,673] [admin-listener(1)] [ERROR] [javax.enterprise.system.core]: Exception while loading the app : CDI definition failure:The type of the injection point fieldName is EjbInterface.  The type of the physical resource is com.pletely.DifferentEjb They are incompatible. 
javax.enterprise.inject.spi.DefinitionException: The type of the injection point fieldName is EjbInterface.  The type of the physical resource is com.pletely.DifferentEjb They are incompatible. 
    at org.glassfish.weld.services.InjectionServicesImpl.throwProducerDefinitionExeption(InjectionServicesImpl.java:319) ~[weld-integration.jar:na]
    at org.glassfish.weld.services.InjectionServicesImpl.validateResourceClass(InjectionServicesImpl.java:310) ~[weld-integration.jar:na]
    at org.glassfish.weld.services.InjectionServicesImpl.validateEjbProducer(InjectionServicesImpl.java:234) ~[weld-integration.jar:na]
    at org.glassfish.weld.services.InjectionServicesImpl.registerInjectionTarget(InjectionServicesImpl.java:197) ~[weld-integration.jar:na]
    at org.jboss.weld.manager.InjectionTargetFactoryImpl.postProcess(InjectionTargetFactoryImpl.java:156) ~[weld-osgi-bundle.jar:2015-09-08 14:57]
    at org.jboss.weld.manager.InjectionTargetFactoryImpl.createInjectionTarget(InjectionTargetFactoryImpl.java:93) ~[weld-osgi-bundle.jar:2015-09-08 14:57]
    at org.jboss.weld.bean.ManagedBean.<init>(ManagedBean.java:100) ~[weld-osgi-bundle.jar:2015-09-08 14:57]
    at org.jboss.weld.bean.ManagedBean.of(ManagedBean.java:80) ~[weld-osgi-bundle.jar:2015-09-08 14:57]
    at org.jboss.weld.bootstrap.AbstractBeanDeployer.createManagedBean(AbstractBeanDeployer.java:264) ~[weld-osgi-bundle.jar:2015-09-08 14:57]
    at org.jboss.weld.bootstrap.BeanDeployer.createClassBean(BeanDeployer.java:228) ~[weld-osgi-bundle.jar:2015-09-08 14:57]
    at org.jboss.weld.bootstrap.BeanDeployer.createClassBeans(BeanDeployer.java:191) ~[weld-osgi-bundle.jar:2015-09-08 14:57]
    at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:256) ~[weld-osgi-bundle.jar:2015-09-08 14:57]
    at org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:394) ~[weld-osgi-bundle.jar:2015-09-08 14:57]
    at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:83) ~[weld-osgi-bundle.jar:2015-09-08 14:57]
    at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:222) ~[weld-integration.jar:na]
    at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131) ~[kernel.jar:na]
    at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:329) ~[internal-api.jar:na]
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:496) ~[kernel.jar:na]
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219) ~[kernel.jar:na]

When debugging, at validateEjbProducer(InjectionServicesImpl.java:234) all elements of ejbs Collection have null jndiName. Therefore oneEjb.getJndiName() returns empty string and that matches any lookupName, so first ejb in the list is elected as a match.

@smillidge smillidge added try to reproduce PR: TESTS REQUIRED PR Requires Tests to be merged labels Feb 19, 2016
@pdudits
Copy link
Contributor Author

pdudits commented Feb 22, 2016

The workaround is to use producer method, which are not validated at runtime.

It also could be related to #391 - I've seen more places where things fail in case of previously failed deployment. But restarting the server was so far much quicker solution than finding why Descriptor Bundles from different managers differ.

@pdudits
Copy link
Contributor Author

pdudits commented May 26, 2016

I've hit this issue again, this time my test was deploying a simple .war that imports an external EJB. So neither EAR packaging or stereotype are relevant for the issue. I'll try to spend a little time creating a sample WAR file.

@mikecroft
Copy link
Contributor

thanks @pdudits - do you still think this is related to #391? I've had a quick look at reproducing and couldn't, so a sample would be very useful

@pdudits
Copy link
Contributor Author

pdudits commented Jun 10, 2016

On second occasion I haven't had a previously failed deployment so #391 is likely not related.

I managed to create a test case, I'll push it to GitHub after the weekend.

@pdudits
Copy link
Contributor Author

pdudits commented Jun 14, 2016

The test case is available here: https://github.com/pdudits/payara-testcases/tree/master/issue-668

First deploy ejb-module, deployment of web-module will fail, at least on JDK8.

@mikecroft
Copy link
Contributor

Excellent, thanks very much!

@mikecroft mikecroft self-assigned this Jun 14, 2016
@lprimak
Copy link
Contributor

lprimak commented Jun 14, 2016

Could this be related to #315 ? It's been recently fixed.

@pdudits
Copy link
Contributor Author

pdudits commented Jun 14, 2016

The testcase fails immediately at first deployment, so it's not related to dirty application bundle.

@mikecroft
Copy link
Contributor

Verified and created internal issue PAYARA-947

@mikecroft mikecroft added Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev and removed 1:Investigating labels Jul 31, 2016
@lprimak lprimak self-assigned this Aug 7, 2016
@lprimak lprimak added upstream bug Type: Bug Label issue as a bug defect and removed Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev PR: TESTS REQUIRED PR Requires Tests to be merged try to reproduce labels Aug 7, 2016
lprimak added a commit to flowlogix/Payara that referenced this issue Aug 12, 2016
…EJB, not the correct one

fixes PAYARA-947 and github issue payara#668
@lprimak
Copy link
Contributor

lprimak commented Aug 12, 2016

Fixed by PR #1017

@lprimak lprimak closed this as completed Aug 12, 2016
lprimak added a commit to flowlogix/Payara that referenced this issue Aug 14, 2016
…EJB, not the correct one fixes PAYARA-947 and github issue payara#668
smillidge pushed a commit that referenced this issue Aug 17, 2016
…EJB, not the correct one (#1017)

fixes PAYARA-947 and github issue #668
@OndroMih OndroMih added this to the Payara 4.1.1.164 milestone Nov 21, 2016
lprimak added a commit to flowlogix/Payara that referenced this issue Jul 5, 2017
…EJB, not the correct one (payara#1017)

fixes PAYARA-947 and github issue payara#668
arieki pushed a commit to arieki/Payara that referenced this issue Nov 21, 2022
FISH-6603 : META-INF must not be always denied
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Label issue as a bug defect
Projects
None yet
Development

No branches or pull requests

5 participants