You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by "Rogerio Baldini (Created) (JIRA)" <ji...@apache.org> on 2012/03/21 18:59:41 UTC

[jira] [Created] (OWB-655) CDI doesn´t inject stateless EJB by abstract class.

CDI doesn´t inject stateless EJB by abstract class.
---------------------------------------------------

                 Key: OWB-655
                 URL: https://issues.apache.org/jira/browse/OWB-655
             Project: OpenWebBeans
          Issue Type: Bug
          Components: Enterprise Web Beans
    Affects Versions: 1.1.3
            Reporter: Rogerio Baldini
            Assignee: Gurkan Erdogdu


I have these classes:

public abstract class PlcBaseDAO {}

public abstract class PlcBaseJpaDAO extends PlcBaseDAO  {}

@Stateless
public class AppJpaDAO extends PlcBaseJpaDAO {}

And this injection doesn´t work.

@Named
public class AppCDI {
	@Inject
	private PlcBaseDAO baseDao;
}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (OWB-655) CDI doesn´t inject stateless EJB by abstract class.

Posted by "Rogerio Baldini (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13235012#comment-13235012 ] 

Rogerio Baldini commented on OWB-655:
-------------------------------------

OK Mark. Thanks for your help.
I am waiting for a solution.

Rogerio.
                
