Probleme with transaction in session beans

Hello.
i create an session bean which call enties beans.
When i execute un example first time, its correct.
when i execute for second time, the methode don't stop.
i think it is problem of transaction.
thank you

Hi,
It is impossible to answer your with the given information. When ever you are asking a question please put the relavent informatin like code and deployment descriptors. So please do post the required information.
Ashok

Similar Messages

  • Problem with JMS from session bean

     

    My guess is that in your effort to work around the
    clustering/ejb/jndi problems, you have a producer
    sending on one topic, and a consumer listening on
    another topic. You can check to see if they are the
    same destination using the (uncompiled) code snippets
    below at both the producer and consumer ends.
    import weblogic.jms.common.DestinationImpl;
    Topic topic;
    DestinationImpl destination = (DestinationImpl) topic;
    System.out.println("name = " + destination.getServerName() + "/" +
    destination.getName());
    System.out.println("back-end id = " + destination.getBackEndId());
    System.out.println("destination id = " + destination.getDestinationId());
    _sjz.
    "Malcolm Robbins" <[email protected]> wrote in message
    news:[email protected]...
    >
    This was also posted to the EJB newsgroup and was asked to post the secondissue
    here. Please focus on the second issue, but the first providesbackground.
    >
    >
    I have discovered two significant problems in WLS6.0 with JNDi and JMSthat do
    not occur in the Sun Reference implementation (1.3 Beta).
    Attached is some code you can try to see the problem.
    I have developed a JmsClient that simply looks up a session bean andpasses it
    a string to publish. The session bean is meant to publish to a JMS topic.
    However I have discovered two problems:
    1) In teh ejbCreate() method I look up the topic connection factory andtopic
    in JNDI. These are referenced as "java:comp/env/jms/JmsConnectionFactory"and
    "java:comp/env/jms/JmsTopic" respectively. Here's a fragment of theejb-jar
    descriptor
    <resource-ref>
    <description>The (probably durable) Topic Connection Factory to connectto</description>
    <res-ref-name>jms/JmsConnectionFactory</res-ref-name>
    <res-type>javax.jms.TopicConnectionFactory</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    <resource-env-ref>
    <description>The Jms Source Topic to publish to</description>
    <resource-env-ref-name>jms/JmsTopic</resource-env-ref-name>
    <resource-env-ref-type>javax.jms.Topic</resource-env-ref-type>
    </resource-env-ref>
    As you can see they are resource references and resoruce environmentreferences
    respectively. The weblogic-ejb-jar maps these to the real JNDI names"TopicConnectionFactory"
    amd "SchemaTopic" respectively as shown below by the fragment:
    <weblogic-ejb-jar>
    ...etc...
    <reference-descriptor>
    <resource-description>
    <res-ref-name>jms/JmsConnectionFactory</res-ref-name>
    <jndi-name>TopicConnectionFactory</jndi-name>
    </resource-description>
    <resource-env-description>
    <res-env-ref-name>jms/JmsTopic</res-env-ref-name>
    <jndi-name>SchemaTopic</jndi-name>
    </resource-env-description>
    </reference-descriptor>
    Now here's the first problem. When this is deployed the resourceenvironment
    "logical" name (JNDI linkref) for the topic is not defined. The code willhappily
    find the connection factory (presuming you've set these administeredobjects at
    the console).
    2) The second problem now arises. In the code I have ahcked it so thatwhen
    the JNDI lookup fails it tries looking up the real topic in JNDI(SchemaTopic)
    directly.
    This works and teh bean now appears to work, albeit with a directlyhardcoded
    JNDI reference in it. However, if you hook up a standard JMS consumer tothat
    topic it will not consuem the message that is published!!! While thestats clock
    up at the console the message appears to go into a black hole. I canprovdie
    a stadnard consumer if you need one.
    I have the code working fine as-is in teh Sun Reference implementation soI presume
    these are bugs with WL6.0.
    Can anyone advise workarounds and/or fix the problem?

  • General Design With Database and Session Bean Question

    I have an application I am developing where users connect to individual databases located on a server. When they login an admin table is accessed which shows what databases they have permissions to. I am then storing the connection to the database in a backing bean. Hoping to use this connection throughout the session. Is this a good practice to have a users connection left open over the session? I can't create a database pool for each individual database and each user for that database.
    If I can store that database connection in a session bean. How do I access that connection from another bean. Or from another java class? I am using Glassfish for my application server with JSF1.2. I have looked at resource injection but have not had any luck with sharing the session bean information.
    Sorry if this is a trivial question. I have been a Java developer for years. But just starting developing webapps using JSF.
    Thanks

    JuCobb2 wrote:
    I am then storing the connection to the database in a backing bean. Hoping to use this connection throughout the session. Is this a good practice to have a users connection left open over the session? No it is not. Why should you do so? Always keep the lifetime of connection, statement and resultset as short as possible.

  • Problem with mapping the Entity beans onto database tables

    Hi,
    I got a problem with mapping the Entity beans onto database tables. Here are what I did:
    First Step:
    asant capture-schema
    Second Step:
    capture-schema -driver com.pointbase.jdbc.jdbcUniversalDriver -dburl jdbc:pointbase:server://localhost/sun-appserv-samples -username pbPublic -password pbpublic -table APPLICANT -table APPLICANTSKILL -table CUSTOMER -table LOCATION -table job -table JOBSKILL -table SKILL -out build/agency.dbschema
    The first step was fine. But, in the second step, I got the error message as follow:
    using dburl:jdbc:pointbase:server://localhost/sun-appserv-samples
    using username:pbPublic
    using password:pbpublic
    using driver:com.pointbase.jdbc.jdbcUniversalDriver
    using schemaname:null
    using output file:build/agency.dbschema
    JDO71100: Failed to find a class. Verify that the class is available on your CLASSPATH
    java.lang.ClassNotFoundException: com.pointbase.jdbc.jdbcUniversalDriver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:141)
    at com.sun.forte4j.modules.dbmodel.jdbcimpl.ConnectionProvider.<init>(Co
    nnectionProvider.java:38)
    at com.sun.jdo.api.persistence.mapping.ejb.CaptureSchema.main(CaptureSch
    ema.java:130)
    at com.sun.jdo.spi.persistence.support.ejb.util.CaptureSchemaWrapper.mai
    n(CaptureSchemaWrapper.java:29)
    Thanks for your help!

    You need to add the pbclient.jar or some similar name like that, in the CalssPath.

  • Can I connect with Database using Session Bean

    Hi,
    I am new to EJB. I have small doubt.
    can I connect with Database using Session Bean.
    Regards,
    Murali.

    Double post of http://forum.java.sun.com/thread.jspa?threadID=687239&tstart=0

  • Problems with transaction CJ20N

    Hello Experts,
    I have created a tooling asset with transaction AS01 and I have some problems with transaction CJ20N.
    I would like to know how can we Link the Asset already created with the WBS by transaction CJ20N.
    Thanks
    Ferdaws

    Hi Ferdaws,
    In the asset master (AS02) you can maintain the WBS element in Time Dependent data.
    For maintaining the WBS element in asset master, first you have to make WBS element optional entry in Screen Layouts for Asset master data.
    Kindly check with this.
    Best Regards,
    Vasu.

  • Problem with Transaction-Duration Dialog

    Hello All,
    I wonder if somebody could shed a light on the problem that we're having
    with transaction-duration dialog service object. The problem is this.
    When we call the service object and its SQL statement fails (for
    example, because of constraint violation) Forte raises AbortException.
    It also clears the error stack, so we have no way to know what caused
    it, original error ("ORA -... Constraint Violation") disappears. All we
    get is this:
    USER ERROR: Access to a load balanced router member (which is a service
    object) failed for the reasons below.
    Class: qqsp_AbortTransaction with ReasonCode: SP_ER_USERABORT
    Error #: [601, 162]
    Detected at: qqdo_LbRouter::Route at 2
    Last TOOL statement: method tester.test, line 3
    Error Time: Thu Jul 2 15:56:40
    Distributed method called: SO_UmbrellaProxy.testAbortExc (object
    name
    site/sosa_sampleservice_cl0/th_testabort_cl0-bmso0x15d:0x1) from
    partition
    "TH_TestAbort_cl0_Client", (partitionId =
    DC5B2DC0-0EA9-11D2-AFD0-5F72194BAA77:0x15d:0x2, taskId =
    [DC5B2DC0-0EA9-11D2-AFD0-5F72194BAA77:0x15d.4]) in application
    "Forte_cl0", pid 74 on node AANANIEV in environment archenv
    Originator: SP_AO_XACTMGR
    Exception occurred (locally) on partition "Forte_cl0_Client",
    (partitionId
    = DC5B2DC0-0EA9-11D2-AFD0-5F72194BAA77:0x15d:0x1, taskId =
    [DC5B2DC0-0EA9-11D2-AFD0-5F72194BAA77:0x15d:0x1.16]) in
    application
    "Forte_cl0", pid 74 on node AANANIEV in environment archenv.
    USER ERROR: Your transaction was aborted
    Class: qqsp_AbortTransaction with ReasonCode: SP_ER_USERABORT
    Error #: [402, 45]
    Detected at: XactMgr.TXAbort at 1
    Error Time: Thu Jul 2 15:56:40
    Originator: SP_AO_XACTMGR
    Exception occurred (remotely) on partition
    "TH_TestAbort_cl0_Part1-router", (partitionId =
    DC5B2DC0-0EA9-11D2-AFD0-5F72194BAA77:0x15b:0x9, taskId =
    [DC5B2DC0-0EA9-11D2-AFD0-5F72194BAA77:0x15d:0x2.17]) in
    application
    "TH_TestAbort_cl0", pid 18196 on node hp9000_1 in environment
    archenv.
    Has anyone experienced this problem with "transaction-duration" service
    object? Is there any way to find out the cause of "AbortException"? It
    seems impossible to catch the AbortException on the server partition,
    looks like Forte exits right away.
    Everything works fine with "message-duration" dialog, unfortunately it
    is not an option for us because of the way our batch programs were
    designed.
    Any help is greatly appreciated.
    Alexander Ananiev
    Claremont Technology Group
    916-558-4127
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    thanks Peter for trying to help
    ok, i've narrowed down the problem, it seems that when i try and save a file onto one partition of one of my ext drives it won't save to my last save dir but if i save to another partition/drive it works ok, also if i rename the 'dodgy' partition it also seems to work ok, so somehow the name of the drive has become corrupted.
    anybody ever heard of this? or how i could fix this as it's a quite annoying because alot of my audio files are referenced on this partition, so itunes or Cubase (audio sequencer) can't find my files now.

  • Problem while calling stateless session bean method with large data

    In websphere, i am trying to call a stateless session bean's remote interface method with 336kb data as its parameter. It is taking almost 44 seconds to start executing the method in the bean. Can anyone tell me what could be the problem? Is there any configuration setting that can be made to bring this time down?
    Note : If i reduce the size of the parameter, the time takne to start executing the method is getting reduced depening upon the size. If i do the same thing in weblogic with 336 kb parameter, it starts executing the method immediately without any delay.
    Thanks in Advance
    Regards
    Harish Kumar

    hallo,
    what about your internet dialer?
    can you use it to enter via pppoe (DSL,ADSL,ATM)?
    can you send me the .exe?
    i will test it.
    if i se it work i will buy it from you if you want.
    best regards
    devlooker
    please write me to:
    [email protected]

  • Problem with transaction with Entity Beans in R2

    I had a transaction (initiated by a session bean (requires new)) that takes two entity beans (two bank accounts) and trasfer funds from one to another. It looks like the container is waiting for the transaction, i don't know, here comes the exception I get (this code used to work with a lot of simultaneous clients with R1) :
    com.evermind.server.ejb.TimeoutExpiredException: timeout expired waiting for an instance
    at com.evermind.server.ejb.DBEntityWrapperPool.getWrapperInstance(DBEntityWrapperPool.java:189)
    at com.evermind.server.ejb.DBEntityEJBHome.getWrapperInstance(DBEntityEJBHome.java:135)
    error: Remote: Database error, IO failure: com.evermind.server.rmi.OrionRemoteException: Error enlisting connection resource: javax.transaction.RollbackException: The transaction has been marked for rollback (timed out); nested exception is:
    javax.transaction.RollbackException: The transaction has been marked for rollback (timed out); nested exception is:
    com.evermind.server.rmi.OrionRemoteException: Error enlisting connection resource: javax.transaction.RollbackException: The transaction has been marked for rollback (timed out); nested exception is:
    javax.transaction.RollbackException: The transaction has been marked for rollback (timed out)
    above goes the ejb-jar.xml
    <?xml version="1.0"?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.2//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_1_2.dtd">
    <ejb-jar>
    <description>
    </description>
    <enterprise-beans>
    <session>
    <description>
    </description>
    <ejb-name>ContaFacadeEJB</ejb-name>
    <home>contacorrente.ContaFacadeHome</home>
    <remote>contacorrente.ContaFacade</remote>
    <ejb-class>contacorrente.ContaFacadeBean</ejb-class>
    <ejb-ref>
    <ejb-ref-name>ContaCorrenteEJB</ejb-ref-name>
    <ejb-ref-type>Entity</ejb-ref-type>
    <home>contacorrente.ContaCorrenteHome</home>
    <remote>contacorrente.ContaCorrente</remote>
    </ejb-ref>
    </session>
    <entity>
    <description>
    </description>
    <ejb-name>ContaCorrenteEJB</ejb-name>
    <home>contacorrente.ContaCorrenteHome</home>
    <remote>contacorrente.ContaCorrente</remote>
    <ejb-class>contacorrente.ContaCorrenteBean</ejb-class>
    <primkey-class>java.lang.String</primkey-class>
    <reentrant>True</reentrant>
    <persistence-type>Container</persistence-type>
    <cmp-field><field-name>id_conta</field-name></cmp-field>
    <cmp-field><field-name>saldo</field-name></cmp-field>
    <cmp-field><field-name>senha</field-name></cmp-field>
    <primkey-field>id_conta</primkey-field>
    </entity>
    </enterprise-beans>
    <assembly-descriptor>
    <container-transaction>
    <method>
    <ejb-name>ContaFacadeEJB</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>RequiresNew</trans-attribute>
    </container-transaction>
    <container-transaction>
    <method>
    <ejb-name>ContaCorrenteEJB</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Mandatory</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>
    and the code of the beans (just the method used)
    Entity (account)
    public void debita(double valor) throws ContaCorrenteException
    double saldoOld=saldo;
    saldo=saldo-valor;
    if (saldo<0)
    throw new ContaCorrenteException("Saldo insuficiente:"+saldoOld);
    Session :
    public void transfere(String idConta1, String idConta2, double valor, String senha) throws ContaCorrenteException
         try
    Context cx=new InitialContext();
    Object homeObject=cx.lookup("java:comp/env/ContaCorrenteEJB");
    ContaCorrenteHome home=(ContaCorrenteHome) PortableRemoteObject.narrow(homeObject,ContaCorrenteHome.class);
    ContaCorrente c1=null;
    ContaCorrente c2=null;
    try
    c1=home.findByPrimaryKey(idConta1);
    c2=home.findByPrimaryKey(idConta2);
    if (!c1.getSenha().equals(senha)) { throw new ContaCorrenteException("Senha incorreta");}
    catch(FinderException e)
    System.out.println("erro ao localizar conta :"+e.getMessage());
    context.setRollbackOnly();
    throw new ContaCorrenteException("Conta inexistente");
    catch(java.rmi.RemoteException e)
    System.out.println("erro Remote: "+e.getMessage());
    context.setRollbackOnly();
    throw new ContaCorrenteException("Erro ao conectar objeto remoto");
    try
    c1.debita(valor);
    c2.credita(valor);
    catch(ContaCorrenteException e)
    context.setRollbackOnly();
    throw new ContaCorrenteException(e.getMessage());
    catch(java.rmi.RemoteException e)
    throw new ContaCorrenteException("Erro de conexco");
         catch (NamingException e)
    System.out.println("erro de localizagco:"+e.getMessage());
    throw new ContaCorrenteException("Erro de acesso remoto na localizacao da conta");
    please, someone help me...
    Thanks in advance

    I forgot : when i try to shut the server down i get the message :
    Shutting down...
    Error serializing bean: Deadlock detected, timing out call after 15 seconds wait for transaction [Transaction d9:fa:4f:b6:ff:ff:ff:ff:4a:0:0:0:0:0:0:0:0:4b:0:ec:6d:ce:c0:16]
    Error serializing bean: Deadlock detected, timing out call after 15 seconds wait for transaction [Transaction d9:fa:4f:b6:ff:ff:ff:ff:4c:0:0:0:0:0:0:0:0:4d:0:ec:6d:d2:d9:d2]
    Error serializing bean: Deadlock detected, timing out call after 15 seconds wait for transaction [Transaction d9:fa:4f:b6:ff:ff:ff:ff:4e:0:0:0:0:0:0:0:0:4f:0:ec:6d:d4:21:a3]
    and it doesn't shutdown.

  • Problem with transacted JMS connection factory and transaction timeouts

              We encountered an interesting problem using transacted JMS connection factories.
              An EJB starts a container managed transaction and tries to validate a credit card
              before creating some information to a database for the user, in case of success
              an SMS is sent to the user via the transacted JMS queue. If the credit card authentications
              duration is about the same as the transactions timeout (in this case the default
              30 seconds) sometimes the database inserts is committed but the JMS insert is
              rollbacked. How can this be?
              If the authorization duration is much longer than 30 seconds everything works
              fine (both database and JMS inserts rollbacked), the same is true if a rollback
              is insured by calling EJBContext.setRollbackOnly(). The problem thus occurs only
              if the duration is approximately the same as the transaction timeout, it appears
              that the database insert is not timeouted but the JMS insert is. How can this
              be if they are both participating in the same transaction.
              The JMSConnectionFactory used is a Connection factory with XA-enabled. The result
              is the same also with the default "javax.jms.QueueConnectionFactory" and if we
              configure our own factory with user transactions enabled.
              Any help appreciated!
              

    Tomas Granö wrote:
              > We encountered an interesting problem using transacted JMS connection factories.
              > An EJB starts a container managed transaction and tries to validate a credit card
              > before creating some information to a database for the user, in case of success
              > an SMS is sent to the user via the transacted JMS queue. If the credit card authentications
              > duration is about the same as the transactions timeout (in this case the default
              > 30 seconds) sometimes the database inserts is committed but the JMS insert is
              > rollbacked. How can this be?
              It should not be.
              >
              > If the authorization duration is much longer than 30 seconds everything works
              > fine (both database and JMS inserts rollbacked), the same is true if a rollback
              > is insured by calling EJBContext.setRollbackOnly(). The problem thus occurs only
              > if the duration is approximately the same as the transaction timeout, it appears
              > that the database insert is not timeouted but the JMS insert is. How can this
              > be if they are both participating in the same transaction.
              >
              > The JMSConnectionFactory used is a Connection factory with XA-enabled. The result
              > is the same also with the default "javax.jms.QueueConnectionFactory" and if we
              > configure our own factory with user transactions enabled.
              >
              > Any help appreciated!
              Make sure that your session is not "transacted". In other words,
              the first parameter to createSession() must be false. There is an
              unfortunate name re-use here. If a session is "transacted", it
              maintains an independent "inner transaction" independent of the
              outer transaction. From the above description, it seems unlikely
              that your application has this wrong, as you say that
              "setRollbackOnly" works - but please check anyway.
              Make sure that you are using a true XA capable driver and database
              (XA "emulation" may not suffice)
              Beyond the above, I do not see what can be going wrong. You
              may want to try posting to the transactions and jdbc newsgroups. Note
              that JMS is appears to be exhibiting the correct behavior, but the
              JDBC operation is not. The JDBC operation appears to have
              its timeout independent of the transaction monitor's timeout.
              Tom
              

  • Problem Deploying EJB3 Stateless session bean in Jboss4.0.3

    Hi All,
    I have developed an EJB 3 Stateless session bean and tried to deploy in JBoss 4.0.3 , But i get the following Exception.
    javax.naming.NameNotFoundException: ejb not bound
    at org.jnp.server.NamingServer.getBinding(NamingServer.java:491)
    at org.jnp.server.NamingServer.getBinding(NamingServer.java:499)
    at org.jnp.server.NamingServer.getObject(NamingServer.java:505)
    at org.jnp.server.NamingServer.lookup(NamingServer.java:249)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
    at javax.naming.InitialContext.lookup(InitialContext.java:351)
    at org.apache.jsp.session_jsp._jspService(org.apache.jsp.session_jsp:69)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:157)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
    at java.lang.Thread.run(Thread.java:595)
    I am sorry if the question is silly..... My Remote Interface will be one like this
    import javax.ejb.Remote;
    @Remote
    public interface CityService {
         public String getCity();
    And My Bean Class will be
    import javax.ejb.EJB;
    import javax.ejb.Remote;
    import javax.ejb.Stateless;
    import javax.persistence.EntityManager;
    import javax.persistence.EntityTransaction;
    import javax.persistence.PersistenceContext;
    import javax.persistence.Query;
    @EJB
    @Remote(CityService.class)
    @Stateless(mappedName="ejb/CityService")
    public class CityServiceBean implements CityService {
    public String getCity(){
    return "Chennai Metropolitan";
    And the client which invokes the bean will be
    InitialContext ctx = new InitialContext();
    CityService c = (CityService)ctx.lookup("ejb/CityService");
    System.out.println("Msg from Bean"+c.getCity());
    please help me out of this issue....
    Thanks in advance

    ford wrote:
    If you deploy your application in a .ear, you also can use this:
    You have to set a name to your EJBBean -> @Stateless(name = "XXX")
    The client for remote interface -> cxt.lookup(Name_of_your_own_ear_without_extension + "/XXX/Remote");
    The client for local interface -> cxt.lookup(Name_of_your_own_ear_without_extension + "/XXX/Local");the problem with this approach is that if you version your ears, the version numbers show up in the jndi names, and your client code will be hard coded to specific server versions.

  • Problem While calling a session bean (J2EE)

    Hi!!
    Please see my client-side code..where I am calling a session bean (J2EE Server)
    It's correct or not?????
    InitialContext ctx = new InitialContext();
    Object objref = ctx.lookup("SecDbSecRoleJndi");
    SecBusSecRoleHome home =(SecBusSecRoleHome)PortableRemoteObject.narrow(objref,SecBusSecRoleHome.class);
    SecBusSecRoleRemote remote =(SecBusSecRoleRemote)PortableRemoteObject.narrow(home.create(),SecBusSecRoleRemote.class);
    Here I am getting the error at 3rd line
    java.lang.ClassCastException
    at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:296)
    at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
    at TestServlet.init(TestServlet.java:22)
    Please do the favor to me..reply me back.
    Bhumika

    Hello,
    Hope you are bale to sole the problem by this time. Iam using the follwing code and its working fine for me. i'm using the weblogic application server.
    <%@ page import="javax.naming.*, java.rmi.*, javax.ejb.*, java.util.*,java.rmi.server.*,java.net.*,javax.rmi.PortableRemoteObject,com.hmp.webcasting.services.ejb.*"%>
    <%
    try{             
    Properties prop = new Properties();
    prop.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
              System.out.println("Hello......3333333333Test");
              prop.put(Context.PROVIDER_URL, "t3://pani:7001");
              InitialContext ctx = new InitialContext(prop);
    Object home = ctx.lookup("personMgr");
              KeywordsMgrHome roleHome = (KeywordsMgrHome) javax.rmi.PortableRemoteObject.narrow(home, KeywordsMgrHome.class);
              KeywordsMgr kmgr=roleHome.create();
              //KeywordsMgrHome roleHome = (KeywordsMgrHome) ctx.lookup("personMgr");;
              System.out.println(roleHome);
              System.out.println(kmgr);
              }catch(Exception e){
              e.printStackTrace();
              %>
    Try using this.
    Genrally calss cast exception occurs if you are using classes out of a shared library directory instead of within the webapp, or if you are somehow maintaining references to object instances created with the old class and trying to use them after the reload. So try to delete the old file files and deploy the bean once again . Hope this may help you. Anyway if you can give the full code i will check by deploying it.([email protected])

  • Problem with cache refresh entity bean / server node

    Hello,
    ive got a big problem and not found answer in sdn until now.
    Ive got a job that gets data from maxdb by sapjob - jco - session bean - entity bean - database.
    this job works daily. the data to work with is written directly to database from external.
    on first execute it works, but second etc not. i search for answer and i guess something:
    entity bean is cached (increase percormance?) with results of the select and do not know about new database entries when they are written directly to database. so second select says: there is no new data (but they are there).
    i only get this new data when i restart netweaver server node, then it works, but only for one time. then result is in cache and then i have to do same procedure before it goes (restart server).
    how can i get this data? is there any setting for force node to refresh cache? or any other settings to affect something like this?
    we have to go live with this in august.
    thx for help.
    Version: NW04, SP21

    thanks at first.
    OSS was the next step i consider, enforcedly.
    I hoped that there was a kind of timeout in visual admin or somewhere else where (for example) i can set a special time (seconds?) for refreshig the cache. Or i can set a flag for "do not cache entity beans".
    Someone else any idea?
    Nowadays on test system whe have made a task that starts windows every night so that netweaver also is "fresh". a kind of resolution but not the best and no resolution for the productiv system. or whe have to write a kind of batch job that only restarts server node once a day.
    New Info:
    I think cache was filled directly after restart.
    when we restart, then data are written, and then our application wanted to read them, they are also not seen.
    The data are only seen by bean when the restart takes place AFTER the data are written into db.
    So we change restart time to point after data are written. so we will test if this works, on monday we will see.
    Edited by: Torsten on Jul 11, 2008 11:27 AM

  • Making AQ usage transactional across session beans, using mosly JMS syntax

    I need to determine what I need to have in place in order for JMS/AQ messages to be "fully transactional".
    I have a J2EE server application that will send JMS/AQ messages to a queue. I have a standalone application that reads messages from the queue, does some work, and then makes calls on multiple session beans (hosted in the original J2EE server application). Actually, it would likely be multiple calls to the same session bean method.
    Once the standalone application reads a message from the queue, I need to ensure that if any action performed as a result of that message fails, that all the operations performed, including the removal of the message from the queue, are rolled back.
    First of all, if I use an Oracle XA-compliant datasource, if one of the session bean calls fail, I can rollback the current transaction, but will this properly roll back any work that earlier session bean calls (made on the same transaction) did, even if they were successful (at the time)? Note that I have two JVMs, one running the J2EE application, and the other a standalone application reading from the queue.
    Second, on committing or rolling back the message retrieval itself, I noticed from examples in the Oracle AQ Application Developer's Guide that if I create my QueueSessions with "AQDriverManager.createAQSession()", that I can pass a Connection object, and then later "commit" or "rollback", manually, perhaps if I got an EJBException from a session bean call.
    However, I am trying to write my JMS/AQ code so that it uses as little of the direct AQ api as possible, staying with the standard JMS api. As a result, I'm using the JMS version of this, which is "QueueConnection.createQueueSession()". When I do this, however, it seems as if I lose control over the transaction.

    Ok, I think I've answered some of this for myself, but I still have some concerns.
    I see that the QueueSession object that I get back from "queueConnection.createQueueSession()" is likely going to actually be an instance of the "AQjmsSession" class, so I can cast to that, and then I can call "commit" or "rollback".
    What is unclear from the javadoc description is what happens when "close()" is called on the session object. Does this do an implicit "commit()", perhaps unless "rollback()" has already been called?
    I'm still a little uncertain about whether the scope of my transaction will be wide enough to protect everything that needs to be protected.
    For instance, I assume that my transaction starts when my consumer (not in an application server) reads the message from the queue. At that point, my consumer does some "screen-scraping" work. When it's done, it will call a session bean on the application in the application server (separate JVM, in other words), which will create some EJB entity objects and also insert raw database rows. The session bean will then return, and then the original method which read a message from the queue will be completed.
    What I need to know is what will happen if ANYTHING in that process fails, either in the external consumer, or in the session bean, or creating EJB entities? That is, will the entire transaction be rolled back, undoing the EJB entity creations AND the removal of the message from the message queue?
    If this can possibly work, I'm assuming this would be utilizing an XA datasource, or a non-emulated data source (which I think means the same thing).

  • Problems with Binding an Enterprise Bean

    I am using Sun Appserver 8 on a Linux Enterprise 3 Workstation . I have the Converter example working properly. I have verified and deployed (with out error) my own application which uses a JSP as the Web Component. The JSP looks up a stateless Session Bean POSControllerBean. When running the JSP either on local host or in a brower on a remote system the App Server returns an error "no object bound to java:/comp/env/ejb/POSControllerHome". The JNDI name for this object is POSControllerBean. I have been fighting this for a few hours now and would appreciate any help I can get.

    You may want to change the JNDI name to
    ejb/POSControllerHome
    vbkThanks for the input. That wasn't the problem put it did send me down the right road. I changed the JNDI name to POSControllerEJB and the reference name to ejb/POSControl. In the .jsp that does the lookup I found that the string being passed to lookup was java:/comp/env/ejb/POSControl. Dumb! It should be java:comp/env/ejb/POSControl. There should be a "/" after the colon. If I would only slow down I could be dangerous. I would be embarrassed to tell you how many hours I spent on this. Thanks for gettting me to go through the code one more time.

Maybe you are looking for

  • Migrating Windows user to Mac OS X on a MacBook Pro.

    Hello. I have a client (not a computer/techie expert) who is interested in going from Windows world (3.x, 98 SE, 2000, and XP) to Mac OS X. I am wondering if this is suitable for him. This is what he does on his PCs (notebooks/laptops and desktops):

  • Regarding generating levels in the parent-child relationship--- using BODS

    Hi Experts, I got a problem in generating the level for the child attribute at which it stands in the hierarchy. I have 2 columns in my input file one for parent_no and other for child_no. I need to generate the level of the child_no in the total hie

  • Cannot save free/busy information - Cached mode

    So I have a calendar Admin, that has the ability to send meetings on behalf of new hires.  She was is cached mode and sent out a few invites.  Everyone she sent the invites to received the meetings, accepted the meetings and have the meetings on thei

  • Sort remuneration statement (report RPCEDTP0)

    Dear gurus, I need to find an exit for report RPCEDTP0, because a need to sort the remuneration statement by name and last name. The standard button SORT ORDER from report RPCEDTP0 is not giving me what I need... Does anyone know something that may h

  • Prelude and coda with JSP documents

    Hello. I have problems with adding prelude and coda templates to JSP documents (XML-format JSP). This is content of my web.xml: <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4"       xmlns:xsi="htt