How do youi call an EJB from a composite app

I created a simple composite application, called testserve.
Here is the entire body of the implementation class, testserveBeanImpl.java
package com.sap.demo.testserve.modeled.appsrv.testserve;
import com.sap.demo.*;
@com.sap.caf.dt.CAFWebService(name="testserve")
@javax.jws.soap.SOAPBinding(style=javax.jws.soap.SOAPBinding.Style.RPC, use=javax.jws.soap.SOAPBinding.Use.LITERAL)
@javax.jws.WebService(name="testserve", serviceName="testserve", portName="testservePort", targetNamespace="http://www.sap.com/caf/demo.sap.com/testserve/modeled", wsdlLocation="META-INF/wsdl/testserve.wsdl")
@javax.ejb.Stateless(name = "com.sap.demo.testserve.modeled.appsrv.testserve.testserve")
@javax.ejb.Local(value = { com.sap.demo.testserve.modeled.appsrv.testserve.testserveServiceLocal.class })
@javax.interceptor.Interceptors(value = { com.sap.caf.rt.interceptors.LogInterceptor.class })
public class testserveBeanImpl extends
          com.sap.demo.testserve.modeled.appsrv.testserve.testserveBean {
                //these two lines are used to inject an EJB which is packaged in the EAR
     @javax.ejb.EJB (beanName="com.sap.demo.TestbeanBean")
               private com.sap.demo.TestbeanBean theTestBean;
     @com.sap.caf.dt.CAFOperation(name = "serviceTest1")
     @javax.jws.WebMethod(exclude=false, operationName="serviceTest1")
     @javax.jws.WebResult(name="outputParameter1")
     public java.lang.Integer serviceTest1() {
                               //test1() just writes to console, simple test to test EJB connectivity
          theTestBean.test1();
          return 1;
There is a second ejb project called testejb which contains the stateless session bean TestbeanBean.
The code compiles fine as typed above.
However, when deployed, I get the following exception, which I will post in a reply, since this post is too long. I am sure that I neglected to
set up something so that the testserve service can find the EJB TestbeanBean at runtime, but I need some
guidance. I have searched the help for a couple days and have not found anything useful. Is there a step by step
explanation for configuring this?  To be clear, I want a web service created in the Composition Application perspective
to be able to call an EJB in an EJB project. I don't want to create a web service out of the EJB (TestbeanBean) for performance reasons. Thanks.
The service works fine when the 3 lines relating to  TestbeanBean are removed.

Abbreviated error trace
#1#javax.ejb.EJBException: Exception in getMethodReady() for stateless bean
: Injection on field theTestBean of instance com.sap.demo.testserve.modeled.appsrv.testserve.testserveBeanImpl@ca49f82 failed. Could not get a value to be injected from the factory.
Caused by: javax.ejb.EJBException: Cannot perform injection over bean instance
Caused by: com.sap.engine.lib.injection.InjectionException: Injection on field theTestBean of instance com.sap.demo.testserve.modeled.appsrv.testserve.testserveBeanImpl@ca49f82 failed. Could not get a value to be injected from the factory.
     at com.sap.engine.lib.injection.FieldInjector.inject(FieldInjector.java:115)
Caused by: javax.naming.NamingException: Error occurs while the EJB Object Factory trying to resolve JNDI reference Reference Class Name: com.sap.demo.testserve.modeled.appsrv.testserve.testserveBeanImpl/theTestBean
Type: clientAppName
Content: demo.sap.com/testserve~ear
Type: interfaceType
Content: undetermined
Type: undetermined
Content: com.sap.demo.TestbeanBean
Type: ejb-link
Content: com.sap.demo.TestbeanBean
javax.ejb.EJBException: Cannot find EJB matching the criterions defined by JNDI reference: 'Reference Class Name: com.sap.demo.testserve.modeled.appsrv.testserve.testserveBeanImpl/theTestBean
Type: clientAppName
Content: demo.sap.com/testserve~ear
Type: interfaceType
Content: undetermined
Type: undetermined
Content: com.sap.demo.TestbeanBean
Type: ejb-link
Content: com.sap.demo.TestbeanBean
'].  Searched applications order is USED_CLASS_LOADER[

Similar Messages

  • How do you call a method from  another class without extending as a parent?

    How do you call a method from another class without extending it as a parent? Is this possible?

    Why don't you just create an instance of the class?
    Car c = new Car();
    c.drive("fast");The drive method is in the car class, but as long as the method is public, you can use it anywhere.
    Is that what you were asking or am I totally misunderstanding your question?
    Jen

  • HT4437 How do you stream live tv from an abc app from my iPad 4 retina to my tv using Apple TV?

    How do you stream live tv from an abc app from my iPad 4 retina to my tv using Apple TV?

    you use airplay mirror
    if that does not work then it's because the app block the feature
    how you turn on airplay mirror
    http://support.apple.com/kb/ht5209

  • How do you remove a location from the Weather App of iPhone?

    How do you remove a location from the weather app on the iPhone 4s?

    thomasfromwest lafayette wrote:
    How do you remove a location from the weather app on the iPhone 4s?
    Open the weather application. You should see 3 white lines at the right below corner and hit that.
    It will show the list of locations. Now just swipe to left on any location and you should find a delete option.
    Hope it helps.

  • HELP!!! How I can call to EJB from another EJB??

    I have two EJBs, for each EJB I have a jar, how I can call to EJB jar to another???
    I have tried the following, in the first EJB I have import the second EJB jar and call it with context, lookup, PortableRemoteObject etc.. but the instruction lookup not find the second EJB reference.
    The name in the lookup instruction is the JNDI name of the second EJB but not find a reference to it.
    Please help me!!! Thanks!!
    The error is:
    javax.naming.NameNotFoundException: Missing node. Root exception is org.omg.CosNaming.NamingContextPackage.NotFound
         at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:34)
         at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.extract(NotFoundHelper.java:50)
         at org.omg.CosNaming._NamingContextStub.resolve(_NamingContextStub.java:161)
         at com.inprise.j2ee.jndi.java.CorbaContext.resolveName(CorbaContext.java:242)
         at com.inprise.j2ee.jndi.java.CorbaContext.lookup(CorbaContext.java:261)
         at com.inprise.j2ee.jndi.java.javaContext.internal_lookup(javaContext.java:483)
         at com.inprise.j2ee.jndi.java.javaContext.internal_lookup(javaContext.java:493)
         at com.inprise.j2ee.jndi.java.javaContext.internal_lookup(javaContext.java:493)
         at com.inprise.j2ee.jndi.java.javaContext.lookup(javaContext.java:937)
         at com.inprise.j2ee.jndi.java.javaContext.lookup(javaContext.java:942)
         at javax.naming.InitialContext.lookup(InitialContext.java:350)
         at ejbclient.EnterpriseClientBean.addition(EnterpriseClientBean.java:115)
         at ejbclient.EnterpriseClientBean.actionPerformed(EnterpriseClientBean.java:97)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1450)
         at avax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Abstr

    ok.. Here it goes.. I am writing a sample code..
    public class EJB1LogBean implements SessionBean {
    // test is a method of stateless session beam
    public void test ( TestVal val )
    throws RemoteException{
    try {
    EJB2LogHome ejb2Home= (EJB2LogHome)getHome("java:comp/env/ejb/EJB2LogHome",1);
    EJB2Log ejb2Log = ejb2LogHome.create ( val );
    } catch ( CreateException e ) {
         System.out.println("Create Exception occurred ");
         e.printStackTrace();
         } catch ( RemoteException e ) {
         System.out.println( "RemoteException Occured");
    e.printStackTrace();
         throw new RemoteException () ;
         } catch(Exception ee) {
    ee.printStackTrace();
    private EJBHome getHome(String jndiName,int type) {
    try {
    Context context = new InitialContext();
    Object ref = context.lookup( jndiName );
    switch(type)
    case 1:
    EJB2LogHome ejb2LogHome = ( EJB2LogHome )
    PortableRemoteObject.narrow( ref, EJB2LogHome.class );
    return ejb2LogHome;
    } catch ( Exception e ) {
    e.printStackTrace();
    return null;
    }//EJB1LogBean ends
    Here as you can see, EJB1LogBean(session bean) is calling a second EJB, EJB2LogBean (entity bean). TestVal is a sample value object passed. It is plain java class and can vary from app to app and it has got nothing to do with ejbs.
    "java:comp/env/ejb" is a J2EE standard and while getting a home interface, you have to append the home interface class name to "java:comp/env/ejb". Here I am passing "java:comp/env/ejb/EJB2LogHome" and "1" to getHome method, whose job is to get a reference to a home interface. getHome method is a local method. "1" is passed just to give a flexibility to getHome method as you can have more ejbs to invoked. In that case, you can go on adding different case statements for 2, 3 etc.
    The only thing you have to keep in mind is that your deployment descriptor for EJB1LogBean will contain the entires for both the beans i.e. for EJB1LogBean and EJB2LogBean. This is because EJB2LogBean is wrapped by EJB1LogBean.
    Hope this helps.
    Please let me know if you need anything more.
    - Amit

  • How do you delete 'GarageBand Documents' from iPad2 GarageBand App in iTunes for Windows?

    Using the GarageBand Application, I have shared my songs/files between my pc and my iPad and now I want to remove them from the 'GarageBand Documents' list in iTunes but I can not figure out how to do so.  Any advice would be greatly appreciated, thanks!!

    Hmm, this looks like a bit of a generic problem with the way iTunes manages supplementary files for apps. As far as I can tell you can drag pretty much anything into an app's private storage space from iTunes, and you can save stuff from it, but to delete you have to use the app. If you've dragged in something the app won't display then you can't find it to delete it.
    If you've saved everything you want somewhere safe then temorarily removing the GarageBand app from your iPad ought to fix it.
    tt2

  • How do you get a video from the video app to your photos

    I am trying to get a video from the video app on the iphone to go to my photos, but I can't figure it out,,, Help?

    http://support.apple.com/kb/HT4083

  • How do I call an ejb from a java client?

    I put ejb classes in a jar file along with java client code and deployed it on my OC4J server. Now I am trying to run the ejb by calling the client code on my OC4J server from the command line but I am not having success. Am I doing this the right way? Should I also deploy my client code? Should the client code also be in a directory on my OC4J server?
    Mike

    Hi. Here is a part of the code for a java client. In this particular case it is also an EJB but it is a Message Driven Bean.
    public class MDBEjbMecomsIFSBean implements MessageDrivenBean,
    MessageListener {
    // context
    private MessageDrivenContext m_ctx = null;
    // properties filename
    private String m_propFile = DEF_PROPFILE;
    // application
    private String m_app;
    // callable function from properties
    // private String m_dsJndiName;
    // private String m_dsType;
    // private String m_dsFunc;
    private int m_connRetryMax;
    private int m_connRetryWait;
    // initial stylesheet transformation file
    private String m_xsltFile;
    // web service operation name
    private String m_operationName;
    // trap emitter members from properties
    private String m_trapMbeanURL;
    private String m_trapObjectName;
    private String m_trapAction;
    private String m_trapAppName;
    private Severity m_trapMax = Severity.CRITICAL;
    private int m_trapAfterDelivery;
    private boolean m_trapStart;
    // jmx members for auto shutdown from properties
    private String m_mdbMbeanURL;
    private String m_mdbMbeanAccount;
    private String m_mdbMbeanPassword;
    private String m_mdbObjectName;
    private String m_mdbAutoShutdown;
    // clob allocator to be used by Oracle jdbc call
    // private CLOB m_clob;
    * Remember the context for this MDB.
    * @param ctx the context for this MDB
    public void setMessageDrivenContext(MessageDrivenContext ctx) {
    logger.log(Level.FINEST, "Setting MessageDrivenContext");
    m_ctx = ctx;
    * ejbCreate() is called when the server wants to create a new instance of this MDB.
    * At this time a connection with the target is established and the callable statement
    public void ejbCreate() {
    readProperties();
    // Connection errors are IGNORED, because it seems that raising Exceptions from here
    // does NOT result in a container managed rollback. Instead the dequeue is commited,
    // resulting in AQ message status 2 (success).
    // By ignoring the fault, another Exception will occurr in onMessage(), from where
    // a propagated exception DOES result in a rollback.
    String logStr = "Started TenneT-MDB-" + m_app;
    logger.log(Level.FINEST, prefixLog(logStr));
    if (m_trapStart)
    notify(Severity.NORMAL, logStr);
    * This method is called whenever a message is sent to the queue associated with this MDB.
    * @param msg assumed to be a javax.jms.TextMessage containting an xml string
    public void onMessage(Message msg) {
    * msg id, timestamp and length are logged at info level
    * msg content is logged at debug level
    String msgText = "uninitialized";
    String msgId = "undefined";
    int msgDeliveryCount = 0;
    // this block retrieves msg info from the jms header
    // errors are logged as info and ignored
    try {
    // get msgid first so any subsequent error can be associated with the msg
    msgId = msg.getJMSMessageID();
    logger.log(Level.FINE, prefixLog("MessageID: " + msgId));
    logger.log(Level.FINE,
    prefixLog("Enq_time : " + msg.getJMSTimestamp()));
    // delivery count can be used to send a critical trap only on the last retry
    if (msg.propertyExists(JMS_X_RCV_TIMESTAMP)) {
    logger.log(Level.FINE,
    prefixLog("Deq_time : " + msg.getIntProperty(JMS_X_RCV_TIMESTAMP)));
    // delivery count can be used to send a critical trap only on the last retry
    if (msg.propertyExists(JMS_X_DELIVERY_COUNT)) {
    msgDeliveryCount = msg.getIntProperty(JMS_X_DELIVERY_COUNT);
    logger.log(Level.FINE,
    prefixLog("DeliveryCnt: " + msgDeliveryCount));
    } catch (Exception e) {
    String errStr =
    "Minor exception in JMSConsumeMDBBean.onMessage() receiving msg \"" +
    msgId + "\": " + e.getMessage();
    logger.log(Level.SEVERE, prefixLog(errStr));
    // next the message content is addressed
    try {
    TextMessage message = (TextMessage)msg;
    msgText = message.getText();
    logger.log(Level.FINE,
    prefixLog("MessageLength: " + msgText.length()));
    logger.log(Level.FINEST, prefixLog("Msg: " + msgText));
    } catch (Exception e) {
    String errStr =
    "Error in JMSConsumeMDBBean.onMessage() retrieving msg \"" +
    msgId + "\": " + e.getMessage();
    logger.log(Level.SEVERE, prefixLog(errStr));
    notify(Severity.CRITICAL, errStr);
    throw new EJBException(errStr);
    // From now we can do intial stylesheet transformation if necessary
    try {
    // Prepare input
    XMLDocument xslInput;
    XMLDocument xmlInput;
    DOMParser parser = new DOMParser();
    parser.setPreserveWhitespace(true);
    // Parse XSL
    parser.parse((MDBEjbMecomsIFSBean.class.getResourceAsStream(m_xsltFile)));
    xslInput = parser.getDocument();
    // Parse XML
    parser.parse((Reader)new StringReader(msgText));
    xmlInput = parser.getDocument();
    // Instantiate XSL Processor
    XSLProcessor processor = new XSLProcessor();
    XSLStylesheet stylesheet;
    stylesheet = processor.newXSLStylesheet(xslInput);
    XMLDocumentFragment xmlOutput =
    (XMLDocumentFragment)processor.processXSL(stylesheet,
    xmlInput);
    // Now prepare xml for use with entity bean
    Document xmlDoc = new XMLDocument();
    xmlDoc.appendChild(xmlOutput);
    *// Invoke Entity Bean to perform lookup of destination Web Service*
    Context ctx;
    ctx = new InitialContext();
    EBEjbMecomsIFSLocalHome ebOppIfsLH =
    *(EBEjbMecomsIFSLocalHome)ctx.lookup("java:comp/env/ejb/local/EBEjbopp_ifs");*
    EBEjbMecomsIFSLocal ebOppIfs;
    ebOppIfs = ebOppIfsLH.create();
    *// pass message content to entity bean*
    ebOppIfs.setXMLmessage((Element)xmlDoc.getDocumentElement());
    *// provide correct soap action*
    ebOppIfs.setOperationName(m_operationName);;
    *// do actual work*
    ebOppIfs.doWork();
    } catch (XSLException e) {
    logger.log(Level.INFO,
    prefixLog("XSL Exception during onMessage " +
    e.getMessage()));
    } catch (SAXException e) {
    logger.log(Level.INFO,
    prefixLog("SAX Exception during onMessage " +
    e.getMessage()));
    } catch (CreateException e) {
    logger.log(Level.INFO,
    prefixLog("Create Exception during onMessage " +
    e.getMessage()));
    } catch (NamingException e) {
    logger.log(Level.INFO,
    prefixLog("Naming Exception during onMessage " +
    e.getMessage()));
    } catch (IOException e) {
    logger.log(Level.INFO,
    prefixLog("IO Exception during onMessage " + e.getMessage()));
    private void notify(Severity severity, String message) {
    logger.log(Level.FINEST,
    prefixLog("Started method notify() with severity level " +
    severity));
    try {
    if (m_trapMbeanURL == null || m_trapMbeanURL.equals("")) {
    logger.log(Level.WARNING,
    prefixLog("No MBean URL! Skipping SNMP trap."));
    } else {
    logger.log(Level.INFO,
    prefixLog("Setting up JMX connection with " +
    m_trapMbeanURL));
    ObjectName delegateName = null;
    MBeanServerConnection mbsc = null;
    try {
    JMXServiceURL jmxServiceURL =
    new JMXServiceURL(m_trapMbeanURL);
    JMXConnector connector =
    JMXConnectorFactory.connect(jmxServiceURL);
    mbsc = connector.getMBeanServerConnection();
    delegateName = new ObjectName(m_trapObjectName);
    logger.log(Level.FINEST,
    prefixLog("JMX connection established with " +
    m_trapMbeanURL));
    } catch (Exception ex) {
    logger.log(Level.SEVERE,
    prefixLog("Error while initializing JMX Server connection"),
    ex);
    throw new EJBException("Error while initializing JMX Server connection",
    ex);
    String localHost = null;
    try {
    InetAddress addr = InetAddress.getLocalHost();
    localHost = addr.getCanonicalHostName();
    logger.log(Level.FINEST,
    prefixLog("Localhost=" + localHost));
    } catch (UnknownHostException ex) {
    logger.log(Level.SEVERE, prefixLog(ex.getMessage()), ex);
    throw new EJBException(ex.getMessage(), ex);
    // invoke the trapemitter
    try {
    if (mbsc != null) {
    if (severity.ordinal() > m_trapMax.ordinal()) {
    severity = m_trapMax;
    String severityArg = severityMap.get(severity);
    Object[] arguments =
    { severityArg, message, m_trapAppName, localHost };
    String[] signature =
    { "java.lang.String", "java.lang.String",
    "java.lang.String", "java.lang.String" };
    mbsc.invoke(delegateName, m_trapAction, arguments,
    signature);
    logger.log(Level.INFO,
    prefixLog("TrapEmitter invoked: severity=" +
    severityArg + " - message=" +
    message));
    } else {
    logger.log(Level.SEVERE,
    prefixLog("Error: No MBean server connection established with " +
    m_trapMbeanURL));
    } catch (MBeanException e) {
    logger.log(Level.SEVERE,
    prefixLog("Error occured in invoked method"),
    e);
    } catch (ReflectionException e) {
    logger.log(Level.SEVERE, prefixLog(e.getMessage()),
    e.getCause());
    } catch (IOException e) {
    logger.log(Level.SEVERE,
    prefixLog("A communication problem occurred when talking to the MBean server"),
    e);
    } catch (InstanceNotFoundException e) {
    logger.log(Level.SEVERE,
    prefixLog("The MBean specified is not registered in the MBean server."),
    e);
    } catch (Exception e) {
    logger.log(Level.SEVERE,
    prefixLog("Error in method notify. Handling resumes..."));
    } finally {
    if (severity.equals(Severity.CRITICAL)) {
    stopConsuming();
    private void stopConsuming() {
    logger.log(Level.FINEST, prefixLog("Started method stopConsuming()"));
    if ("true".equals(m_mdbAutoShutdown)) {
    if (m_mdbMbeanURL == null || m_mdbMbeanURL == "") {
    logger.log(Level.WARNING,
    prefixLog("No MDB MBean URL! Skipping stopConsuming()."));
    } else {
    JMXConnector jmxCon = null;
    try {
    Hashtable<String, String> credentials =
    new Hashtable<String, String>();
    credentials.put("login", m_mdbMbeanAccount);
    credentials.put("password", m_mdbMbeanPassword);
    // Properties required to use the OC4J ORMI protocol
    Hashtable env = new Hashtable();
    env.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES,
    "oracle.oc4j.admin.jmx.remote");
    env.put(JMXConnector.CREDENTIALS, credentials);
    JMXServiceURL serviceUrl =
    new JMXServiceURL(m_mdbMbeanURL);
    jmxCon =
    JMXConnectorFactory.newJMXConnector(serviceUrl, env);
    jmxCon.connect();
    MBeanServerConnection mbs =
    jmxCon.getMBeanServerConnection();
    logger.log(Level.FINEST,
    prefixLog("JMX connection established with " +
    m_mdbMbeanURL));
    ObjectName objectName = new ObjectName(m_mdbObjectName);
    MessageDrivenBeanMBeanProxy MDBMBean =
    (MessageDrivenBeanMBeanProxy)MBeanServerInvocationHandler.newProxyInstance(mbs,
    objectName,
    MessageDrivenBeanMBeanProxy.class,
    false);
    MDBMBean.stop();
    logger.log(Level.WARNING,
    prefixLog("Message consumption suspended"));
    } catch (Exception ex) {
    logger.log(Level.SEVERE,
    prefixLog("Error while initializing JMX Server connection"),
    ex);
    throw new EJBException("Error while initializing JMX Server connection",
    ex);
    } else {
    logger.log(Level.WARNING,
    prefixLog("No AutoShutdown. property=false"));
    * Called when the server no longer wants to keep this MDB instance.
    * Closes the connection and statement objects created in <code>ejbCreate</code>.
    public void ejbRemove() {
    try {
    cleanup();
    } catch (Throwable t) {
    logger.log(Level.SEVERE,
    prefixLog("Error in ejbRemove(): " + t.getMessage()));
    /* Cleanup resources cleanly */
    private void cleanup() {
    logger.log(Level.INFO, prefixLog("TenneTMDB.cleanup() called."));
    // m_dsService = null;
    // m_dsCall = null;
    private String prefixLog(String logText) {
    String logPrefix = "%" + m_app + ": ";
    //System.out.println(logPrefix + logText);
    return logPrefix + logText;
    private void logCause(Throwable e, LogLevel logLevel) {
    int i = 0;
    String causeStr;
    Throwable exception = e.getCause();
    while (exception != null) {
    i++;
    causeStr = "Cause " + i + ": " + exception.getMessage();
    switch (logLevel) {
    case INFO:
    logger.log(Level.INFO, prefixLog(causeStr));
    break;
    case WARN:
    logger.log(Level.WARNING, prefixLog(causeStr));
    break;
    case ERROR:
    logger.log(Level.SEVERE, prefixLog(causeStr));
    exception = exception.getCause();
    }

  • How do you call a java class from the main method in another class?

    Hi all,
    How do you call a java class from the main() method in another class? Assuming the two class are in the same package.
    Thanks
    SI
    Edited by: okun on May 16, 2010 8:40 PM
    Edited by: okun on May 16, 2010 8:41 PM
    Edited by: okun on May 16, 2010 8:47 PM

    georgemc wrote:
    To answer your impending question, either the method you're calling has to be static, or you need an instance of that other class to invoke it against. Prefer the latterAnd to your impending question after that: no, don't use the Singleton pattern.

  • In EPM10, how do you call/reference a dynamic range from a macro.

    Hi Gurus
    In EPM10, [we are using SP16,P1], how do you call/reference a dynamic range from a macro.
    EG, in the BPC input sheet below, we have BPC reports ‘000’,’001’,’002’. For report ‘001’,users are able to select from diffent versions which each have different number of months. In the forecast version below, there are 7 months. We require a macro to select & delete f'cast data content of report ‘002’, there after we will manipulate it via the macro and return it. However, standard excel named ranges don’t work per BPC7.x and don’t dynamically expand.
    The macro code in 7.x was:
    Range(“REPORT1_RANGE”).Select >> Does any oneknow the replacement in EPM10 please?

    The following macro which accesses API's looks like it would help to define the report range:
    Sub TopLeftCell()
    Range("c26").Select
    Application.Run "EPMExecuteAPI", "GetDataTopLeftCell", "", "Sales Planning", "001"
    End Sub
    Anybody able to assist with the syntax of this macro..it currently runs without error, however does not return any result?? Note:
    * the parameter ''" relates to the text which i believe can be left if using macros
    *the parameter "Sales Planning" is my worksheet name
    *the parameter "001" is my report definition.
    I was hoping to return the result back to cell C26. Thanks All

  • Can I call an EJB from the database?

    Hi,
    I've just spent the last few days attempting to call an EJB from a stored procedure in a 10g database (and still haven't succeeded).
    Now having spent hours searching the web (and this forum) for any successful examples (so far I have found none) I thought I'd add a message to see if there is anybody out there who has done this successfully. If so can you please provide me some details on how to do this?
    Alternatively, I'd appreciate any input on how I can overcome my current hurdle in attempting to do this myself.
    Here's how far I've got in my attempt:
    I have a simple stateless session bean deployed to both Oracle 10gAS (a standalone OC4J container in 10.1.3) and to Weblogic 9. I have a client java class that calls a method on this bean and displays some ouput if successful. This all works from a standalone JVM (version 1.4) on both Weblogic and 10gAS.
    I then tried to load the required libraries for Weblogic onto the database (namely the Weblogic.jar file). This resulted in the addition of some 32,000 odd objects of which 30,000 odd could not be resolved. I figured a lot of these may be down to JVM version issues (I believe that Weblogic 9 uses the 1.5 JRE) so I decided to put the Weblogic test on the back burner for now and just use the Oracle app server.
    The tests with the Oracle app server looked promising. I only needed a handful of libraries to be loaded onto the database and all the relevant classes required for my test client had resolved (including the initial context factory required to do the jndi lookup of the bean). After granting all the permissions I believed I needed I'd got to the point where I could do a jndi lookup of the EJB; but when I tried to create an instance of the beans remote interface I got the following error:
    java.security.AccessControlException: the Permission (java.lang.RuntimePermission getClassLoader) has not been granted to ProtectionDomain (file:generated/by/proxy <no certificates>)
    com.evermind.net.DynamicClassLoader@612d9d34
    <no principals>
    java.security.Permissions@eb0f3c1a (
    (java.util.PropertyPermission java.version read)
    (java.util.PropertyPermission java.vm.name read)
    (java.util.PropertyPermission java.vm.vendor read)
    (java.util.PropertyPermission os.name read)
    (java.util.PropertyPermission java.vendor.url read)
    (java.util.PropertyPermission java.vm.specification.vendor read)
    (java.util.PropertyPermission java.specification.vendor read)
    (java.util.PropertyPermission os.version read)
    (java.util.PropertyPermission java.specification.name read)
    (java.util.PropertyPermission java.class.version read)
    (java.util.PropertyPermission file.separator read)
    (java.util.PropertyPermission java.vm.version read)
    (java.util.PropertyPermission os.arch read)
    (java.util.PropertyPermission java.vm.specification.name read)
    (java.util.PropertyPermission java.vm.specification.version read)
    (java.util.PropertyPermission java.specification.version read)
    (java.util.PropertyPermission java.vendor read)
    (java.util.PropertyPermission path.separator read)
    (java.util.PropertyPermission line.separator read)
    (java.net.SocketPermission localhost:1024- listen,resolve)
         at java.security.AccessControlContext.checkPermission(AccessControlContext.java:280)
         at java.security.AccessController.checkPermission(AccessController.java:429)
         at java.lang.SecurityManager.checkPermission(SecurityManager.java:528)
         at oracle.aurora.rdbms.SecurityManagerImpl.checkPermission(SecurityManagerImpl.java:192)
         at java.lang.Thread.getContextClassLoader(Thread.java:1203)
         at com.evermind.server.rmi.RMICall.<init>(RMICall.java:36)
         at com.evermind.server.rmi.RmiCallQueue.createCall(RmiCallQueue.java:33)
         at com.evermind.server.rmi.RMIClientConnection.createQueuedCall(RMIClientConnection.java:592)
         at com.evermind.server.rmi.RMIClientConnection.writeRequest(RMIClientConnection.java:581)
         at com.evermind.server.rmi.RMIClientConnection.sendMethodInvocationRequest(RMIClientConnection.java:426)
         at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:415)
         at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
         at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
         at __Proxy0.create(Unknown Source)
         at com.axiomsystems.test.client.TestDBClient.test(TestDBClient.java:76)
    Has anybody come across this before? If so can they help?
    If not has anybody out there actually managed to call an EJB method (without going via an RMI server/Servlet/or any other proxy).
    Any help in this matter would be greatfully appreciated.
    Cheers,
    Anand.

    Sure, here's the code. It's what JDev generates automatically but I have seperated some things into several diffrent lines so I could experiment easier.
    final Context context = getInitialContext();
    Object o=context.lookup( "SessionEJB4" );
    Object l= PortableRemoteObject.narrow( o, SessionEJB4Home.class );
    final SessionEJB4Home sessionEJB4Home = (SessionEJB4Home)l;
    SessionEJB4 sessionEJB4 = sessionEJB4Home.create();
    String ret=( sessionEJB4.hello( ) );
    As I mentioned, for this I have used EJB2.1 bean, because I had same problems with EJB3.0, so I tried earlier versions of Java to make sure that is not the problem.
    hello() method just returns string "hello".
    Of course, this works in standalone client that is not loaded into database.
    Now, I loaded all the jars mentioned in this thread, using loadjava options -v -resolve, and I loaded client using options -v -resolve -genmissing . Select query on user objects in database shows that client class and relevant classes are all valid.
    Then I created stub and ran it. First it stopped throwing exception ORA-29532: Java call terminated by uncought Java exception: Java.lang.NoClassDefFoundError.
    Method I try to run returns String value which is hello message if it works fine, else it prints the part of the stack trace. In this case, after p[revious error, When I try to run it again, i get return from the method :
    Lookup error: java.lang.NoClassDefFoundError; nested exception is:
         java.lang.NoClassDefFoundError
    com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:89)
    com.evermind.server.rmi.RMIClientConnection.waitForJndiResponse(RMIClientConnection.java:371)
    com.evermind.server.rmi.RMIClientConnection.lookup(RMIClientConnection.java:179)
    com.evermind.server.rmi.RMIClient.lookup(RMIClient.java:283)
    com.evermind.server.rmi.RMIClientContext.lookup(RMIClientContext.java:51)
    javax.naming.InitialContext.lookup(InitialContext.java:347)
    simpleejbproject.EJB4Client.hello(EJB4Client.java:35)
    Of course, regular version of the client I run frokm command line works fine.
    So I'm kind of a stuck here. I followed all directions, tried it on oracle 9 and oracle 10 DB, the problems remain the same. Am I missing something here?
    Thanks
    Just to add, getInitialContext()
        private static Context getInitialContext() throws NamingException {
            Hashtable env = new Hashtable();
            // Oracle Application Server 10g connection details
            env.put( Context.INITIAL_CONTEXT_FACTORY, "oracle.j2ee.rmi.RMIInitialContextFactory" );
            env.put( Context.SECURITY_PRINCIPAL, "oc4jadmin" );
            env.put( Context.SECURITY_CREDENTIALS, "manager1" );
            env.put(Context.PROVIDER_URL, "opmn:ormi://mserv:4005:home/TestEjb4");
            return new InitialContext( env );
    It goes withouth any exceptions.
    Message was edited by:
    user510152

  • Calling an EJB from jsp - ServletException

    I am unable to call an EJB from jsp, unless I put the actuall classes of
              the EJB into the classpath. Is this the right way to do it?
              The exception is:
              Servlet failed with ServletException
              javax.servlet.ServletException: Servlet class: 'jsp_servlet._result'
              could not be loaded - the requested class wasn't found in the
              classpath:
              '/local/apps/bea/wlserver6.0/config/gmodomain/applications/.wl_temp_do_not_delete/wl_local_comp34107.war:/local/apps/bea/wlserver6.0/./config/gmodomain/applications/.wl_temp_do_not_delete/WEB-INF/_tmp_war_gmo_gmo_webwar:/local/apps/bea/wlserver6.0/config/gmodomain/applications/.wl_temp_do_not_delete/WEB-INF/_tmp_war_gmo_gmo_webwar'
              at
              weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:532)
              at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:191)
              at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:148)
              at
              weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:306)
              at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:208)
              at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:246)
              at
              weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:1265)
              at
              weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:1622)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              where result.jsp is the jsp page calling the EJB. I did an import of the
              EJB classes in the jsp.
              like i said, it works if I put the bean classes in the classpath. But is
              it right?
              if I have these in the exploded format, do I need to put anything in the
              application web.xml under:
              wlserver6.0/config/gmodomain/applications/DefaultWebApp_gmo/WEB-INF ?
              redhat 6.2, wl6.0sp1
              here are the xml files:
              web.xml:
              <?xml version="1.0"?>
              <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
              2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
              <!--
              $Id: web.xml,v 1.2 2001/03/14 22:23:03 jeff Exp $
              $Source:
              /usr/local/cvsroot/JUnitEE/example/components/web-war/WEB-INF/web.xml,v
              $
              -->
              <web-app>
              <display-name>My Web Application</display-name>
              <description>none</description>
              <ejb-ref>
              <ejb-ref-name>MyWeb</ejb-ref-name>
              <ejb-ref-type>Session</ejb-ref-type>
              <home>com.blah.ejb.myweb.WyWebHome</home>
              <remote>com.blah.ejb.myweb.MyWeb</remote>
              </ejb-ref>
              </web-app>
              weblogic.xml:
              <!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web
              Application 6.0//EN"
              "http://www.bea.com/servers/wls600/dtd/weblogic-web-jar.dtd">
              <weblogic-web-app>
              <jsp-descriptor>
              <jsp-param>
              <param-name>
              pageCheckSeconds
              </param-name>
              <param-value>
              1
              </param-value>
              </jsp-param>
              <jsp-param>
              <param-name>
              verbose
              </param-name>
              <param-value>
              true
              </param-value>
              </jsp-param>
              <jsp-param>
              <param-name>compileCommand</param-name>
              <param-value>/local/apps/jdk1.3.0_02/bin/javac</param-value>
              </jsp-param>
              </jsp-descriptor>
              <reference-descriptor>
              <ejb-reference-description>
              <ejb-ref-name>MyWeb</ejb-ref-name>
              <jndi-name>MyWeb</jndi-name>
              </ejb-reference-description>
              </reference-descriptor>
              </weblogic-web-app>
              thanks,
              Gary
              

    Did you package your JSPs in a WAR and your EJBs in a JAR and package the
              WAR and JAR in an EAR? That is how to do it in 6.0. Works well.
              Peace,
              Cameron Purdy
              Tangosol, Inc.
              http://www.tangosol.com
              +1.617.623.5782
              WebLogic Consulting Available
              "gmo" <[email protected]> wrote in message
              news:[email protected]...
              > I am unable to call an EJB from jsp, unless I put the actuall classes of
              > the EJB into the classpath. Is this the right way to do it?
              > The exception is:
              > Servlet failed with ServletException
              > javax.servlet.ServletException: Servlet class: 'jsp_servlet._result'
              > could not be loaded - the requested class wasn't found in the
              > classpath:
              >
              '/local/apps/bea/wlserver6.0/config/gmodomain/applications/.wl_temp_do_not_d
              elete/wl_local_comp34107.war:/local/apps/bea/wlserver6.0/./config/gmodomain/
              applications/.wl_temp_do_not_delete/WEB-INF/_tmp_war_gmo_gmo_webwar:/local/a
              pps/bea/wlserver6.0/config/gmodomain/applications/.wl_temp_do_not_delete/WEB
              -INF/_tmp_war_gmo_gmo_webwar'
              >
              > at
              >
              weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.jav
              a:532)
              >
              > at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:191)
              >
              > at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:148)
              >
              > at
              >
              weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:30
              6)
              >
              > at
              >
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
              :208)
              >
              > at
              >
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
              :246)
              >
              > at
              >
              weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
              ntext.java:1265)
              >
              > at
              >
              weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
              :1622)
              >
              > at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
              >
              > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              >
              > where result.jsp is the jsp page calling the EJB. I did an import of the
              > EJB classes in the jsp.
              > like i said, it works if I put the bean classes in the classpath. But is
              > it right?
              > if I have these in the exploded format, do I need to put anything in the
              > application web.xml under:
              > wlserver6.0/config/gmodomain/applications/DefaultWebApp_gmo/WEB-INF ?
              >
              > redhat 6.2, wl6.0sp1
              >
              > here are the xml files:
              > web.xml:
              >
              > <?xml version="1.0"?>
              > <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
              > 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
              >
              > <!--
              > $Id: web.xml,v 1.2 2001/03/14 22:23:03 jeff Exp $
              > $Source:
              > /usr/local/cvsroot/JUnitEE/example/components/web-war/WEB-INF/web.xml,v
              > $
              > -->
              >
              > <web-app>
              > <display-name>My Web Application</display-name>
              > <description>none</description>
              > <ejb-ref>
              > <ejb-ref-name>MyWeb</ejb-ref-name>
              > <ejb-ref-type>Session</ejb-ref-type>
              > <home>com.blah.ejb.myweb.WyWebHome</home>
              > <remote>com.blah.ejb.myweb.MyWeb</remote>
              > </ejb-ref>
              > </web-app>
              >
              > weblogic.xml:
              >
              > <!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web
              > Application 6.0//EN"
              > "http://www.bea.com/servers/wls600/dtd/weblogic-web-jar.dtd">
              > <weblogic-web-app>
              > <jsp-descriptor>
              > <jsp-param>
              > <param-name>
              > pageCheckSeconds
              > </param-name>
              > <param-value>
              > 1
              > </param-value>
              > </jsp-param>
              > <jsp-param>
              > <param-name>
              > verbose
              > </param-name>
              > <param-value>
              > true
              > </param-value>
              > </jsp-param>
              > <jsp-param>
              > <param-name>compileCommand</param-name>
              > <param-value>/local/apps/jdk1.3.0_02/bin/javac</param-value>
              > </jsp-param>
              > </jsp-descriptor>
              > <reference-descriptor>
              > <ejb-reference-description>
              > <ejb-ref-name>MyWeb</ejb-ref-name>
              > <jndi-name>MyWeb</jndi-name>
              > </ejb-reference-description>
              > </reference-descriptor>
              > </weblogic-web-app>
              >
              > thanks,
              >
              > Gary
              >
              >
              

  • How can i access the EJB from a Webdynpro

    Dear all,
    How can i access the ejb , from a webdynpro?.
    Is there any way to do that?.
    I want to write the entire code (business functions) within the EJB and i wan to access the entire methods from a WebDynpro Application.This is the situation.
    Please help me to , resolve this problem.(Here im using JDBC Connection .. etc.).
    I want to do the basic connection setting's and data retrieval part within the EJB and use that within the WebDynpro..
    how can i seperate this two(i mean, i want to seperate the JDBC connections and WebDynpro,i dont want to hard code any connection parameters within the webdynpro code)
    So that i want use that saet of particular function's in many webdynpro applications..
    (i dont need any help regarding webservice way.)
    If anyone can , please help me..
    I tried that javabean class , manifest file , that way (importing javabean model).
    but im getting errors.
    I cant properly utilize that..
    So please help me with steps regarding that,,
    for javabean
    and if any , for EJB also..
    with regards
    Kishor.G

    HI,
    Since webdynpros follows Model View Controller Architecture You can access EJBs in webdynpro(views/frontend) infact to connec to database uding JDBC you have to utilise EJB ( opening connection to database closing, and other Business functionality).See this link
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/unkown/web dynpro tutorial and sample applications.faq#q-7
    <b>How to access the Car Rental Web Service?</b>
    Regards,
    RK

  • What is ChangeWatcher? How do you stop Change Watcher from listening to a propertyChangeEvent?

    What is ChangeWatcher? How do you stop Change Watcher from listening to a propertyChangeEvent?

    ChangeWatcher is a class used to handle the change of a specific property. To stop watching that property, simply call unwatch function as follow:
    var cw:ChangeWatcher = ChangeWatcher.watch( this, "propertyName", changeHandler );
    cw.unwatch();

  • Urgent!!!!How to deploy only an EJB from Weblogic to oc4j.

    Hi
    How can i deploy only EJB from Weblogic into oc4j without any web application or client coming into pitcture as my client access bean remotely....
    regards,
    Sapthapathi

    If you are migrating from ejb1.1->ejb1.1 you shouldn't have many changes - your ejb-jar.xml file should be the same (I assume you are still talking about ejbs). Once you pull over the base ejb - then if you want to, mess around with the automatically generated orion-ejb-jar.xml file. Obviously - those are all app server specific. I go back and forth between wls6.1 and oc4j all the time. When going from wls5.1 to oc4j - what particular issues do you run into. What do you mean, in particular, by configuration changes?
    Curious -
    Ray
    hi,
    EJBs and other applications can be migrated from weblogic to oc4j but many changes are required.These changes are mainly configuration changes rather than code changes.Infact there are many problems in effect while migrating and delloyment.Hope oracle is a bit more attentive to this issue.
    regards,
    chennai

Maybe you are looking for