> CDI doesn´t inject stateless EJB by abstract class.
> ---------------------------------------------------
>
>                 Key: OWB-655
>                 URL: https://issues.apache.org/jira/browse/OWB-655
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Enterprise Web Beans
>    Affects Versions: 1.1.3
>            Reporter: Rogerio Baldini
>            Assignee: Gurkan Erdogdu
>
> I have these classes:
> public abstract class PlcBaseDAO {}
> public abstract class PlcBaseJpaDAO extends PlcBaseDAO  {}
> @Stateless
> public class AppJpaDAO extends PlcBaseJpaDAO {}
> And this injection doesn´t work.
> @Named
> public class AppCDI {
> 	@Inject
> 	private PlcBaseDAO baseDao;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (OWB-655) CDI doesn´t inject stateless EJB by abstract class.

Posted by "Rogerio Baldini (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13234921#comment-13234921 ] 

Rogerio Baldini commented on OWB-655:
-------------------------------------

If i can be able to inject an interface, I should be able to inject an abstract class as well, rigth?
At truth, both are acting the same way. So CDI should be able to do this.

Thanks




                
> CDI doesn´t inject stateless EJB by abstract class.
> ---------------------------------------------------
>
>                 Key: OWB-655
>                 URL: https://issues.apache.org/jira/browse/OWB-655
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Enterprise Web Beans
>    Affects Versions: 1.1.3
>            Reporter: Rogerio Baldini
>            Assignee: Gurkan Erdogdu
>
> I have these classes:
> public abstract class PlcBaseDAO {}
> public abstract class PlcBaseJpaDAO extends PlcBaseDAO  {}
> @Stateless
> public class AppJpaDAO extends PlcBaseJpaDAO {}
> And this injection doesn´t work.
> @Named
> public class AppCDI {
> 	@Inject
> 	private PlcBaseDAO baseDao;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (OWB-655) CDI doesn´t inject stateless EJB by abstract class.

Posted by "Romain Manni-Bucau (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13234867#comment-13234867 ] 

Romain Manni-Bucau commented on OWB-655:
----------------------------------------

as a workaround this work (the injected class is concrete and i used @EJB instead of @Inject):


import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.ejb.embeddable.EJBContainer;
import javax.inject.Inject;
import javax.inject.Named;
import org.junit.Test;

import static junit.framework.Assert.assertTrue;

public class TmpTest {
    @Inject
    private AppCDI cdi;

    @Test
    public void app() throws Exception {
        final EJBContainer c = EJBContainer.createEJBContainer();
        c.getContext().bind("inject", this);
        assertTrue(cdi.ok());
        c.close();
    }

    public static abstract class PlcBaseDAO {}

    public static class PlcBaseJpaDAO extends PlcBaseDAO {}

    @Stateless
    public static class AppJpaDAO extends PlcBaseJpaDAO {}

    @Named
    public static class AppCDI {
        @EJB
        private PlcBaseDAO baseDao;

        public boolean ok() {
            return baseDao != null;
        }
    }
}


                
> CDI doesn´t inject stateless EJB by abstract class.
> ---------------------------------------------------
>
>                 Key: OWB-655
>                 URL: https://issues.apache.org/jira/browse/OWB-655
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Enterprise Web Beans
>    Affects Versions: 1.1.3
>            Reporter: Rogerio Baldini
>            Assignee: Gurkan Erdogdu
>
> I have these classes:
> public abstract class PlcBaseDAO {}
> public abstract class PlcBaseJpaDAO extends PlcBaseDAO  {}
> @Stateless
> public class AppJpaDAO extends PlcBaseJpaDAO {}
> And this injection doesn´t work.
> @Named
> public class AppCDI {
> 	@Inject
> 	private PlcBaseDAO baseDao;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (OWB-655) CDI doesn´t inject stateless EJB by abstract class.

Posted by "Mark Struberg (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13234993#comment-13234993 ] 

Mark Struberg commented on OWB-655:
-----------------------------------

We clarified in the CDI EG that this indeed should work. See 3.2.2 of the CDI spec.
We will look into the proper place to fix this ;)
                
> CDI doesn´t inject stateless EJB by abstract class.
> ---------------------------------------------------
>
>                 Key: OWB-655
>                 URL: https://issues.apache.org/jira/browse/OWB-655
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Enterprise Web Beans
>    Affects Versions: 1.1.3
>            Reporter: Rogerio Baldini
>            Assignee: Gurkan Erdogdu
>
> I have these classes:
> public abstract class PlcBaseDAO {}
> public abstract class PlcBaseJpaDAO extends PlcBaseDAO  {}
> @Stateless
> public class AppJpaDAO extends PlcBaseJpaDAO {}
> And this injection doesn´t work.
> @Named
> public class AppCDI {
> 	@Inject
> 	private PlcBaseDAO baseDao;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (OWB-655) CDI doesn´t inject stateless EJB by abstract class.

Posted by "Rogerio Baldini (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13234825#comment-13234825 ] 

Rogerio Baldini commented on OWB-655:
-------------------------------------

Eric,

I could change this implementation but it´s more complex than that, and I don´t have time enough to do this.
If it worked in some way, it´d be fabulous.

Thansk,
Rogerio.

                
> CDI doesn´t inject stateless EJB by abstract class.
> ---------------------------------------------------
>
>                 Key: OWB-655
>                 URL: https://issues.apache.org/jira/browse/OWB-655
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Enterprise Web Beans
>    Affects Versions: 1.1.3
>            Reporter: Rogerio Baldini
>            Assignee: Gurkan Erdogdu
>
> I have these classes:
> public abstract class PlcBaseDAO {}
> public abstract class PlcBaseJpaDAO extends PlcBaseDAO  {}
> @Stateless
> public class AppJpaDAO extends PlcBaseJpaDAO {}
> And this injection doesn´t work.
> @Named
> public class AppCDI {
> 	@Inject
> 	private PlcBaseDAO baseDao;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (OWB-655) CDI doesn´t inject stateless EJB by abstract class.

Posted by "Mark Struberg (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13235095#comment-13235095 ] 

Mark Struberg commented on OWB-655:
-----------------------------------

After a long discussion with Roman and Eric on IRC we found the origin of the problem.
OpenEJB creates a subclass CdiEjbBean which extends our abstract BaseEjbBean.
This CdiEjbBean doesn't yet distinguish between NIV (no interface view) and old style session beans. It should detect NIV and overwrite BaseEjbBean#needsBeanLocalViewAddedToTypes() accordingly. Romain already created OPENEJB-1800 and will fix this issue soon.
                
> CDI doesn´t inject stateless EJB by abstract class.
> ---------------------------------------------------
>
>                 Key: OWB-655
>                 URL: https://issues.apache.org/jira/browse/OWB-655
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Enterprise Web Beans
>    Affects Versions: 1.1.3
>            Reporter: Rogerio Baldini
>            Assignee: Gurkan Erdogdu
>
> I have these classes:
> public abstract class PlcBaseDAO {}
> public abstract class PlcBaseJpaDAO extends PlcBaseDAO  {}
> @Stateless
> public class AppJpaDAO extends PlcBaseJpaDAO {}
> And this injection doesn´t work.
> @Named
> public class AppCDI {
> 	@Inject
> 	private PlcBaseDAO baseDao;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (OWB-655) CDI doesn´t inject stateless EJB by abstract class.

Posted by "Rogerio Baldini (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13234812#comment-13234812 ] 

Rogerio Baldini commented on OWB-655:
-------------------------------------

Hi Mark,

Thanks for your answer.

I don´t intent to use another framework for transtion. I just want to use what is specified in JEE6/EJB3.1.

Another important information: this example works fine with jBoss WELD.

Thanks again,
Rogerio.
                
> CDI doesn´t inject stateless EJB by abstract class.
> ---------------------------------------------------
>
>                 Key: OWB-655
>                 URL: https://issues.apache.org/jira/browse/OWB-655
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Enterprise Web Beans
>    Affects Versions: 1.1.3
>            Reporter: Rogerio Baldini
>            Assignee: Gurkan Erdogdu
>
> I have these classes:
> public abstract class PlcBaseDAO {}
> public abstract class PlcBaseJpaDAO extends PlcBaseDAO  {}
> @Stateless
> public class AppJpaDAO extends PlcBaseJpaDAO {}
> And this injection doesn´t work.
> @Named
> public class AppCDI {
> 	@Inject
> 	private PlcBaseDAO baseDao;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (OWB-655) CDI doesn´t inject stateless EJB by abstract class.

Posted by "Rogerio Baldini (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13234886#comment-13234886 ] 

Rogerio Baldini commented on OWB-655:
-------------------------------------

Ok Romain, it works, thanks.

I can´t use this way, because sometimes my concrete class could be ejb sometimes just a common bean.

So is my example  wrong or is a OWB/OpenEJB bug?

Rogerio 
                
> CDI doesn´t inject stateless EJB by abstract class.
> ---------------------------------------------------
>
>                 Key: OWB-655
>                 URL: https://issues.apache.org/jira/browse/OWB-655
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Enterprise Web Beans
>    Affects Versions: 1.1.3
>            Reporter: Rogerio Baldini
>            Assignee: Gurkan Erdogdu
>
> I have these classes:
> public abstract class PlcBaseDAO {}
> public abstract class PlcBaseJpaDAO extends PlcBaseDAO  {}
> @Stateless
> public class AppJpaDAO extends PlcBaseJpaDAO {}
> And this injection doesn´t work.
> @Named
> public class AppCDI {
> 	@Inject
> 	private PlcBaseDAO baseDao;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (OWB-655) CDI doesn´t inject stateless EJB by abstract class.

Posted by "Rogerio Baldini (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13234802#comment-13234802 ] 

Rogerio Baldini commented on OWB-655:
-------------------------------------

Hi LieGrue,

This error occurs in Tomee-plus-1.0.0-beta-2.

This injection just works if I inject concrete class.

Thanks,
Rogerio 

                
> CDI doesn´t inject stateless EJB by abstract class.
> ---------------------------------------------------
>
>                 Key: OWB-655
>                 URL: https://issues.apache.org/jira/browse/OWB-655
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Enterprise Web Beans
>    Affects Versions: 1.1.3
>            Reporter: Rogerio Baldini
>            Assignee: Gurkan Erdogdu
>
> I have these classes:
> public abstract class PlcBaseDAO {}
> public abstract class PlcBaseJpaDAO extends PlcBaseDAO  {}
> @Stateless
> public class AppJpaDAO extends PlcBaseJpaDAO {}
> And this injection doesn´t work.
> @Named
> public class AppCDI {
> 	@Inject
> 	private PlcBaseDAO baseDao;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (OWB-655) CDI doesn´t inject stateless EJB by abstract class.

Posted by "Mark Struberg (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13234799#comment-13234799 ] 

Mark Struberg commented on OWB-655:
-----------------------------------

PS: Instead of Stateless you can also make your AppJpaDAO an @ApplicationScoped CDI bean and use e.g. CODIs @Transational interceptor [2] to handle your EntityManager.

[2] https://cwiki.apache.org/confluence/display/EXTCDI/JPA+Overview
                
> CDI doesn´t inject stateless EJB by abstract class.
> ---------------------------------------------------
>
>                 Key: OWB-655
>                 URL: https://issues.apache.org/jira/browse/OWB-655
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Enterprise Web Beans
>    Affects Versions: 1.1.3
>            Reporter: Rogerio Baldini
>            Assignee: Gurkan Erdogdu
>
> I have these classes:
> public abstract class PlcBaseDAO {}
> public abstract class PlcBaseJpaDAO extends PlcBaseDAO  {}
> @Stateless
> public class AppJpaDAO extends PlcBaseJpaDAO {}
> And this injection doesn´t work.
> @Named
> public class AppCDI {
> 	@Inject
> 	private PlcBaseDAO baseDao;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (OWB-655) CDI doesn´t inject stateless EJB by abstract class.

Posted by "Mark Struberg (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13234789#comment-13234789 ] 

Mark Struberg commented on OWB-655:
-----------------------------------

Hi Rogerio!

What parts of OpenWebBeans do you use?
OWB is built in a modular fashion. Our webbeans-impl.jar will only serve basic Java SE injection. If you add further plugins, e.g. webbeans-resource, webbeans-ee, etc then you will get more features.

Injecting EJBs into CDI beans is one such 'extended' feature. If you use OpenWebBeans together with OpenEJB then your sample should work.

How does your container setup look like currently? If you are using tomcat + OpenEJB + OpenWebBeans then you might try out TomEE [1] which is a pre-packaged EE Web-Profile for exactly such scenarios.

hope that helps!

LieGrue,
strub

[1] http://tomee.apache.org
                
> CDI doesn´t inject stateless EJB by abstract class.
> ---------------------------------------------------
>
>                 Key: OWB-655
>                 URL: https://issues.apache.org/jira/browse/OWB-655
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Enterprise Web Beans
>    Affects Versions: 1.1.3
>            Reporter: Rogerio Baldini
>            Assignee: Gurkan Erdogdu
>
> I have these classes:
> public abstract class PlcBaseDAO {}
> public abstract class PlcBaseJpaDAO extends PlcBaseDAO  {}
> @Stateless
> public class AppJpaDAO extends PlcBaseJpaDAO {}
> And this injection doesn´t work.
> @Named
> public class AppCDI {
> 	@Inject
> 	private PlcBaseDAO baseDao;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (OWB-655) CDI doesn´t inject stateless EJB by abstract class.

Posted by "Eric Covener (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13234813#comment-13234813 ] 

Eric Covener commented on OWB-655:
----------------------------------

Does it really require the base class to be abstract, IOW when the no-interface view is being used do other non-abstract super classes work for injection?
                
> CDI doesn´t inject stateless EJB by abstract class.
> ---------------------------------------------------
>
>                 Key: OWB-655
>                 URL: https://issues.apache.org/jira/browse/OWB-655
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Enterprise Web Beans
>    Affects Versions: 1.1.3
>            Reporter: Rogerio Baldini
>            Assignee: Gurkan Erdogdu
>
> I have these classes:
> public abstract class PlcBaseDAO {}
> public abstract class PlcBaseJpaDAO extends PlcBaseDAO  {}
> @Stateless
> public class AppJpaDAO extends PlcBaseJpaDAO {}
> And this injection doesn´t work.
> @Named
> public class AppCDI {
> 	@Inject
> 	private PlcBaseDAO baseDao;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (OWB-655) CDI doesn´t inject stateless EJB by abstract class.

Posted by "Mark Struberg (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13234939#comment-13234939 ] 

Mark Struberg commented on OWB-655:
-----------------------------------

I also don't think the abstract base type should be a problem. What counts is that the AppJpaDAO class is a valid type. 

I do think that in this very case we could lookup the EJB if we don't find a CDI Bean<PlcBaseDAO>. But in general the spec is imo not 100% clear what should happen with such 'mixed' scenarios: what happens if we have an @ApplicationScoped class OtherAppJpaDAO extends PlcBaseJpaDAO {} ?
There are no @Alternative, @Specializes etc rules for mixed EJB/CDI cases defined yet imo. 

                
> CDI doesn´t inject stateless EJB by abstract class.
> ---------------------------------------------------
>
>                 Key: OWB-655
>                 URL: https://issues.apache.org/jira/browse/OWB-655
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Enterprise Web Beans
>    Affects Versions: 1.1.3
>            Reporter: Rogerio Baldini
>            Assignee: Gurkan Erdogdu
>
> I have these classes:
> public abstract class PlcBaseDAO {}
> public abstract class PlcBaseJpaDAO extends PlcBaseDAO  {}
> @Stateless
> public class AppJpaDAO extends PlcBaseJpaDAO {}
> And this injection doesn´t work.
> @Named
> public class AppCDI {
> 	@Inject
> 	private PlcBaseDAO baseDao;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (OWB-655) CDI doesn´t inject stateless EJB by abstract class.

Posted by "Eric Covener (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13234928#comment-13234928 ] 

Eric Covener commented on OWB-655:
----------------------------------

We wouldn't inject an abstract class, we'd include the abstract class in the list of bean types of the EJB with a no-interface view. 

When someone requested a java type with that abstract class, and this was the only bean with that type, we'd find our way to this enterprise bean ask the container for an EJB and inject [a proxy to] that.
                
> CDI doesn´t inject stateless EJB by abstract class.
> ---------------------------------------------------
>
>                 Key: OWB-655
>                 URL: https://issues.apache.org/jira/browse/OWB-655
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Enterprise Web Beans
>    Affects Versions: 1.1.3
>            Reporter: Rogerio Baldini
>            Assignee: Gurkan Erdogdu
>
> I have these classes:
> public abstract class PlcBaseDAO {}
> public abstract class PlcBaseJpaDAO extends PlcBaseDAO  {}
> @Stateless
> public class AppJpaDAO extends PlcBaseJpaDAO {}
> And this injection doesn´t work.
> @Named
> public class AppCDI {
> 	@Inject
> 	private PlcBaseDAO baseDao;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (OWB-655) CDI doesn´t inject stateless EJB by abstract class.

Posted by "Romain Manni-Bucau (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13234912#comment-13234912 ] 

Romain Manni-Bucau commented on OWB-655:
----------------------------------------

I think CDI doesn't handle such a case (injecting an abstract class) so you can't use @Inject here.

Regarding EJB spec i'm not sure but it is something we should be able to do in OpenEJB/TomEE so i'll have a look.
                
> CDI doesn´t inject stateless EJB by abstract class.
> ---------------------------------------------------
>
>                 Key: OWB-655
>                 URL: https://issues.apache.org/jira/browse/OWB-655
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Enterprise Web Beans
>    Affects Versions: 1.1.3
>            Reporter: Rogerio Baldini
>            Assignee: Gurkan Erdogdu
>
> I have these classes:
> public abstract class PlcBaseDAO {}
> public abstract class PlcBaseJpaDAO extends PlcBaseDAO  {}
> @Stateless
> public class AppJpaDAO extends PlcBaseJpaDAO {}
> And this injection doesn´t work.
> @Named
> public class AppCDI {
> 	@Inject
> 	private PlcBaseDAO baseDao;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Resolved] (OWB-655) CDI doesn´t inject stateless EJB by abstract class.

Posted by "Mark Struberg (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OWB-655?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Struberg resolved OWB-655.
-------------------------------

       Resolution: Fixed
    Fix Version/s: 1.1.4
         Assignee: Mark Struberg  (was: Gurkan Erdogdu)

fixed in conjunction with the new OpenEJB version. See OPENEJB-1800.
                
> CDI doesn´t inject stateless EJB by abstract class.
> ---------------------------------------------------
>
>                 Key: OWB-655
>                 URL: https://issues.apache.org/jira/browse/OWB-655
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Enterprise Web Beans
>    Affects Versions: 1.1.3
>            Reporter: Rogerio Baldini
>            Assignee: Mark Struberg
>             Fix For: 1.1.4
>
>
> I have these classes:
> public abstract class PlcBaseDAO {}
> public abstract class PlcBaseJpaDAO extends PlcBaseDAO  {}
> @Stateless
> public class AppJpaDAO extends PlcBaseJpaDAO {}
> And this injection doesn´t work.
> @Named
> public class AppCDI {
> 	@Inject
> 	private PlcBaseDAO baseDao;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (OWB-655) CDI doesn´t inject stateless EJB by abstract class.

Posted by "Mark Struberg (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13235000#comment-13235000 ] 

Mark Struberg commented on OWB-655:
-----------------------------------

addendum: this assumes that all your beans are in a jar which also has a META-INF/beans.xml.
                
> CDI doesn´t inject stateless EJB by abstract class.
> ---------------------------------------------------
>
>                 Key: OWB-655
>                 URL: https://issues.apache.org/jira/browse/OWB-655
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Enterprise Web Beans
>    Affects Versions: 1.1.3
>            Reporter: Rogerio Baldini
>            Assignee: Gurkan Erdogdu
>
> I have these classes:
> public abstract class PlcBaseDAO {}
> public abstract class PlcBaseJpaDAO extends PlcBaseDAO  {}
> @Stateless
> public class AppJpaDAO extends PlcBaseJpaDAO {}
> And this injection doesn´t work.
> @Named
> public class AppCDI {
> 	@Inject
> 	private PlcBaseDAO baseDao;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira