Skip to Content
author's profile photo Former Member
Former Member

EJB invocation of CAF Application Service

Hello!

I have create a Composite Application (Development Component) with SAP NetWeaver CE 7.1. There I have create an Application Service. The special generated EJB and its interface have this code:

<b>EJB:</b>

package de.td.ir_as.modeled.appsrv.increcrfcconn;

@javax.ejb.Stateless(name = "de.td.ir_as.modeled.appsrv.increcrfcconn.IncRecRfcConn")
@javax.ejb.Local(value = { de.td.ir_as.modeled.appsrv.increcrfcconn.IncRecRfcConnServiceLocal.class })
@javax.interceptor.Interceptors(value = { com.sap.caf.rt.interceptors.LogInterceptor.class })
public class IncRecRfcConnBeanImpl extends de.td.ir_as.modeled.appsrv.increcrfcconn.IncRecRfcConnBean {
}

<b>Abstract Class:</b>

/* ***************************************************************************
 * 			THIS FILE HAS BEEN GENERATED BY THE CAF CODE GENERATOR.
 * 			ALL CHANGES WILL BE LOST IF THE FILE IS REGENERATED!
 * ***************************************************************************/
//Application Service Template
package de.td.ir_as.modeled.appsrv.increcrfcconn;

public abstract class IncRecRfcConnBean implements de.td.ir_as.modeled.appsrv.increcrfcconn.IncRecRfcConnServiceLocal {
    public static final String _PROVIDER = "sap.com";
    public static final String _APPLICATION = "ir_as";
    public static final String _APP_SRV_NAME = "IncRecRfcConn";
    public static final String _OBJECT_NAME = _PROVIDER + "/" + _APPLICATION + "/" + _APP_SRV_NAME;
    public static final String _JARM_REQUEST = "XAP:APPSERV:" + _OBJECT_NAME;

    protected static final com.sap.tc.logging.Location _location = com.sap.tc.logging.Location.getLocation(IncRecRfcConnBean.class);
	    
    public IncRecRfcConnBean(){
    }
...
}

<b>Interface:</b>

/* ***************************************************************************
 * 			THIS FILE HAS BEEN GENERATED BY THE CAF CODE GENERATOR.
 * 			ALL CHANGES WILL BE LOST IF THE FILE IS REGENERATED!
 * ***************************************************************************/
//Application Service Template
package de.td.ir_as.modeled.appsrv.increcrfcconn;

public interface IncRecRfcConnServiceLocal{

...
	
}

I have created an other Development Component. It's a EJB Module. In this component I want to use via EJB invocation the developed Application Service. I use the @EJB invocation to use it:

@Stateless
public class IncRecRfcImplBean implements IncRecRfcImplLocal {

	@EJB(beanName="de.td.ir_as.modeled.appsrv.increcrfcconn.IncRecRfcConn")
	private IncRecRfcConnServiceLocal incRecRfcConn;
...

But if I instantiate a [/code]IncRecRfcImplBean

-object in an POJO the attribute [code]incRecRfcConn

will not be initialized at runtime.

What do I do wrong?

Regards,

Armin

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Nov 12, 2007 at 08:54 AM

    Hi Armin,

    Isn't your local interface, IncRecRfcConnServiceLocal, missing the @Local annotation before the interface declaration?

    package de.td.ir_as.modeled.appsrv.increcrfcconn;

    @Local

    public interface IncRecRfcConnServiceLocal{

    ...

    }

    Best regards,

    Dobrinka

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      is the code

      @javax.ejb.Local(value = { de.td.ir_as.modeled.appsrv.increcrfcconn.IncRecRfcConnServiceLocal.class })

      in the EJB not enough? Or do I have to add the @Local annotation to access from other Development Components via EJB invocation?

      Regards,

      Armin

  • Posted on Nov 13, 2007 at 10:00 PM

    > But if I instantiate a

    >

    IncRecRfcImplBean

    -object in an POJO the

    > attribute

    incRecRfcConn

    will not be

    > initialized at runtime.

    >

    > What do I do wrong?

    How exactly do you do that? If you simply call

    new IncRecRfcImplBean()

    it will not work as the EJB container doesn't know about this. Actually, you must never work directly with the bean class - this is managed by the container. The app developer works with the bean interfaces.

    HTH!

    -- Vladimir

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Vladimir Pavlov

      Hello,

      I solved the problem:

      The problem was that the deploying of the EJB module was done with warning.

      In Development Infrastructure Perspective I add to the EAR-DC of the EJB Module a Dependency to the EAR-DC of the Application Service with Dependency Details: Deploy Time and Run Time.

      After that the EJB module was deployed without warnings and I'm able to look up the EJB.

      Anyway, thanks for your help.

      Kind Regards,

      Armin

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.