Create a entity using a session bean in web dynpro

Hi.
I want to create an entity bean object trough an EJB session bean in web dynpro, e.g using a form in a WD application filled in by a user.
I understand how to display a list of entity beans through a session bean and a table, but I don't understand how to create (or edit or remove) such information.
My session beans look like this:
@Stateless
public class MyObjectBean implements MyObjectLocal {
     @PersistenceContext(name = "MyObject", unitName="ProjectPU")
     public EntityManager em;
     public void create(MyObject myObject) {
          em.persist(myObject);
     public void edit(MyObject myObject) {
          em.merge(myObject);
     public void remove(MyObject myObject) {
          em.remove(em.merge(myObject));
     public MyObject find(Integer id) {
          return em.find(MyObject.class, id);
     @SuppressWarnings("unchecked")
     public List<MyObject> findAll() {
          return em.createNamedQuery("MyObject.findAll").getResultList();
So the model class would be called Request_MyObjectLocal_create.
I attempted to use [this|http://help.sap.com/saphelp_nwce10/helpdata/en/45/dd45e4bc295595e10000000a1553f7/frameset.htm] help file but I find the answer (step 17) quite unclear.
Help is greatly appreciated!
Vincent.

I've just found the solution from Steve Muench weblog, always useful by the way!
You can find the solution at this link http://radio.weblogs.com/0118231/stories/2004/05/07/handcodingDynamicDiscoveryOfEjbdeployedAppmodule.html
In summary, we need to use the class com.evermind.server.rmi.RMIInitialContextFactory, which supports dynamic lookup, and implement the lookup ourselves.
The code I've written to lookup the service is listed below:
public static ApplicationModule getAppModuleManutencao() {
try {
Context ctx = getContext();
ManutencaoFacadeHome home = (ManutencaoFacadeHome) ctx.lookup(EJB_MANUTENCAO_BEAN_NAME);
ApplicationModule am = ApplicationModuleProxy.create(home, null);
return am;
} catch (NamingException nex) {     
nex.printStackTrace();
return null;
private static InitialContext getContext() {   
try {     
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
env.put(Context.SECURITY_PRINCIPAL, "admin");
env.put(Context.SECURITY_CREDENTIALS, "welcome");
env.put(Context.PROVIDER_URL, "opmn:ormi://dsv008:OC4J_dvt20/mct");
env.put(Context.SECURITY_AUTHENTICATION, "simple");
return new InitialContext(env);
}catch (NamingException e) {     
e.printStackTrace();
return null;
I hope this helps someone!!!
Cheers!

Similar Messages

  • May i use the session bean in the jsp

    <%@ page import="sms.EJB.*,sms.UserDetailEJB.*" %>
    <%
    if (request.getParameter("userid")!=null && request.getParameter("password") !=null && request.getParameter("userLevel")!=null)
    UserHome userHome look up...
    UserLocal userLocal;
    userLocal = userHome.create(userid,password,userlevel);
    %>
    <html>
         <head>
              <title>Insert One Page</title>
         </head>
         <body>
         <form action="/testing/insertOne.jsp">
              <h1 align="center">Insert into User Database !</h1>
              <table align="center">
                   <tr>
                        <td bgcolor ="#FFFCCC">User Name :</td>
                        <td bgcolor ="#FFFCCC"><input type="text" name="userName" size="12" maxlength="12"></td>
                   </tr>
                   <tr>
                        <td bgcolor ="#FFFCCC">Password :</td>
                        <td bgcolor ="#FFFCCC"><input type="password" name="password" size="12" maxlength="12"></td>
                   </tr>
                   <tr>
                        <td bgcolor ="#FFFCCC">User Level :</td>
                        <td bgcolor ="#FFFCCC"><input type="text" name="userLevel" size="12" maxlength="12"></td>
                   </tr>
              </table>
              <p align="center"><input type="submit" name="submit" value="add it"</p>
         </form>
         </body>
    </html>
    May i use the session bean like this, if i dont want to use the data access object
    may i use this...

    Hey it apperars to me like heero82 is using session facade and all he has to do is use session bean to make one business call on session bean. Now if u say it is not correct then i would like to know the better way to doing so.
    I can imagine one ways is use business delegate. Just make new of java class in jsp and let that java class do lookup and delegate the call to session facade.
    Let me know inpout on this
    pranav

  • Code using advisor session bean..returning of a list

    Hi,
    I am using Advisor Session Bean for classifying users instead of using pz:div
    tags. The steps are given in documentation. I wanted to know what advice.getResult()
    returns? It has been given in the API as an Object. Even in pz:div java file they
    have used this code to check if the getresult returns something ...
    Object nestedResult = advice.getResult();
    if((nestedResult instanceof List) && ((List)nestedResult).size() > 0)
    {  //belongs to segment
    My code works perfectly but I am curious to know about this code. Can anyone please
    tell me about the above given code?
    Thanx

    Assuming you are using v7.0
    This might help
    http://edocs.bea.com/wlp/docs70/dev/p13n.htm#1000231
    i dont know if this has changed in v8.1
    hth
    deepak
    "Madhu" <[email protected]> wrote:
    >
    Hi,
    I want to use the Advisor session bean directly in place of the tags
    to return
    content based on a static query and match the content to users based
    on rules
    that execute a content query. Where can I find more information on this?
    Thanx.
    Madhu

  • Using External Library in Mobile Web Dynpro Offline

    Hi all,
    i would like to use a jar in a Mobile Application for Handheld and i followed the steps from the wiki "Using External Library in Mobile Web Dynpro Offline" at
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/usingExternalLibraryinMobileWebDynpro+Offline
    >How to use External Library in Mobile Web Dynpro Offline
    >For using external jar in local deployment scenario, one can do following:
    >1. In the dc where jar has to be used, add the jar as external jar classpath entry. It can be done via <dc> > (Right-click)> properties->Java Build Path->Select "add external jar".
    >2. Do the programming using the jar.
    >3. Shut down the mobile client.
    >4. Copy the jar in the "lib" folder of mobile client installation.
    >5. Deploy the application in the IDE.
    >6. Run the application.
    >In 5, the jar will not deployed and will be picked from the lib folder during 6.
    >...
    >Note: This will work on and after SAP Net Weaver CE 7.1 SR3 with Mobile plugins from CE 7.1 SR3 (and after).
    i get a error at the deployment with the message "...package myres does not exist...":
        >echo:     C:Documents and SettingsTPCompworkspace.jdiLocalDevelopment     4CDFCC9F800D44D0F2B7FEDE7245CFB5gen_oca
          >echo:   class path:  C:Program FilesSAPIDECEeclipsepluginscom.sap.tc.ap_2.0.1.080222142948compXOCADCssap.com     cmobileocaapi\_compgendefaultpublicapilibjavasap.comtcmobileocaapi~api.jar
          >echo:   output dir:  C:Documents and SettingsTPCompworkspace.jdiLocalDevelopment     4CDFCC9F800D44D0F2B7FEDE7245CFB5classes
         >javac: Compiling 16 source files to C:Documents and SettingsTPCompworkspace.jdiLocalDevelopment     4CDFCC9F800D44D0F2B7FEDE7245CFB5classes
         >javac: ERROR: C:Documents and SettingsTPCompworkspace.jdiLocalDevelopment     4CDFCC9F800D44D0F2B7FEDE7245CFB5gen_ocacomsapdemoemployee_scserviceimplEmployeeService.java:8: package myres does not exist
         >javac: ERROR: import myres.TestA;
    there is only sap.comtcmobileocaapi~api.jar in the class path and myres.jar was not added.
    how can i fix my problem or does the steps in the wiki not work yet for SAP Net Weaver CE 7.1 SR3 with Mobile plugins from CE 7.1 SR3 ?
    Thanks,
    Ismet

    Hi,
    1) in Development Infrastructure Perspective -> rightklick in Navigator/Projekt Explorer  -> new Project  -> (Development Infrastructure)  Development Component (DC).
    NWDS generates Project Ressources e.g. the folder "libraries"
    2) copy the jars to the "libraries" folder.
    3) rightklick on the newly created Development Component (DC) ->  Development Component -> Show In ->  Development Properties -> go to the Tab "Public Parts",
    in -> "Defined Public Parts" -> klick on Button "Add" -> give a name for "Public Part" -> at "Purpose" select "Compilation" -> Finish.
    rightklick on the newly created Public Parts -> select  "Manage Entities" and select the jars you want to use -> Next -> Finish.
    4) switch to the Mobile Apps for Handhelds Perspective ->  in Development Component  select e.g. the Service Component or the UI Component ->
    rightklick ->  Development Component -> Show In ->  Development Properties -> got to Tab "Dependencies" -> klick on Button "Add"  -> under the Node MyComponents -> select the newly created Development Component with the Public Parts/jars (that was created in 1 - 3).
    thats all, now you can deploy your application
    Regards,
    Ismet

  • Use of Variants in a Web Dynpro Screen?

    Hi, 
    Is there an easy way to simulate the use of variants in a Web Dynpro screen, like in R/3 for a transaction?

    Can you give me some example for storing text files on the Java server?
    An example to manage parameters for each user, for example :
    \[ZAPPLICATION\]
    EQUIPMENT=300056
    TYPE=ZE
    PRIORITY=1
    DISPLAY=True

  • Develop forms using Adobe Forms and ABAP Web Dynpro

    Hi, 
    Could someone help me on how to learn forms development using Adobe Forms and ABAP Web Dynpro?  Any suggestion on Tutorials / Books / other helpful hints please?
    I have good knowledge of Smart Forms and used these to generate PDF Attachments via emails.
    Thanks.
    Regards
    Keshav

    http://sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/d-f/faq%20on%20interactive%20forms%20based%20on%20adobe%20software.faq

  • Deploy Error when using Stateful Session Bean inside Webdynpro

    Hi,
    I'm trying to create a webdynpro project that uses a stateful session bean
    I have created DC's for a EJB Module project, Enterprise Application and Webdynpro component. Created the bean, built it, added it's package to the public part, added the EJB Module to the EAR project. Built the EAR project. Added the EJB Module project and Enterprise Application project as a used DC in the Webdynpro DC.
    In the Webdynpro DC I added com.sap.archive-packaging.default.update-descriptors=true in the build.properties file of the cfg directory. (using the navigator view) That resolved an error while building it.
    Deployed the Enterprise Application DC without problems.
    Tried to deploy the Webdynpro DC but I get the following error:
    Jun 16, 2008 9:40:46 AM /userOut/deploy (com.sap.ide.eclipse.sdm.threading.DeployThreadManager) [Thread[Deploy Thread,5,main]] WARNING:
    [012]Deployment finished with warning
    Settings
    SDM host : 10.64.36.74
    SDM port : 50018
    URL to deploy : file:/C:/DOCUME~1/JESCHA~1/LOCALS~1/Temp/temp59822company.nl~projempactcmp.ear
    Result
    => deployed with warning : file:/C:/DOCUME~1/JESCHA~1/LOCALS~1/Temp/temp59822company.nl~projempactcmp.ear
    Finished with warnings: development component 'projempactcmp'/'company.nl'/'local'/'20080616094022':Caught exception during application startup from SAP J2EE Engine's deploy service:java.rmi.RemoteException: Error occurred while starting application company.nl/projempactcmp and wait. Reason: Clusterwide execption: server ID 6060950:<--Localization failed: ResourceBundle='com.sap.engine.services.deploy.DeployResourceBundle', ID='com.sap.engine.services.deploy.container.DeploymentException: <--Localization failed: ResourceBundle='com.sap.engine.services.deploy.DeployResourceBundle', ID='Failed implicit start for company.nl/projempejb : Unknown state(5)', Arguments: []--> : Can't find resource for bundle java.util.PropertyResourceBundle, key Failed implicit start for company.nl/projempejb : Unknown state(5)', Arguments: []--> : Can't find resource for bundle java.util.PropertyResourceBundle, key com.sap.engine.services.deploy.container.DeploymentException: <--Localization failed: ResourceBundle='com.sap.engine.services.deploy.DeployResourceBundle', ID='Failed implicit start for company.nl/projempejb : Unknown state(5)', Arguments: []--> : Can't find resource for bundle java.util.PropertyResourceBundle, key Failed implicit start for company.nl/projempejb : Unknown state(5) (message ID: com.sap.sdm.serverext.servertype.inqmy.extern.EngineApplOnlineDeployerImpl.performAction(DeploymentActionTypes).REMEXC)
    Deployment exception : Got problems during deployment
    Does anyone know what this error means and how to resolve it. I searched the forum but only found errors that look like this relating to XI not to Webdynpro.......
    Thansk,
    Jeschael
    Edited by: J.V. Lebbink on Jun 17, 2008 6:52 AM

    Default is 30mts.
    This is done as a parameter in orion-ejb-jar.xml. Please look at the EJB Guide at http://otn.oracle.com/docs/products/ias/doc_library/903doc_otn/generic.903/a97677/dtdxml.htm#634197 for details
    regards
    Debu

  • Using BC4J Session Bean in OC4J 10.1.3 with dynamic ports

    Hi Folks!
    I've benn having trouble connecting my BC4J Session Bean to an Oracle 10gAS R3 server instance tha uses dynamic ports.
    After migrating a BC4J/Struts/JSP application from 9iAS to 10gAS R3, I'm trying to connect from a client application to my instace in the server. The problem is that the instance uses dynamic ports, and whenever I deploy my application to the server, I've got to update the port number in the bc4j.xcfg file in the client application, wich has became impossible to maintain.
    When I connect to an EJB in the same server, I use the instance name instead of the port number. However, when I do the same with BC4J, I get the following exception:
    javax.naming.NamingException [Root exception is java.lang.NumberFormatException: For input string: "OC4J_dvt20"]
         at oracle.jbo.client.remote.ejb.ias.AmHomeImpl.remoteLookup(AmHomeImpl.java:131)
         at oracle.jbo.client.remote.ejb.ias.AmHomeImpl.getRemoteApplicationModuleHome(AmHomeImpl.java:42)
         at oracle.jbo.client.remote.ejb.AbstractApplicationModuleHomeImpl.lookupUsingPlatformContext(AbstractApplicationModuleHomeImpl.java:82)
         at oracle.jbo.client.ejb.ApplicationModuleHomeImpl.<init>(ApplicationModuleHomeImpl.java:52)
         at oracle.jbo.client.remote.ejb.AbstractApplicationModuleHomeImpl.<init>(AbstractApplicationModuleHomeImpl.java:35)
         at oracle.jbo.client.remote.ejb.ias.AmHomeImpl.<init>(AmHomeImpl.java:35)
         at oracle.jbo.client.remote.ejb.ias.InitialContextImpl.createJboHome(InitialContextImpl.java:28)
         at oracle.jbo.common.JboInitialContext.lookup(JboInitialContext.java:77)
         at javax.naming.InitialContext.lookup(InitialContext.java:347)
         at oracle.jbo.common.ampool.DefaultConnectionStrategy.createApplicationModule(DefaultConnectionStrategy.java:136)
         at oracle.jbo.common.ampool.DefaultConnectionStrategy.createApplicationModule(DefaultConnectionStrategy.java:80)
         at oracle.jbo.common.ampool.ApplicationPoolImpl.instantiateResource(ApplicationPoolImpl.java:2468)
         at oracle.jbo.pool.ResourcePool.createResource(ResourcePool.java:536)
         at oracle.jbo.common.ampool.ApplicationPoolImpl.prepareApplicationModule(ApplicationPoolImpl.java:2094)
         at oracle.jbo.common.ampool.ApplicationPoolImpl.doCheckout(ApplicationPoolImpl.java:1961)
         at oracle.jbo.common.ampool.ApplicationPoolImpl.useApplicationModule(ApplicationPoolImpl.java:2793)
         at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:453)
         at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:424)
         at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:419)
         at oracle.jbo.client.Configuration.getApplicationModule(Configuration.java:1546)
         at oracle.jbo.client.Configuration.createRootApplicationModule(Configuration.java:1504)
         at oracle.jbo.client.Configuration.createRootApplicationModule(Configuration.java:1476)
         at pkg.TesteEjbMCT.findTLS(TesteEjbMCT.java:98)
         at pkg.TesteEjbMCT.main(TesteEjbMCT.java:51)
    My question is: is there a way to configure my bc4j.xcfg, or another way to connect, in order to skip the use of the port number? Or a way to get the port number from the server before I connect?
    Thanks in advance!!!

    I've just found the solution from Steve Muench weblog, always useful by the way!
    You can find the solution at this link http://radio.weblogs.com/0118231/stories/2004/05/07/handcodingDynamicDiscoveryOfEjbdeployedAppmodule.html
    In summary, we need to use the class com.evermind.server.rmi.RMIInitialContextFactory, which supports dynamic lookup, and implement the lookup ourselves.
    The code I've written to lookup the service is listed below:
    public static ApplicationModule getAppModuleManutencao() {
    try {
    Context ctx = getContext();
    ManutencaoFacadeHome home = (ManutencaoFacadeHome) ctx.lookup(EJB_MANUTENCAO_BEAN_NAME);
    ApplicationModule am = ApplicationModuleProxy.create(home, null);
    return am;
    } catch (NamingException nex) {     
    nex.printStackTrace();
    return null;
    private static InitialContext getContext() {   
    try {     
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
    env.put(Context.SECURITY_PRINCIPAL, "admin");
    env.put(Context.SECURITY_CREDENTIALS, "welcome");
    env.put(Context.PROVIDER_URL, "opmn:ormi://dsv008:OC4J_dvt20/mct");
    env.put(Context.SECURITY_AUTHENTICATION, "simple");
    return new InitialContext(env);
    }catch (NamingException e) {     
    e.printStackTrace();
    return null;
    I hope this helps someone!!!
    Cheers!

  • Session bean as web service using JAXB

    Hi all,
    can anybody answer my question:
    I have created java classes from XSD files using JDeveloper JAXB compilation. Is it possible to use these classes as parameters for webservice created as ejb3 session bean?
    I'have tried but got this error when invoked web service method:
    <env:Body>
    <env:Fault>
    <faultcode>env:Client</faultcode>
    <faultstring>Caught exception while handling request: deserialization error: java.lang.NullPointerException</faultstring>
    </env:Fault>
    </env:Body>
    </env:Envelope>
    thanks,
    Aigars

    Hi Torstein,
    <i>Seems to me that the problem is related to the msg sent to AE:
    "HTTP response contains status code 401 with the description Unauthorized XML tag Envelope missing in SOAP message header (SAP XI Extension)"
    </i>
    According to you, the problem occurs within the SOAP envelope. Does your incoming SOAP message looks like the one below here?
    If that's not the case, then make sure your SOAP/Web Service client is sending a valid SOAP envelope/request (like the sample below) to XI.
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    <!--  Inbound Message -->
    <SOAP:Envelope xmlns:SOAP='http://schemas.xmlsoap.org/soap/envelope/'>
    <SOAP:Header/>
    <SOAP:Body>
    <ns1:WebServiceRequest xmlns:ns1='http://company.com/xi/webservice/myws' SOAP:actor='http://schemas.xmlsoap.org/soap/encoding/' xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
    <Customer xsi:type='xsd:string'>000025</Customer>
    <CompanyCode xsi:type='xsd:string'>BE01</CompanyCode>
    <KeyDate xsi:type='xsd:string'>20050310</KeyDate>
    <Selection>
    <OpenItems xsi:type='xsd:string'>X</OpenItems>
    <ClearItems xsi:type='xsd:string'></ClearItems>
    <GLItems xsi:type='xsd:string'></GLItems>
    <Dunning>
    <From xsi:type='xsd:string'>A</From>
    <To xsi:type='xsd:string'>Z</To>
    </Dunning>
    </Selection>
    </ns1:WebServiceRequest>
    </SOAP:Body>
    </SOAP:Envelope>
    Cheers,
    R.

  • Transaction using stateful session bean.

    All,
    I was implementing "Transaction" part using statefull session(trying to understand how transaction work).
    I created a Statefull session bean, here in one method create 2 sql queries
    query1:update Employees set LastName='newname' where EmployeeID = 9
    query2:update Customers set CompanyName = 'newname Inc.' ContactName = 'Maria Anders'
    "query1" works fine, but "query2" is not correct(syntax error) hence will not be executed. This will throw a SQLException.
    According to EJBspec, rollback will happen if there is a system exception. And I guess SQLException is systemexception.
    But when I query "Employees" table, I get the data updated through the "query1".
    What I was excepting was the first query which was executed should have rolled back because the second query has thrown a SQLException.
    I tried using ContainerManaged transaction and BeanManaged transaction.
    But in both cases transaction is not getting rolled back.
    I have tried with REQUIRED and REQUIRESNEW attributes for container managed transactions with Isolation level as Read Commited.
    Is my understanding correct?
    TIA,
    Vijay

    Tried using Bean managed transactions but with the same result. Given below is the sample code.
    UserTransaction uts = null;
    try {
    uts = (UserTransaction)(ctx.getUserTransaction());
    uts.begin();
    Connection con = null;
    con = getCountConnection();
    PreparedStatement ps = con.prepareStatement(sqlselectUserId);
    ps.executeUpdate();
    PreparedStatement ps1 = con.prepareStatement(sqlselectUserDetails);
    ps1.executeUpdate();
    uts.commit();
    catch(SQLException e) {
         uts.rollback();

  • Please help on create files and directories in Session Bean

    Hi,
    I am trying to create files and directories at run time from a session bean. Since EJB 2.0 prohibit the use of the java.io.* package. The only thing that I know how is to use the URLConnection. After getting a connection through URL. I may use the getOutputStream() to get a output stream to write to the HTTP server. But the getOutputStream() returns an OutputStream object which is one of the package in the java.io package. Since I need to create file and directory, I need to use the FileOutputStream that is also under the java.io package.
    Can someone give me a hint what should I do. Here is a directory and the file that I may need to create;
    Directory1/Drictory2/myFiles.au
    Thank you in advance, your help is greatly appreciated.

    From 24.1.2 (Programming Restrictions) of the EJB 2.0 spec:
    � An enterprise bean must not use the java.io package to attempt to access files and directories in the file system.
    The file system APIs are not well-suited for business components to access data. Business components should use a resource manager API, such as JDBC, to store data.
    You might want to look at the File System Service Provider in JNDI for an alternative approach. I have never used an FSSP though.

  • How create  EJB 2.1 Stateful Session Bean in a EJB 3.0 Session Bean

    Hi All,
    We have been developing on EJB 2.1. We are now adding a module on EJB 3.0.
    How can we "create" a stateful session bean with create method signature similar to create(String id)?
    We have tried
    // this is the remote interface
    @EJB AddressBean abean;
    But not working
    Any help will be appreciated.

    There is no explicit create() call for EJB 3.0 session beans. It doesn't really matter though
    since you can accomplish the same thing by defining your own business method to act
    as an initializer for whatever state you'd like. E.g.
    @Remote
    public interface FooInterface {
    public void initialize(String id);
    // ... other business methods
    @EJB FooInterface fooRef;
    fooRef.initialize("foo");
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Test web service proxy using EJB session bean client...

    Hello!
    I am following this blog /people/abdelmorhit.elrhazi/blog/2009/10/30/how-to-consume-an-inbound-backend-web-service-in-nwdsjboss-environment to create a EJB session bean client to access the web service proxy...
    The blog is not very clear. Where should I be deploying the web service proxy and the EJB session bean (web service client) ? on the PI 7.1 ?
    How to find out the URL for the wsdl ?
    Thanks

    > The blog is not very clear. Where should I be deploying the web service proxy and the EJB session bean (web service client) ? on the PI 7.1 ?
    "To deploy your web service proxy and session bean, right click on your JBoss server in the Servers view, and click on Add Remove Projects, add you ear file and click finish."
    You need a JBoss server.

  • Using local session bean interface from web container using EJB 3.0

    Hi,
    How can you use a local session bean interface from Java (rather than data controls) in a web container using EJB 3.0?
    I can use a remote interface by looking up InitialContext, but I can't find a local interface this way (even from another session EJB). I can use a local interface from an EJB using annotation "EJB", but as I understand, this is not available in the web container.
    If I try to add an ejb-jar.xml file, these seems to mess up by project...
    Hope you can help.
    Roger

    The portable way to retrieve an EJB reference in Java EE is to either inject it or look it up via the
    component's private naming environment. The simplest way is :
    @EJB
    private DocumentManager dm;
    The global JNDI name is only used as an implementation specific way to uniquely assign an
    identifier to a specific Remote EJB. It's best for this not to appear directly in the source code.
    There's more on global JNDI names in our EJB FAQ :
    https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html
    The alternative to annotations is to use an ejb-ref to declare the ejb dependency. The ejb-ref
    is declared in the standard deployment descriptor corresponding to the component doing the
    lookup. Each ejb-ref has an ejb-ref-name, e.g. <ejb-ref-name>DM_ref</ejb-ref-name>
    The code looks up the ejb-ref-name relative to the java:comp/env namespace to retrieve the
    EJB reference.
    DocumentManager dm = (DocumentManager)
    new InitialContext().lookup("java:comp/env/DM_ref");

  • How to realize timeout while invoking a method in remote sesssion bean using my session bean running on wls5.1

    I am using WL5.1 SP11 on a project. I have a stateless session bean inside which
    I will invoke a method defined in another stateless session bean in a remote weblogic
    server 5.1. The performance of the remote server is very low and sometimes when
    I invoke the method through RMI, I got to wait for a long time. So I want to set
    a timeout for my session bean while doing RMI call. The only parameter I could
    find in weblogic-ejb-jar.xml is the "transaction-timeout", but even if I set transaction
    attribute for my session bean, it always block there to wait for the response
    from the remote session bean. The configuation did not work.
    Is there any other solutions to my problem? Please give me some advice if anyone
    has experience on it, Thank you very much.

    I am using WL5.1 SP11 on a project. I have a stateless session bean inside which
    I will invoke a method defined in another stateless session bean in a remote weblogic
    server 5.1. The performance of the remote server is very low and sometimes when
    I invoke the method through RMI, I got to wait for a long time. So I want to set
    a timeout for my session bean while doing RMI call. The only parameter I could
    find in weblogic-ejb-jar.xml is the "transaction-timeout", but even if I set transaction
    attribute for my session bean, it always block there to wait for the response
    from the remote session bean. The configuation did not work.
    Is there any other solutions to my problem? Please give me some advice if anyone
    has experience on it, Thank you very much.

Maybe you are looking for

  • File dialog in Forms 9i

    Although I may find the get_file_name function in the online help just like I know it from Forms 6.0 (and it worked well with that one in client-server), at runtime this wonderful function doesn't seem to do anything. Furthermore, there's no more d2k

  • Why can't I download adobe flash player in fire fox?

    Why can't I download adobe flash player in fire fox?

  • Insert values to access through checkboxes

    hi, i need to get insert values into the ms-access database through clicking checkboxes.let me tell in detail. iam writing jsp source for inserting data into the msaccess. when i insert text data type those records are inserting but, when i write che

  • Exhcange 2003 on a 2003 server to exchange 2013 on a 2012 server - problems...

    Hi I removed my 2003 exhcange server physically and installed a 2012 server with exchange 2013 on it. How do I get it to work? Where do I manage the exh 2013 server, through web interface only? It installed, and worked for a few days (after i first h

  • Oracle apps custom form

    Hi Friends I am creating one custom form in oracle apps 11.5.10.2. It has 2 buttons .If I click first (FIND) button it will select the record from custom table and it will appear according to my query.Then I will select the check box and I will click