EJB bmp persistence

hi,
I was reading tutorials on BMP.
I found that in all the tutorial they have mentioned that it involves writting queries ourself.
So by using a BMP means 'writing the query alone' or is there any service that has to be provided.
Also can u broach me abt the services that are taken care in a CMP.

There some limitations of CMPs.. Some of them are..
1. Limitations of type of data sources that may be supported by a container for CMPs
2. EJB QL cant handle complex queries
Some advantages..
1. easier to create/manage than BMPs
2. If you need CMR then you may need to use CMPs
3. Optmization of SQL by containers
venkk
http://www.venkks.net/

Similar Messages

  • EJB BMP Starter

    I have some key basic questions on BMP Entity Beans. I have been looking at the sample application at http://developers.sun.com/tools/javatools/documentation/s1s5/accountapp.html.
    1. I have a database that is pre-populated by some external ways other than EJBs. Does my BMP Entity Bean that i mapped to a specific table know about the previous data. In the sample application above, there is a loadRow method (Adding private methods to perform database calls, step 10). In it, it says:
    String selectStatement = "select balance from account where id = ? ";
    PreparedStatement prepStmt = con.prepareStatement(selectStatement);
    prepStmt.setString(1,this.id);
    Where does this.id came from? It is not set anywhere but in the ejbCreate() method. For example, if my client program just wants to list the balance from accounts table bound to an id without inserting new rows into the database, how would that happen? It confuses me since ejbCreate method is called automatically everytime i use a bean and it contains SQL insert statements.
    2. In the same example above, in section (implementing the bean's other methods, steps 3 and 4) it says:
    public void ejbActivate() {
    id = (String) context.getPrimaryKey();
    } What is this id variable? There is no type definition. Is this the id that was defined in AcccountEJB (from db mapping)? If so how do i reference to it without any class names?
    3. After all, i am looking for a clear BMP sample(with session beans using bmp beans, and servlets using session beans to access database data) that can guide me. If someone knows the place of such an example I would be very much greatful.
    I seem to be unable to grab the logic of EJB BMP. Answers to these questions would be helpful.
    Thanks in advance.

    Greetings,
    1. I have a database that is pre-populated by some external ways other than EJBs. Does my BMP
    Entity Bean that i mapped to a specific table know about the previous data. In the sampleThe container will not have any beans representing the new data until the client attempts to find them.
    String selectStatement = "select balance from account where id = ? ";
    PreparedStatement prepStmt = con.prepareStatement(selectStatement);
    prepStmt.setString(1,this.id);
    Where does this.id came from? It is not set anywhereAs shown below, it is grabbed out of the EJBObject (which gets it as a consequence of either a create or finder method call), when a bean instance is "activated" - or, 'swapped in' from the free pool and associated with the EJBObject.
    but in the ejbCreate() method. For example, if myThe ejbCreate method returns an instance of the Primary Key class which the container stores in the EJBObject. In this case, the PK class is type String and referenced by the variable 'id'.
    client program just wants to list the balance from accounts table bound to an id without inserting
    new rows into the database, how would that happen? ItPresumably, the client knows the "primary key" of the entity (the unique tuple from the accounts table which the EB represents), it wants to access and uses that as the argument to a findByPrimaryKey call against the home object.
    confuses me since ejbCreate method is called automatically everytime i use a bean and it contains
    SQL insert statements.Er, no. The bean's ejbCreate method is called by the container as a consequence of the client calling the corresponding create method on the home. It does not happen "automatically", but only as a consequence of the client wanting to create a new entity in the application - and, accordingly, in the underlying persistence resource. If the client does not want to create a new entity but, rather, use an existing one, then it calls an appropriate finder method to locate the instance and get a reference to it.
    2. In the same example above, in section (implementing the bean's other methods, steps 3 and 4)
    it says:
    public void ejbActivate() {
    id = (String) context.getPrimaryKey();
    Refer again to the above...
    What is this id variable? There is no type definition. Is this the id that was defined in AcccountEJB
    (from db mapping)? If so how do i reference to it without any class names?It is indeed the private member of AccountBean (see step 7 under "Adding a create method to the bean" of section 4).
    3. After all, i am looking for a clear BMP sample(with session beans using bmp beans, and
    servlets using session beans to access database data) that can guide me. If someone knows the
    place of such an example I would be very much greatful.It would appear that you require more grounding in the fundamentals of EJB generally - particularly with regard to their lifecycle and state transitions. Start with the specification. Then take a look at J2EE core design patterns...
    I seem to be unable to grab the logic of EJB BMP.
    Answers to these questions would be helpful.
    Thanks in advance.Regards,
    Tony "Vee Schade" Cook

  • Where to Instantiate a DAO in an EJB BMP?

    We are using DAOs with our EJB BMPs..
    My question is what method should the DAO be Instantiated in?
    I have seen it done in the:
    1) ejbActivate (seems to cause a null pointer error on the weblogic server)
    2) setEntityContext method
    3) all methods that use the dao object.

    This depends a bit on how your DAOs are built, but you certainly don't want to instantiate a new DAO every time you need one. Unnecessary object creation is not a Good Thing.
    Generally speaking, an instance variable populated upon bean instantiation works just fine (i.e private MyDao dao = new MyDao();). If your DAO is serializable and doesn't contain any transient info of it's own, you're pretty much done since the DAO will get serialized when the bean is passivated.
    If it does contain transient data/resources (and it probably shouldn't) you can set/remove them during ejbActivate/ejbPassivate.
    If the DAO is not serializable (and it probably should be), then instantiating one during ejbActivate should not be a problem. What was the exact cause of the NPE you got?

  • Ejb BMP never commits even with transactions

    I have serious problems with any EJB running inside the Oracle8i server, Linux Rh6.2/Oracle 8.1.7.0.1
    ALL code does not perist its data, but it sielently fails. For instance take
    $ORACLE_HOME/javavm/demo/examples/ejb/transactions/clientside
    I changed the last line in Client.java from crollback to commit()...
    I run this program twice:
    Beginning salary = 3000.0
    End salary = 3300.0
    Beginning salary = 3000.0
    End salary = 3300.0
    The second invocation should show the beginning salary as 3300.0
    In essance ALL of my EJBs are showing simular behavior. This problem is also seen in ALL of the examples. My environment uesed to work, but I can't figure out what changed to make every EJB-BMP nonpersistant.
    any help would be greatly appreciated.
    thanks,
    -rick

    I don't think my probmem is related to an exception being lost because no exceptions are throws, I have alot of trace information and I always see complete method calls through ejbCreate, ejbStore, et. al.
    My problem is that a transaction never gets commited, even when the JTS is used. Infact I have this piticular problem with ALL Oracle BMP-EJBs
    I'm just going to have to open a ITAR, guess thats want support is for. I'm just perplexed as to why it worked last week, and now the demos can't save their state.
    a bit scarie for something that may one day be in production.

  • Ejb - BMP Finder

    Hello,
    I wrote an appliation which connects to EJB.
    I use BMP, and wrote a finder in the CustomerBean which sets
    records of customers table to a com.borland.dx.dataset.DataSetData (which is serializable)
    I tried to do this:
    public DataSetData ejbFindAll() throws FinderException {}
    but I get an error that a finder can't return a DataSetData,
    only a collection or the bean.
    can I write other function which will return DataSetData,
    and to write it's definition in the Home interface?
    it means not using finders.
    Thanks.

    Thanks for your reply.
    According to your reply, I shouldn't use Entity Beans,
    only remote Session Beans.
    Is it accepted to write in this way, while using the
    EJB technologic?
    I write an applet GUI, which contains swing and borland
    components like JdbTable.
    It will take a long time to add the records to the collection
    in the Entity Bean,
    and move the collection to dataset in the applet.
    I will be happy to hear your advice.
    Thanks,
    Anat

  • EJB BMP slow?

    Hello,
    I don't understand why people use EJB's if it is so slow. I am trying
    to do simple GET and SET methods on the current bean in memory, where
    each GET and SET method calls ejbLoad() and ejbStore() which are
    extremely resource intensive so they are very slow. Are there ways
    around this?
    I don't see why someone would want to do use EJB's when it is so
    slow...doesn't make sense. I must be missing something. Anyone?
    Tim :-)

    ck388 <[email protected]> wrote:
    I don't understand why people use EJB's if it is so slow. I am trying
    to do simple GET and SET methods on the current bean in memory, where
    each GET and SET method calls ejbLoad() and ejbStore() which are
    extremely resource intensive so they are very slow. Are there ways
    around this?
    I don't see why someone would want to do use EJB's when it is so
    slow...doesn't make sense. I must be missing something. Anyone?using bmp, it's up to you to optimize the expensive db calls.
    keep a dirty bit for each field and only commit it in your ejbStore
    when it's actually been changed, etc.
    if your object-relational mappings are not complex, you can bind your
    entity to the db through cmp, and then the container does the sql and
    the optimizations for you.
    ____________________}John Flinchbaugh{______________________
    | [email protected] http://www.hjsoft.com/~glynis/ |
    ~~Powered by Linux: Reboots are for hardware upgrades only~~

  • Catching Mysql  sql execution  status with EJB and Persistence API.

    Hi:
    When I insert a duplicate unique Key, the try block defined below does not catch the exception and the transaction is rolled back automatically by Glassfish.
    How is the proper way to handle this to catch the duplicate status?
    public class MyDbEjb extends DefaultHandler implements MyDbEjbRemote {     @PersistenceContext     private EntityManager em;     public void createTag(Tag tag) {       try {         em.persist(tag);       } catch ( Exception e)       {           System.out.println("how sorry");       }           }
    Thank you

    Hi annie,
    Wherever you are handling database transactions,
    you'd not be able to create a Connection if database
    is closed (I think you mentioned turning off the
    database) then at this condition, you should
    certainly throw a System level exception and stop all
    processing with some meaningful flow to indicate a
    failure (like display message on UI). Even
    network problems are handled by exceptions... so I
    don't see a reason why you didn't wrap it in the
    first place.
    Anyway, try handling specific exceptions rather than
    the general Exception... this will give you a better
    idea of what to do in case of an exception.Yes i know this. I am practicing this in my non-j2ee server applications. But the j2ee app im making, i just pass the db url in the descriptor and the app server automatically creates the connection for my app. So where would i put exception handling?
    2. how can i stop my MDB from processing the same
    message?Guaranteed delivery is not supposed to stop
    processing. It will continue to process the message
    after certain intervals till the message is
    delivered. You shouldn't deliver it at all, if you
    are able to detect that the database is off
    The problem here is that my MDB automatically retrieves the message from the JMS queue server. Im not the one retrieving the messages manually.
    My assumed behavior of topic MDB is once the a certain MDB retrieves a message it will not retrieve the same message anymore.
    thank you in advance.
    leigh

  • Update form another EJB with DAO persistence

    We have two modules with EJB Session, stateless, with CMT requeried in all methods, the first module has the persistence tier wiht DAOs pattern and the other module uses TopLink. We are using JSF as framework in the presentation layer, when we are going to update the database from web form a backing bean JSFcalls the first EJB (DAOs persistence) and this EJB invokes the other EJB (Toplink persistence). and throws the next exception
    05/10/31 17:12:12 java.lang.NullPointerException
    05/10/31 17:12:12      at oracle.toplink.internal.indirection.UnitOfWorkValueHolder.getValueFromServerObject(UnitOfWorkValueHolder.java:105)
    05/10/31 17:12:12      at oracle.toplink.internal.indirection.UnitOfWorkValueHolder.instantiate(UnitOfWorkValueHolder.java:144)
    05/10/31 17:12:12      at oracle.toplink.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:64)
    05/10/31 17:12:12      at oracle.toplink.internal.indirection.BasicIndirectionPolicy.cloneAttribute(BasicIndirectionPolicy.java:88)
    05/10/31 17:12:12      at oracle.toplink.mappings.ForeignReferenceMapping.buildClone(ForeignReferenceMapping.java)
    05/10/31 17:12:12      at oracle.toplink.internal.descriptors.ObjectBuilder.populateAttributesForClone(ObjectBuilder.java:1492)
    05/10/31 17:12:12      at oracle.toplink.publicinterface.UnitOfWork.cloneAndRegisterNewObject(UnitOfWork.java:601)
    05/10/31 17:12:12      at oracle.toplink.publicinterface.UnitOfWork.internalRegisterObject(UnitOfWork.java:2294)
    05/10/31 17:12:12      at oracle.toplink.internal.sessions.MergeManager.registerObjectForMergeCloneIntoWorkingCopy(MergeManager.java:688)
    05/10/31 17:12:12      at oracle.toplink.internal.sessions.MergeManager.mergeChangesOfCloneIntoWorkingCopy(MergeManager.java:397)
    05/10/31 17:12:12      at oracle.toplink.internal.sessions.MergeManager.mergeChanges(MergeManager.java:181)
    05/10/31 17:12:12      at oracle.toplink.publicinterface.UnitOfWork.mergeClone(UnitOfWork.java:2634)
    05/10/31 17:12:12      at oracle.toplink.publicinterface.UnitOfWork.deepMergeClone(UnitOfWork.java:1231)
    05/10/31 17:12:12      at siscoi.declaracionescambio.business.DeclaracionesCambioMngr.grabarDeclaracionCambio(DeclaracionesCambioMngr.java:222)
    when the objects are new the TopLink framework works good, but when the object already exist in the DB, does not make the update an thorw the null pointer exception why?.
    We implements a Client Class to only test the EJB with Toplink persistence. In this class read a object from de database and i modify the object and calls the update method and the update works good.
    Container oc4j 10.1.2
    Toplink 9.0.4
    jdk 1.4.2.04
    please help me!!

    It looks like the issue is occurring because the object that you are merging is a new object, or TopLink thinks it is a new object and it is being registered as a new object. The new object has a non-instantiated value-holder that seems to have been serialized so can no longer be instantiated, but the relationship is required to persist the new object.
    My guess is that the object is not new, but existing, and the issue is most likely with your does-exist-check option. The original object may no longer be in the cache, so you most likely need to use check-database for your descriptor's does-exist option, instead of the default of check-cache.

  • How do I run a JCA adapter when I am calling it from an EJB?

    How do I run a JCA adapter when I am calling it from an EJB? Do I need to create an EJB client and place it in a Client container? If my EJB and JCA adapter are deployed is there a way to call my EJB from the command line?
    Mike

    Hi. When you look at the code I provided for you in other thread you will see that connecting to adapter is done through JNDI lookup. The creation of the adapter is done in your J2EE server. Here is some code for you where you can find mapping from code to ejb-jar and orion-ejb-jar.
    ejb-jar.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
    version="2.1">
    <!--
    This file declares the interface (needs/promises) of the message-driven bean.
    The MDB requires:
    - a JMS queue (to receive messages from the client),
    - a JMS exception queue (to send undeliverable messages back to the source), and
    - a connection factory (to communicate with a JMS resource provider).
    Note that communication with the resource provider may be (and for this
    application is) via a JMS Connector rather than direct.
    -->
    <display-name>JMS Consume MDB - opp-ifs</display-name>
    <enterprise-beans>
    <entity>
    <description>Entity Bean ( BMP )</description>
    <display-name>EBEjbMecomsIFS</display-name>
    <ejb-name>EBEjbMecomsIFS</ejb-name>
    <local-home>EBEjbMecomsIFSLocalHome</local-home>
    <local>EBEjbMecomsIFSLocal</local>
    <ejb-class>EBEjbMecomsIFSBean</ejb-class>
    <persistence-type>Bean</persistence-type>
    <prim-key-class>java.lang.Long</prim-key-class>
    <reentrant>false</reentrant>
    <service-ref>
    <service-ref-name>service/interceptor</service-ref-name>
    <service-interface>javax.xml.rpc.Service</service-interface>
    <wsdl-file>META-INF/wsdl/MHS5_Jms_In_RS.wsdl</wsdl-file>
    <service-qname xmlns:ns="http://oracle.com/esb/namespaces/PilotOWSM_MustHavesScenario5">ns:ESB_MHS5_Jms_In_RS_Service</service-qname>
    </service-ref>
    </entity>
    <message-driven>
    <display-name>JMS Consume MDB - MDB</display-name>
    <ejb-name>MDBEjbMecomsIFS</ejb-name>
    <!-- name of bean in deployment descriptor (including orion-ejb-jar.xml file) -->
    <ejb-class>MDBEjbMecomsIFSBean</ejb-class>
    <!-- bean's fully qualified Java class name -->
    <messaging-type>javax.jms.MessageListener</messaging-type>
    <transaction-type>Container</transaction-type>
    <!-- allow incoming messages to be included in transactions -->
    <!-- The ejb requires a connection factory to access an external resource (JMS). -->
    <ejb-local-ref>
    <ejb-ref-name>ejb/local/EBEjbopp_ifs</ejb-ref-name>
    <ejb-ref-type>Entity</ejb-ref-type>
    <local-home>EBEjbMecomsIFSLocalHome</local-home>
    <local>EBEjbMecomsIFSLocal</local>
    <ejb-link>EBEjbMecomsIFS</ejb-link>
    </ejb-local-ref>
    <resource-ref>
    <!-- The resource's connection factory must be accessible at jndi location "java:comp/env/jms/QueueConnectionFactory". -->
    <res-ref-name>jms/QueueConnectionFactory</res-ref-name>
    <!-- The resource's connection factory must implement the "javax.jms.ConnectionFactory" interface. -->
    <res-type>javax.jms.ConnectionFactory</res-type>
    <!-- container managed authorization -->
    <res-auth>Container</res-auth>
    </resource-ref>
    </message-driven>
    </enterprise-beans>
    <assembly-descriptor>
    <!--
    Declare that a global transaction is required when the onMessage method of the ejb named
    "MDBEjbName" is called. This will cause the app server to automatically initiate a
    global (XA) transaction before calling onMessage (actually, before even receiving the JMS
    message that triggers onMessage) and end the transaction after onMessage returns. The
    JMS Connector will automatically rollback the transaction if onMessage throws an
    exception. onMessage may also set the transaction to be "rollback only".
    Participating in global transactions requires that the connection factory provided in the
    activation spec (see the ConnectionFactoryJndiName property earlier in this file) must be
    XA-capable (it must implement the javax.jms.XAConnectionFactory interface).
    If this declaration is ommitted, then onMethod will not be part of any global
    transaction. In that case the connection factory provided in the activation spec must
    implement the javax.jms.ConnectionFactory interface.
    -->
    <container-transaction>
    <method>
    <ejb-name>MDBEjbMecomsIFS</ejb-name>
    <method-name>onMessage</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    <container-transaction>
    <method>
    <ejb-name>EBEjbMecomsIFS</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Supports</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>
    orion-ejb-jar.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <orion-ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNameSpaceSchemaLocation="http://www.oracle.com/technology/oracleas/schema/orion-ejb-jar-10_0.xsd">
    <enterprise-beans>
    <entity-deployment name="EBEjbMecomsIFS">
    <service-ref-mapping name="service/interceptor">
    <wsdl-location>http://on-poc62.ontw.alfa.local:7777/event/PilotOWSM/MustHavesScenario5/MHS5_Jms_In_RS?wsdl</wsdl-location>
    <service-qname localpart="ESB_MHS5_Jms_In_RS_Service" namespaceURI="http://oracle.com/esb/namespaces/PilotOWSM_MustHavesScenario5"/>
    <port-info>
    <wsdl-port namespaceURI="http://oracle.com/esb/namespaces/PilotOWSM_MustHavesScenario5"
    localpart="__soap_MHS5_Jms_In_RS_execute_ppt"/>
    <service-endpoint-interface>javax.xml.rpc.Service</service-endpoint-interface>
    <call-property>
    <name>javax.xml.rpc.service.endpoint.address</name>
    <value>http://on-poc62.ontw.alfa.local:7777/event/PilotOWSM/MustHavesScenario5/MHS5_Jms_In_RS</value>
    </call-property>
    <call-property>
    <name>javax.xml.rpc.soap.http.soapaction.uri</name>
    <value>execute</value>
    </call-property>
    <call-property>
    <name>javax.xml.rpc.soap.http.soapaction.use</name>
    <value>true</value>
    </call-property>
    <call-property>
    <name>javax.xml.rpc.soap.operation.style</name>
    <value>document</value>
    </call-property>
    <runtime enabled="owsm">
    <owsm init-home="/oracle/product/SoaAs/10.1.3/owsm/config/interceptors/C0003002"
    init-file="confluent.properties"/>
    </runtime>
    </port-info>
    </service-ref-mapping>
    </entity-deployment>
    <message-driven-deployment name="MDBEjbMecomsIFS"
    resource-adapter="OEMSJMSDRAopp-ifs"
    enabled="true" max-instances="10">
    <!--
    The ejb requires a connection factory implementing the "javax.jms.XAConnectionFactory"
    interface to be accessible at jndi location "java:comp/env/jms/QueueConnectionFactory". (see ejb-jar.xml and ....)
    A suitable connection factory is already accessible at jndi location "OEMSJMSDRASubcontext/MyXACF" (see oc4j-ra.xml)
    -->
    <resource-ref-mapping location="OEMSJMSDRASubopp-ifs/MyXACF"
    name="jms/QueueConnectionFactory"/>
    <!-- don't misspell this or you'll get an RP CF which doesn't work -->
    <!-- Required activation-spec properties. -->
    <!--
    ConnectionFactoryJndiName (string, no default)
    This should be the JNDI location of an RA connection factory.
    The JMS Connector will use this connection factory to create the JMS
    connection it uses to receive messages for this MDB's onMessage. If the
    exception queue is enabled (see UseExceptionQueue), the JMS Connector will
    also use a connection created from this connection factory for the production
    of messages to the exception queue.
    This connection factory must be compatible with the message domain(s). (For
    example, if the MDB is receiving messages from a queue, the connection
    factory should implement javax.jms.[XA]QueueConnectionFactory or
    javx.jms.[XA]ConnectionFactory.)
    For XA/non-XA considerations, see the <container-transaction> comments later
    in this file.
    -->
    <config-property>
    <config-property-name>ConnectionFactoryJndiName</config-property-name>
    <config-property-value>OEMSJMSDRASubopp-ifs/MyXAQCF</config-property-value>
    </config-property>
    <!--
    DestinationName (string, no default)
    This is JNDI location of the queue or topic from which messages to be
    delivered to the MDB's onMessage method should be received.
    The JNDI locations for RA destinations are defined in the
    oc4j-connectors.xml file.
    -->
    <config-property>
    <config-property-name>DestinationName</config-property-name>
    <config-property-value>OEMSJMSDRASubopp-ifs/MyQ</config-property-value>
    </config-property>
    <!--
    DestinationType (string, no default)
    This must be set to the type of the destination named by the above
    "DestinationName" property.
    The EJB 2.1 spec states that this must be set to either javax.jms.Queue or
    javax.jms.Topic. OracleGJRA also allows it to be set to
    javax.jms.Destination (which works for both queues and topics).
    -->
    <config-property>
    <config-property-name>DestinationType</config-property-name>
    <config-property-value>javax.jms.Queue</config-property-value>
    </config-property>
    <!--
    Other activation-spec properties.
    The following activation-spec properties supported by OracleGJRA are optional
    except where otherwise noted:
    -->
    <!--
    ListenerThreadMaxPollInterval (milliseconds, 5000)
    Listener threads "poll" to see if there is a message waiting to be processed.
    The more frequently this polling is performed, the faster (on average) a given
    listener thread can respond to a new message. The price for frequent polling is
    overhead - the resource provider must process a receive request each time it is
    polled.
    Oracle's JMS Connector implementation applies an adaptive algorithm which
    uses shorter polling intervals (high polling rates) during periods of activity
    (once activity is noticed) and longer polling intervals (lower polling rates)
    during periods of inactivity. The ListenerThreadMaxPollInterval property places
    an upper limit on the polling interval used by this adaptive algorithm.
    -->
    <config-property>
    <config-property-name>ListenerThreadMaxPollInterval</config-property-name>
    <config-property-value>5000</config-property-value>
    </config-property>
    <!--
    AcknowledgeMode (string, default = Auto-acknowledge)
    This should be set to Auto-acknowledge or Dups-ok-acknowledge. This
    controls the quality-of-service provided by listener threads which
    consume messages and call the MDB's onMessage method.
    MessageSelector (string, default = no message filtering)
    This is the selector expression used to filter messages sent to the
    MDB's onMessage method. (I.e., this is used as the messageSelector for
    the JMS sessions created for the listener threads.)
    SubscriptionDurability (string, default = NonDurable)
    For topics this should be set to Durable or NonDurable. (This should
    not be set for queues.) This controls the durability of the topic
    consumer used by the listener thread. When SubscriptionDurability is
    set to Durable (and DestinationType is javax.jms.Topic or
    javax.jms.Destination), the SubscriptionName property is required.
    SubscriptionName (string, no default)
    This property is required when SubscriptionDurability is Durable (and
    DestinationType is javax.jms.Topic or javax.jms.Destination). (In all
    other cases it is ignored.) This is the name used when creating the
    durable subscriber used by the listener thread. For a given JMS server,
    a given subscription name should be assigned to at most one MDB (which
    must have most one listener thread).
    ClientId (string, no default)
    If set, connection(s) used by the listener threads will be set to use
    this client ID.
    TransactionTimeout (milliseconds, default = 300,000)
    This limits the amount of time that the JMS Connector will wait for a
    message to arrive before exiting the current transaction. The
    transaction manager limits the amount of time a transaction can last
    (see transaction-timeout in transaction-manager.xml).
    TransactionTimeout should be set such that the transaction manager will
    not timeout the transaction during the onMessage routine unless
    something is wrong. For example, If the transaction mananager timeout
    is set to 30 seconds, and the onMessage routine will never take more
    than 10 seconds unless something is wrong, then this property could be
    set to 20 seconds (20000 milliseconds).
    EndpointFailureRetryInterval (milliseconds, default = 60,000)
    If an endpoint can not be processed (due to the app server WorkManager
    not accepting new work), it will be scheduled to be retried this many
    milliseconds later.
    ReceiverThreads (integer, default = 1)
    This sets the maximum number of listener threads to create for this
    endpoint. For queues, using more than one thread may be useful in
    increasing the rate at which messages can be consumed. For topics this
    value should always be 1. (Each listener thread gets its own session
    and TopicSubscriber. For durable subscribers it would be an error to
    have more than one subscriber with the same subscription name. For
    nondurable subscribers having more than one thread will not help because
    more threads translates into more subscribers which translates into more
    copies of each message.) See also: ListenerThreadMinBusyDuration
    UseExceptionQueue (boolean, default = false)
    When "UseExceptionQueue" is true:
    - Messages that would otherwise be discarded are sent to the
    exception queue. (Currently the only case where this happens is
    when the max delivery count is exceeded. See MaxDeliveryCnt
    property.) Rather than sending the original message directly to
    the exception queue, the following procedure is used:
    o Create a new message of the same type.
    o Copy the properties and body from the original message to the
    new message.
    o If the headers were copied, sending the message to the
    exception queue would cause most of them to be lost
    (over-written by the resource-provider). So instead,
    translate headers in the original to properties in the copy,
    assigning each header obtained via "getJMS{Header}" to
    property "GJRA_CopyOfJMS{Header}". Since
    javax.jms.Destination is not a valid property type, translate
    destination headers into descriptive messages.
    (Currently this same service is not provided for JMSX*
    properties, most notably the JMSXDeliveryCount property.)
    o If some part of the copy process (above) or augmentation
    process (below) fails, do not abort. Attempt to complete the
    rest of the procedure. (For Bytes/Map/Stream message types,
    this can mean that part of the body is copied and the rest is
    not.)
    o If the copy process is 100% successful, add a boolean property
    called "GJRA_CopySuccessful" with the value "true".
    o Add a string property called "GJRA_DeliveryFailureReason" which
    indicates why the message was not delivered.
    o If the MDB onMessage method generated an exception immediately
    prior to the delivery failure, add a string property called
    "GJRA_onMessageExceptions" which contains exception information.
    o Send the resulting message to the exception queue.
    Note that only one attempt is made to send the message to the
    exception queue. Should this attempt fail, the message will
    be discarded without being placed in the exception queue.
    See IncludeBodiesInExceptionQueue property for potential variations
    of the above procedure.
    - The ExceptionQueueName property is required.
    - In addition to being used for the primary destination, the
    connection factory specified by the ConnectionFactoryJndiName
    property will also be used for the exception queue. If the primary
    destination (specified by the DestinationName property) is a topic,
    then the connection factory must support both queues and topics.
    (I.e., the <connectionfactory-interface> [see oc4j-ra.xml] for the
    given connection factory must be either javax.jms.ConnectionFactory
    or javax.jms.XAConnectionFactory.)
    ExceptionQueueName (string, no default)
    This is the JNDI location of the javax.jms.Queue object to use as the
    exception queue. (See UseExceptionQueue property for information about
    the use of the exception queue.) This property is required when
    UseExceptionQueue is true, and ignored when UseExceptionQueue is false.
    IncludeBodiesInExceptionQueue (boolean, default = true)
    This controls whether or not messages sent to the exception queue will
    include a message body. (See UseExceptionQueue property for information
    about the use of the exception queue.) If many messages are sent to the
    exception queue during normal operation and the message body is of no
    use in the exception queue, then this property may be set false to
    improve performance. This property is ignored when UseExceptionQueue is
    false. There are two cases where this property does not apply:
    - If the original message did not have a message body, then the
    message sent to the exception queue will not have one either.
    - If a copy of the original message can not be created for any
    reason, then the original may be sent to the exception queue
    instead. This may result in a message body being sent to the
    exception queue.
    MaxDeliveryCnt (integer, default = 5)
    If a message has the "JMSXDeliveryCount" property and the value of that
    property is greater than MaxDeliveryCnt, then the message will be
    discarded (and not sent to onMessage). If the exception queue is
    enabled (see UseExceptionQueue), a copy of the message will be sent to
    the exception queue. If MaxDeliveryCnt is set to 0, no messages will be
    discarded. (Note that when an MDB responds to a message by throwing an
    exception, the message is not considered delivered and it may be
    redelivered. If the MDB might always respond to a given message by
    throwing an exception, and MaxDeliveryCnt is set to 0 to prevent the
    message from ever being discarded, the result may be an MDB stuck in an
    "infinite loop" - failing to process the same message over and over
    again.)
    -->
    <config-property>
    <config-property-name>MaxDeliveryCnt</config-property-name>
    <config-property-value>0</config-property-value>
    </config-property>
    <!--
    LogLevel (string, no default)
    This controls the level of detail of messages logged by the JMS
    Connector. These messages are primarily intended for debugging the
    JMS Connector itself, but may also be useful when debugging issues
    related to the use of the JMS Connector. This property should not be
    set in production code. (It should only be set temporarily for
    debugging purposes - specific log messages and log levels may be and
    will be added/removed/modified in future versions of the JMS
    Connector.) Currently the allowed values are:
    ConnectionPool
    ConnectionOps
    TransactionalOps
    ListenerThreads
    INFO
    CONFIG
    FINE
    FINER
    FINEST
    SEVERE
    WARNING
    OFF
    ListenerThreadMaxIdleDuration (milliseconds, default = 300,000)
    This is how long a listener thread which is not receiving any messages
    will be kept around. (At least one listener thread will remain as long
    as the endpoint is active.)
    ListenerThreadMinBusyDuration (milliseconds, default = 10,000)
    If a listener thread has just received a message, has not been idle (had to
    wait for a new message to arrive) at any point during the past
    ListenerThreadMinBusyDuration milliseconds, and the current number of
    listener threads for this endpoint is less than ReceiverThreads, then
    (application server willing) an additional listener thread will be created.
    ResUser (string, default = null)
    ResPassword (string, default = null)
    These properties allow a user/password to be passed to the resource
    provider. When neither of these properties are set, connections used for
    this MDB's inbound message handling (as well as for exception queue
    handling, if enabled) are created using the no-argument version of the
    create*Connection method. When one or both of these properties are set,
    they are passed to the create*Connection method as the user/password
    arguments. (If only one property is not set, then 'null' is used for that
    particular create*Connection argument.) The ResPassword property supports
    the standard password indirection options (e.g., using "->joeuser" to
    represent the password of "joeuser").
    Note that the commas used in many of the above default values and examples are
    included here for readability but can not be used in the actual activation spec.
    (I.e., integer/milliseconds values in the activation spec must not include
    embedded commas.)
    -->
    </message-driven-deployment>
    </enterprise-beans>
    <assembly-descriptor>
    <default-method-access>
    <security-role-mapping name="&lt;default-ejb-caller-role>"
    impliesAll="true"/>
    </default-method-access>
    </assembly-descriptor>
    </orion-ejb-jar>

  • Lookup a MySQL Datasource with a EntityBean EJB with jboss

    Hy all,
    For a few days, i have problems to instance a datasource from my Entitybean
    EJB
    jboss release is 3.2.2 , MySQL 3.23.38
    i use mysql-connector-java-3.0.9-stable-bin.jar for jdbc connectivity
    Here is the source of my datasource mysql-ds.xml
    <datasources>
    <local-tx-datasource>
    <jndi-name>MySQLmydbDS</jndi-name>
    <connection-url>jdbc:mysql://localhost:3306/mydb</connection-url>
    <driver-class>org.gjt.mm.mysql.Driver</driver-class>
    <user-name>mylogin</user-name>
    <password>mypass</password>
    </local-tx-datasource>
    </datasources>
    The datasource is deployed in jboss cause i see the ligne as followed in the
    administration console
    http://localhost:8080/jmx-console
    a.. name=MySQLmydbDS,service=LocalTxCM
    a.. name=MySQLmydbDS,service=ManagedConnectionFactory
    a.. name=MySQLmydbDS,service=ManagedConnectionPool
    My EJB deploy without problems when i put the jar in the deploy directory
    Here is the part of the source of my EJB causing Exception
    public void setEntityContext(EntityContext context) {
    this.context = context;
    try {
    InitialContext ic = new InitialContext();
    DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/ClientDB");
    /* ----> ERROR */
    connexionBD = ds.getConnection();
    catch (Exception e) {
    throw new EJBException("Connexion � la base de donn�es impossible : "
    + e.getMessage());
    Here my ejb-jar.xml
    <ejb-jar>
    <description>Descripteur de d�ploiement pour l'EJB client</description>
    <display-name>EJB Client</display-name>
    <enterprise-beans>
    <entity>
    <description>EJB Client ( BMP )</description>
    <ejb-name>Client</ejb-name>
    <home>com.foobar.ejbs.ClientHome</home>
    <remote>com.foobar.ejbs.Client</remote>
    <ejb-class>com.foobar.ejbs.ClientBean</ejb-class>
    <persistence-type>Bean</persistence-type>
    <prim-key-class>java.lang.String</prim-key-class>
    <reentrant>False</reentrant>
    <resource-ref>
    <res-ref-name>jdbc/ClientDB</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    </entity>
    </enterprise-beans>
    <assembly-descriptor>
    <container-transaction>
    <method>
    <ejb-name>Client</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>
    And finally the jboss.xml
    <jboss>
    <enterprise-beans>
    <entity>
    <ejb-name>Client</ejb-name>
    <jndi-name>ejb/Client</jndi-name>
    <resource-ref>
    <res-ref-name>jdbc/ClientDB</res-ref-name>
    <jndi-name>MySQLmydbDS</jndi-name>
    </resource-ref>
    </entity>
    </enterprise-beans>
    </jboss>
    The error message when i execute my client :
    java.rmi.ServerException : RemoteException occured in server Thread; nested
    exception is :
    java.rmi.ServerException: EJBException:; nested exception is :
    javax.ejb.EJBException: Connexion � la base de donn�e impossible : Could not
    dereference object
    Thanks in advance if you've already seen this problem.
    Antoine

    I uses MSSQLERVER 2000,<res-ref-name>jdbc/MSSQLDS</res-ref-name>
    <jndi-name>java:/java:/MSSQLDS</jndi-name>
    but DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/MSSQLDS")cann't be execute throwing execption:
    java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
         java.rmi.ServerException: RuntimeException; nested exception is:
         java.lang.NullPointerException
         at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:292)
         at sun.rmi.transport.Transport$1.run(Transport.java:148)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
         at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
         at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
         at java.lang.Thread.run(Thread.java:534)
         at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
         at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
         at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
         at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
         at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:135)
         at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:96)
         at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
         at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:45)
         at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:100)
         at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
         at $Proxy1.loginUser(Unknown Source)
         at au.com.tusc.client.SessionBMPClient.testBean(SessionBMPClient.java:55)
         at au.com.tusc.client.SessionBMPClient.main(SessionBMPClient.java:77)
    Caused by: java.rmi.ServerException: RuntimeException; nested exception is:
         java.lang.NullPointerException
         at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:361)
         at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:195)
         at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
         at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
         at org.jboss.ejb.Container.invoke(Container.java:700)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
         at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:367)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
         at sun.rmi.transport.Transport$1.run(Transport.java:148)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
         at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
         at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
         at java.lang.Thread.run(Thread.java:534)
    Caused by: java.lang.NullPointerException
         at au.com.tusc.dao.StoreAccessDAOImpl.loginUser(StoreAccessDAOImpl.java:82)
         at au.com.tusc.session.StoreAccessSession.loginUser(StoreAccessSession.java:60)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
         at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
         at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
         at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
         at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
         at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
         at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
         at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
         ... 21 more
    you said:"Also, when you get a change I believe it recommended that the name and password are placed in the login-config.xml ".
    How where to set up name and password in the login-config.xml .
    additionally,i uses jboss3.2.3,on the jmx-console management,i cann't find "jboss;service=Hypersonic SQL",why?

  • Unable to invoke local interfaces in EJB 2, SJSAS 9 environment

    Hi,
    I am unable to get SJSAS to register local interfaces for an BMP entity bean. I am new to entity beans, and am trying out a simple case using EJB 2.0 deployed on SJSAS 9. I even had tried setting source level to 1.4, but no luck.
    EJB looks ok, as it was verified successfully by netbeans 5. But, I could not find the bean registerd when I verified it through the JNDI Brownsing utiltiy in SJSAS.
    I get the error
    javax.naming.NameNotFoundException: AccountLocal not found
    I have provided ejb-local-ref in web.xml, as shown below
    <ejb-local-ref>
    <ejb-ref-name>NewAccountLocal</ejb-ref-name>
    <ejb-ref-type>Entity</ejb-ref-type>
    <local-home>entity2.NewAccountLocalHome</local-home>
    <local>entity2.NewAccountLocal</local>
    </ejb-local-ref>
    ejb-jar.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <ejb-jar version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
    <display-name>ejbEntity2</display-name>
    <enterprise-beans>
    <entity>
    <display-name>NewAccountEB</display-name>
    <ejb-name>NewAccountBean</ejb-name>
    <local-home>entity2.NewAccountLocalHome</local-home>
    <local>entity2.NewAccountLocal</local>
    <ejb-class>entity2.NewAccountBean</ejb-class>
    <persistence-type>Bean</persistence-type>
    <prim-key-class>entity2.AccountPK</prim-key-class>
    <reentrant>false</reentrant>
    </entity>
    </enterprise-beans>
    <assembly-descriptor>
    <container-transaction>
    <method>
    <ejb-name>NewAccountBean</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>
    sun-ejb-jar.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 EJB 2.0//EN" "http://www.sun.com/software/appserver/dtds/sun-ejb-jar_2_0-0.dtd">
    <sun-ejb-jar>
    <enterprise-beans>
    <ejb>
    <ejb-name>NewAccountBean</ejb-name>
    <jndi-name>NewAccountLocal</jndi-name>
    <bean-pool>
    <steady-pool-size>1</steady-pool-size>
    <resize-quantity>1</resize-quantity>
    <max-pool-size>3</max-pool-size>
    <pool-idle-timeout-in-seconds>60</pool-idle-timeout-in-seconds>
    </bean-pool>
    <bean-cache>
    <max-cache-size>10</max-cache-size>
    <resize-quantity>1</resize-quantity>
    <removal-timeout-in-seconds>360</removal-timeout-in-seconds>
    <victim-selection-policy>LRU</victim-selection-policy>
    </bean-cache>
    </ejb>
    </enterprise-beans>
    </sun-ejb-jar>
    Access code:
    Object obj = ctx.lookup("NewAccountLocal");
    entity2.NewAccountLocalHome accHome = (entity2.NewAccountLocalHome) obj;

    Use "java:comp/env/NewAccountBean" instead. The portion relative to java:comp/env must
    exactly match the value in the <ejb-ref-name> element. There is no automatic prepending of
    "ejb" to the context relative to java:comp/env.
    Of course you could also keep the code the same, but change the value of the ejb-ref-name
    to <ejb-ref-name>ejb/NewAccountBean</ejb-ref-name>
    All that matters is that the value relative to java:comp/env and what's in the ejb-ref-name are a match.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Create EJB via WebDav

    Hi,
    I'm trying to create an EJB (both Session and Entity) using JDeveper9i with WebDav enabled.
    But I encounter the following error:
    Invalid SOURCEPATH directory (C:\http:\......
    No problem in creating other java classes.
    Is there anyone that can help me?
    I'm using WebDav on Apache httpd 1.3.24
    Thanks.
    Cheers,
    alex.

    Thanks so much for your input,
    I've completely read the document and I found this:
    Note:
    This option is available only for projects with CMP or BMP persistence.
    But I cannot find where and how to set my project persistence.
    Can you please give me another small help?
    thanks a lot
    aldo

  • Hi i when i am trying to deploy an EJB module on weblogic server i get the

    Hi all,
    when i am trying to deploy an EJB module on weblogic server i get the the following exception on the server.
    Exception:weblogic.management.ApplicationException: prepare failed for test Module: test Error: Exception preparing module: EJBModule(test,status=NEW) Unable to deploy EJB: D:\bea\weblogic81b\server\bin\myserver\upload\test.jar from test.jar: weblogic.ejb20.deployer.DeploymentDescriptorException: Unable to load a class specified in your ejb-jar.xml: Class bytes found but defineClass()failed for: 'HelloBean' at weblogic.ejb20.deployer.MBeanDeploymentInfoImpl.initializeBeanInfos(MBeanDeploymentInfoImpl.java:525) at weblogic.ejb20.deployer.MBeanDeploymentInfoImpl.(MBeanDeploymentInfoImpl.java:230) at weblogic.ejb20.deployer.EJBDeployer.prepare(EJBDeployer.java:1256) at weblogic.ejb20.deployer.EJBModule.prepare(EJBModule.java:449) at weblogic.j2ee.J2EEApplicationContainer.prepareModule(J2EEApplicationContainer.java:2792) at weblogic.j2ee.J2EEApplicationContainer.prepareModules(J2EEApplicationContainer.java:1478) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1136) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:975) at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.prepareContainer(SlaveDeployer.java:2571) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.createContainer(SlaveDeployer.java:2523) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2453) at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:820) at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:536) at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:494) at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:178) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:151)
    [Deployer:149033]preparing application test on myserver
    [Deployer:149033]failed application test on myserver
    [Deployer:149034]An exception occurred for task [Deployer:149026]Deploy application test on myserver.: Exception:weblogic.management.ApplicationException: prepare failed for test Module: test Error: Exception preparing module: EJBModule(test,status=NEW) Unable to deploy EJB: D:\bea\weblogic81b\server\bin\myserver\upload\test.jar from test.jar: weblogic.ejb20.deployer.DeploymentDescriptorException: Unable to load a class specified in your ejb-jar.xml: Class bytes found but defineClass()failed for: 'HelloBean' at weblogic.ejb20.deployer.MBeanDeploymentInfoImpl.initializeBeanInfos(MBeanDeploymentInfoImpl.java:525) at weblogic.ejb20.deployer.MBeanDeploymentInfoImpl.(MBeanDeploymentInfoImpl.java:230) at weblogic.ejb20.deployer.EJBDeployer.prepare(EJBDeployer.java:1256) at weblogic.ejb20.deployer.EJBModule.prepare(EJBModule.java:449) at weblogic.j2ee.J2EEApplicationContainer.prepareModule(J2EEApplicationContainer.java:2792) at weblogic.j2ee.J2EEApplicationContainer.prepareModules(J2EEApplicationContainer.java:1478) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1136) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:975) at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.prepareContainer(SlaveDeployer.java:2571) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.createContainer(SlaveDeployer.java:2523) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2453) at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:820) at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:536) at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:494) at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:178) at weblogic.kernel.ExecuteThread.run(ExecuteThread

    Hi, i am also facing the same problem.......
    my ejb-jar.xml is
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar >
    <description><![CDATA[No Description.]]></description>
    <display-name>Generated by XDoclet</display-name>
    <enterprise-beans>
    <!-- Session Beans -->
    <!--
    To add session beans that you have deployment descriptor info for, add
    a file to your XDoclet merge directory called session-beans.xml that contains
    the <session></session> markup for those beans.
    -->
    <!-- Entity Beans -->
    <entity >
    <description><![CDATA[Description for Account]]></description>
    <display-name>Name for Account</display-name>
    <ejb-name>Account</ejb-name>
    <home>com.app.j2ee.bmp.interfaces.AccountHome</home>
    <remote>com.app.j2ee.bmp.interfaces.Account</remote>
    <local-home>com.app.j2ee.bmp.interfaces.AccountLocalHome</local-home>
    <local>com.app.j2ee.bmp.interfaces.AccountLocal</local>
    <ejb-class>com.app.j2ee.bmp.ejb.AccountBean</ejb-class>
    <persistence-type>Bean</persistence-type>
    <prim-key-class>com.app.j2ee.bmp.interfaces.AccountPK</prim-key-class>
    <reentrant>False</reentrant>
              <resource-ref>
              <res-ref-name>jdbc/ejbPool</res-ref-name>
              <res-type>javax.sql.DataSource</res-type>
              <res-auth>Container</res-auth>
              </resource-ref>
    </entity>
    </enterprise-beans>
    <!-- Relationships -->
    <!-- Assembly Descriptor -->
    <!--
    To specify your own assembly descriptor info here, add a file to your
    XDoclet merge directory called assembly-descriptor.xml that contains
    the <assembly-descriptor></assembly-descriptor> markup.
    -->
    <assembly-descriptor >
    <!--
    To specify additional security-role elements, add a file in the merge
    directory called ejb-security-roles.xml that contains them.
    -->
    <!-- method permissions -->
    <!--
    To specify additional method-permission elements, add a file in the merge
    directory called ejb-method-permissions.ent that contains them.
    -->
    <!-- transactions -->
    <!--
    To specify additional container-transaction elements, add a file in the merge
    directory called ejb-container-transactions.ent that contains them.
    -->
    <!-- finder transactions -->
    <!-- message destinations -->
    <!--
    To specify additional message-destination elements, add a file in the merge
    directory called ejb-message-destinations.ent that contains them.
    -->
    <!-- exclude list -->
    <!--
    To specify an exclude-list element, add a file in the merge directory
    called ejb-exclude-list.xml that contains it.
    -->
    <container-transaction>
              <method>
              <ejb-name>Account</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>*</method-name>
              </method>
              <method>
              <ejb-name>Account</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>*</method-name>
              </method>
              <trans-attribute>Required</trans-attribute>
         </container-transaction>
    </assembly-descriptor>
    </ejb-jar>

  • Exception [EJB - 10008]: Cannot find bean of type [SalesBean] using finder

    I'm trying to call an entity bean froma session bean i get the error :-
    7/02/27 14:35:25 javax.ejb.ObjectNotFoundException: Exception [EJB - 10008]: Cannot find bean of type [SalesBean] using finde
    [findByCustID].
    7/02/27 14:35:25       at oracle.toplink.internal.ejb.cmp.EJBExceptionFactory.objectNotFound(EJBExceptionFactory.java:325)
    7/02/27 14:35:25       at oracle.toplink.internal.ejb.cmp.finders.Finder.checkNullResult(Finder.java:224)
    My session bean looks like this :-
    public class HelloBean implements SessionBean
      public String helloWorld (String pzCustomerID) throws SQLException,RemoteException
         String lzRevenue=null;
         int liCustomerID=Integer.parseInt(pzCustomerID);
         try
              Context initial = new InitialContext();
              Object objref =   initial.lookup("SalesBean");
              SalesHome salesHome =(SalesHome) PortableRemoteObject.narrow(objref,SalesHome.class);
              Sales sales=salesHome.findByCustID(liCustomerID);
              lzRevenue=(String) sales.findByCustID(liCustomerID);
    My entity bean looks like this:-
    public class SalesBean implements EntityBean
      public String factPK;
      public int timeID;
      public int custID;
      public int locID;
      public int itemID;
      public int entityID;
      public String currency;
      public float qty;
      public float unitPrice;
      public float amount;
      public EntityContext context;
      private Connection con;
        private void makeConnection() {
            try {
                InitialContext ic = new InitialContext();
                javax.sql.DataSource ds = (javax.sql.DataSource) ic.lookup("jdbc/DSource");
                con = ds.getConnection();
            } catch (Exception ex) {
                throw new EJBException("Unable to connect to database. " +
                    ex.getMessage());
      public SalesBean()
      public String ejbFindByCustID(int custID) throws SQLException,RemoteException,FinderException
         makeConnection();
         PreparedStatement pstmt = con.prepareStatement("select sum(amount) from sales where cust_id= ? ");
         pstmt.setInt(1, custID);
         ResultSet rset = pstmt.executeQuery();
         if (!rset.next())
              throw new RemoteException("no records present" );
         return rset.getString(1);
      }My entity bean's home interface looks like this:-
    public interface SalesHome extends EJBHome
    public Sales create() throws RemoteException, CreateException;
    public Sales findByCustID(int custID) throws SQLException,RemoteException,FinderException;
    My entity bean's remote interface looks like this:-
    public interface Sales extends EJBObject
         public String findByCustID(int custID) throws SQLException,RemoteException,FinderException;
    my ejb-jar.xml looks like this:-
    <enterprise-beans>
    <session>
    <description>Hello Bean</description>
    <ejb-name>HelloBean</ejb-name>
    <home>myEjb.HelloHome</home>
    <remote>myEjb.HelloRemote</remote>
    <ejb-class>myEjb.HelloBean</ejb-class>
    <session-type>Stateful</session-type>
    <transaction-type>Container</transaction-type>
    </session>
         <entity>
              <ejb-name>SalesBean</ejb-name>
              <home>myEjb.SalesHome</home>
              <remote>myEjb.Sales</remote>
              <ejb-class>myEjb.SalesBean</ejb-class>
              <persistence-type>Container</persistence-type>
              <prim-key-class>java.lang.String</prim-key-class>
              <reentrant>False</reentrant>
              <cmp-field>
              <field-name>factPK</field-name>
         </cmp-field>
         <cmp-field>
              <field-name>timeID</field-name>
         </cmp-field>
         <cmp-field>
              <field-name>custID</field-name>
         </cmp-field>
         <cmp-field>
              <field-name>locID</field-name>
         </cmp-field>
         <cmp-field>
              <field-name>itemID</field-name>
         </cmp-field>
         <cmp-field>
              <field-name>entityID</field-name>
         </cmp-field>
         <cmp-field>
              <field-name>currency</field-name>
         </cmp-field>
         <cmp-field>
              <field-name>qty</field-name>
         </cmp-field>
         <cmp-field>
              <field-name>unitPrice</field-name>
         </cmp-field>
         <cmp-field>
              <field-name>amount</field-name>
         </cmp-field>
              <primkey-field>factPK</primkey-field>
              <resource-ref>
              <res-ref-name>jdbc/DSource</res-ref-name>
              <res-type>javax.sql.DataSource</res-type>
              <res-auth>Container</res-auth>
         </resource-ref>
         </entity>
    </enterprise-beans>
    please help me out of this trouble.

    I'm trying to call an entity bean froma session bean i get the error :-
    7/02/27 14:35:25 javax.ejb.ObjectNotFoundException: Exception [EJB - 10008]: Cannot find bean of type [SalesBean] using finde
    [findByCustID].
    7/02/27 14:35:25       at oracle.toplink.internal.ejb.cmp.EJBExceptionFactory.objectNotFound(EJBExceptionFactory.java:325)
    7/02/27 14:35:25       at oracle.toplink.internal.ejb.cmp.finders.Finder.checkNullResult(Finder.java:224)
    My session bean looks like this :-
    public class HelloBean implements SessionBean
      public String helloWorld (String pzCustomerID) throws SQLException,RemoteException
         String lzRevenue=null;
         int liCustomerID=Integer.parseInt(pzCustomerID);
         try
              Context initial = new InitialContext();
              Object objref =   initial.lookup("SalesBean");
              SalesHome salesHome =(SalesHome) PortableRemoteObject.narrow(objref,SalesHome.class);
              Sales sales=salesHome.findByCustID(liCustomerID);
              lzRevenue=(String) sales.findByCustID(liCustomerID);
    My entity bean looks like this:-
    public class SalesBean implements EntityBean
      public String factPK;
      public int timeID;
      public int custID;
      public int locID;
      public int itemID;
      public int entityID;
      public String currency;
      public float qty;
      public float unitPrice;
      public float amount;
      public EntityContext context;
      private Connection con;
        private void makeConnection() {
            try {
                InitialContext ic = new InitialContext();
                javax.sql.DataSource ds = (javax.sql.DataSource) ic.lookup("jdbc/DSource");
                con = ds.getConnection();
            } catch (Exception ex) {
                throw new EJBException("Unable to connect to database. " +
                    ex.getMessage());
      public SalesBean()
      public String ejbFindByCustID(int custID) throws SQLException,RemoteException,FinderException
         makeConnection();
         PreparedStatement pstmt = con.prepareStatement("select sum(amount) from sales where cust_id= ? ");
         pstmt.setInt(1, custID);
         ResultSet rset = pstmt.executeQuery();
         if (!rset.next())
              throw new RemoteException("no records present" );
         return rset.getString(1);
      }My entity bean's home interface looks like this:-
    public interface SalesHome extends EJBHome
    public Sales create() throws RemoteException, CreateException;
    public Sales findByCustID(int custID) throws SQLException,RemoteException,FinderException;
    My entity bean's remote interface looks like this:-
    public interface Sales extends EJBObject
         public String findByCustID(int custID) throws SQLException,RemoteException,FinderException;
    my ejb-jar.xml looks like this:-
    <enterprise-beans>
    <session>
    <description>Hello Bean</description>
    <ejb-name>HelloBean</ejb-name>
    <home>myEjb.HelloHome</home>
    <remote>myEjb.HelloRemote</remote>
    <ejb-class>myEjb.HelloBean</ejb-class>
    <session-type>Stateful</session-type>
    <transaction-type>Container</transaction-type>
    </session>
         <entity>
              <ejb-name>SalesBean</ejb-name>
              <home>myEjb.SalesHome</home>
              <remote>myEjb.Sales</remote>
              <ejb-class>myEjb.SalesBean</ejb-class>
              <persistence-type>Container</persistence-type>
              <prim-key-class>java.lang.String</prim-key-class>
              <reentrant>False</reentrant>
              <cmp-field>
              <field-name>factPK</field-name>
         </cmp-field>
         <cmp-field>
              <field-name>timeID</field-name>
         </cmp-field>
         <cmp-field>
              <field-name>custID</field-name>
         </cmp-field>
         <cmp-field>
              <field-name>locID</field-name>
         </cmp-field>
         <cmp-field>
              <field-name>itemID</field-name>
         </cmp-field>
         <cmp-field>
              <field-name>entityID</field-name>
         </cmp-field>
         <cmp-field>
              <field-name>currency</field-name>
         </cmp-field>
         <cmp-field>
              <field-name>qty</field-name>
         </cmp-field>
         <cmp-field>
              <field-name>unitPrice</field-name>
         </cmp-field>
         <cmp-field>
              <field-name>amount</field-name>
         </cmp-field>
              <primkey-field>factPK</primkey-field>
              <resource-ref>
              <res-ref-name>jdbc/DSource</res-ref-name>
              <res-type>javax.sql.DataSource</res-type>
              <res-auth>Container</res-auth>
         </resource-ref>
         </entity>
    </enterprise-beans>
    please help me out of this trouble.

  • Defining a many-to-many relationship with CMP EJBs  : does it work for you

    Curious to know whether someone has been able to set up a many to many relationship between two entity beans.
    I have been struggling with this for days now and I can't get it to work.
    In my test project I have two entity beans, resp. Consultant and Solution.
    Consultant has a cmr field called 'solutions', which is a collection object from the opposite side (Solution).
    This is the source of the ejb-jar.xml file
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar>
         <description>EJB JAR description</description>
         <display-name>EJB JAR</display-name>
         <enterprise-beans>
              <session>
                   <ejb-name>ProfilerBean</ejb-name>
                   <home>com.atosorigin.tcc.testing.ejbses.profiling.ProfilerHome</home>
                   <remote>com.atosorigin.tcc.testing.ejbses.profiling.Profiler</remote>
                   <local-home>com.atosorigin.tcc.testing.ejbses.profiling.ProfilerLocalHome</local-home>
                   <local>com.atosorigin.tcc.testing.ejbses.profiling.ProfilerLocal</local>
                   <ejb-class>com.atosorigin.tcc.testing.ejbses.profiling.ProfilerBean</ejb-class>
                   <session-type>Stateless</session-type>
                   <transaction-type>Container</transaction-type>
                   <ejb-local-ref>
                        <ejb-ref-name>EJBTesting/Solution</ejb-ref-name>
                        <ejb-ref-type>Entity</ejb-ref-type>
                        <local-home>com.atosorigin.tcc.testing.ejbcmp.profiling.SolutionLocalHome</local-home>
                        <local>com.atosorigin.tcc.testing.ejbcmp.profiling.SolutionLocal</local>
                        <ejb-link>SolutionBean</ejb-link>
                   </ejb-local-ref>
                   <ejb-local-ref>
                        <ejb-ref-name>EJBTesting/Consultant</ejb-ref-name>
                        <ejb-ref-type>Entity</ejb-ref-type>
                        <local-home>com.atosorigin.tcc.testing.ejbcmp.profiling.ConsultantLocalHome</local-home>
                        <local>com.atosorigin.tcc.testing.ejbcmp.profiling.ConsultantLocal</local>
                        <ejb-link>ConsultantBean</ejb-link>
                   </ejb-local-ref>
              </session>
              <entity>
                   <ejb-name>ConsultantBean</ejb-name>
                   <home>com.atosorigin.tcc.testing.ejbcmp.profiling.ConsultantHome</home>
                   <remote>com.atosorigin.tcc.testing.ejbcmp.profiling.Consultant</remote>
                   <local-home>com.atosorigin.tcc.testing.ejbcmp.profiling.ConsultantLocalHome</local-home>
                   <local>com.atosorigin.tcc.testing.ejbcmp.profiling.ConsultantLocal</local>
                   <ejb-class>com.atosorigin.tcc.testing.ejbcmp.profiling.ConsultantBean</ejb-class>
                   <persistence-type>Container</persistence-type>
                   <prim-key-class>java.lang.String</prim-key-class>
                   <reentrant>False</reentrant>
                   <cmp-version>2.x</cmp-version>
                   <abstract-schema-name>Consultant</abstract-schema-name>
                   <cmp-field>
                        <field-name>firstname</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>lastname</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>country</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>id</field-name>
                   </cmp-field>
                   <primkey-field>id</primkey-field>
                   <query>
                        <query-method>
                             <method-name>findBySolution</method-name>
                             <method-params>
                                  <method-param>java.lang.String</method-param>
                             </method-params>
                        </query-method>
                        <ejb-ql>SELECT Object(c) FROM Consultant AS c,
                        IN(c.solutions) s WHERE s.id = ?1 </ejb-ql>
                   </query>
              </entity>
              <entity>
                   <ejb-name>SolutionBean</ejb-name>
                   <home>com.atosorigin.tcc.testing.ejbcmp.profiling.SolutionHome</home>
                   <remote>com.atosorigin.tcc.testing.ejbcmp.profiling.Solution</remote>
                   <local-home>com.atosorigin.tcc.testing.ejbcmp.profiling.SolutionLocalHome</local-home>
                   <local>com.atosorigin.tcc.testing.ejbcmp.profiling.SolutionLocal</local>
                   <ejb-class>com.atosorigin.tcc.testing.ejbcmp.profiling.SolutionBean</ejb-class>
                   <persistence-type>Container</persistence-type>
                   <prim-key-class>java.lang.String</prim-key-class>
                   <reentrant>False</reentrant>
                   <cmp-version>2.x</cmp-version>
                   <abstract-schema-name>Solution</abstract-schema-name>
                   <cmp-field>
                        <field-name>description</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>name</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>parent</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>id</field-name>
                   </cmp-field>
                   <primkey-field>id</primkey-field>
                   <query>
                        <query-method>
                             <method-name>findChildSolutions</method-name>
                             <method-params>
                                  <method-param>java.lang.String</method-param>
                             </method-params>
                        </query-method>
                        <ejb-ql>SELECT Object(s) FROM Solution AS s WHERE
                        s.parent = ?1</ejb-ql>
                   </query>
                   <query>
                        <query-method>
                             <method-name>findTopLevelSolutions</method-name>
                             <method-params/>
                        </query-method>
                        <ejb-ql>Select Object(s) FROM Solution AS s WHERE
                        (s.parent = &apos;none&apos;)</ejb-ql>
                   </query>
              </entity>
         </enterprise-beans>
         <relationships>
              <ejb-relation>
                   <description>A consultant may have one or more areas of expertise</description>
                   <ejb-relation-name>Consultant_Solutions</ejb-relation-name>
                   <ejb-relationship-role>
                        <ejb-relationship-role-name>com.atosorigin.tcc.testing.ejbcmp.profiling.ConsultantBean</ejb-relationship-role-name>
                        <multiplicity>Many</multiplicity>
                        <relationship-role-source>
                             <ejb-name>ConsultantBean</ejb-name>
                        </relationship-role-source>
                        <cmr-field>
                             <cmr-field-name>solutions</cmr-field-name>
                             <cmr-field-type>java.util.Collection</cmr-field-type>
                        </cmr-field>
                   </ejb-relationship-role>
                   <ejb-relationship-role>
                        <ejb-relationship-role-name>com.atosorigin.tcc.testing.ejbcmp.profiling.SolutionBean</ejb-relationship-role-name>
                        <multiplicity>Many</multiplicity>
                        <relationship-role-source>
                             <ejb-name>SolutionBean</ejb-name>
                        </relationship-role-source>
                   </ejb-relationship-role>
              </ejb-relation>
         </relationships>
         <assembly-descriptor>
              <container-transaction>
                   <description>container-transaction</description>
                   <method>
                        <ejb-name>SolutionBean</ejb-name>
                        <method-name>*</method-name>
                   </method>
                   <method>
                        <ejb-name>ProfilerBean</ejb-name>
                        <method-name>*</method-name>
                   </method>
                   <method>
                        <ejb-name>ConsultantBean</ejb-name>
                        <method-name>*</method-name>
                   </method>
                   <trans-attribute>Required</trans-attribute>
              </container-transaction>
         </assembly-descriptor>
    </ejb-jar>
    I created a stateless session bean as a business facade for the two entity beans. I then created a webservice to test the beans.
    What works :
    - create a consultant
    - get a consultant
    - create a solution
    - get a solution
    (basically everything that doesn't involve the relationship field.
    However, what doesn't work is the method call assignSolution:
    - assign solution : this is implemented as follows
    Business Method.
         public void assignSolution(String consultantID, String solutionID)
              throws ProfilingException {
              // TODO : Implement
              ConsultantLocal cons = null;
              SolutionLocal sol = null;
              try {
                   cons = consHome.findByPrimaryKey(consultantID);
                   sol = solHome.findByPrimaryKey(solutionID);
                   Collection solutions = cons.getSolutions();
                   solutions.add(sol);
                   //sol.getConsultants().add(cons);
              } catch (FinderException ex) {
                   ex.printStackTrace();
                   throw new ProfilingException("failed to retrieve data from DB", ex);
    As you can see I am trying to use the CM Relationship in this methhod. Adding the solution to a consultant should be as simple as adding a solution object to the collection retrieved with the getSolutions accessor. The Container is expected to persist the information in my MAXDB database.
    However this doesn't happen.
    The ORM details as defined in the persistent.xml follows :
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE persistent-ejb-map SYSTEM "persistent.dtd">
    <persistent-ejb-map>
         <locking
              type="Table"/>
         <db-properties>
              <data-source-name>TCC_PORTAL_PROFILER</data-source-name>
              <database-vendor
                   name="SAPDB"/>
         </db-properties>
         <entity-beans>
              <entity-bean>
                   <ejb-name>ConsultantBean</ejb-name>
                   <table-name>PFL_CONSULTANTS</table-name>
                   <field-map
                        key-type="NoKey">
                        <field-name>firstname</field-name>
                        <column>
                             <column-name>FIRSTNAME</column-name>
                        </column>
                   </field-map>
                   <field-map
                        key-type="NoKey">
                        <field-name>lastname</field-name>
                        <column>
                             <column-name>LASTNAME</column-name>
                        </column>
                   </field-map>
                   <field-map
                        key-type="NoKey">
                        <field-name>country</field-name>
                        <column>
                             <column-name>COUNTRY</column-name>
                        </column>
                   </field-map>
                   <field-map
                        key-type="PrimaryKey">
                        <field-name>id</field-name>
                        <column>
                             <column-name>ID</column-name>
                        </column>
                   </field-map>
                   <finder-descriptor>
                        <method-name>findBySolution</method-name>
                        <method-params>
                             <method-param>java.lang.String</method-param>
                        </method-params>
                        <load-selected-objects
                             lock="read"/>
                   </finder-descriptor>
              </entity-bean>
              <entity-bean>
                   <ejb-name>SolutionBean</ejb-name>
                   <table-name>PFL_SAPSOLUTIONS</table-name>
                   <field-map
                        key-type="NoKey">
                        <field-name>description</field-name>
                        <column>
                             <column-name>DESCRIPTION</column-name>
                        </column>
                   </field-map>
                   <field-map
                        key-type="NoKey">
                        <field-name>name</field-name>
                        <column>
                             <column-name>NAME</column-name>
                        </column>
                   </field-map>
                   <field-map
                        key-type="NoKey">
                        <field-name>parent</field-name>
                        <column>
                             <column-name>PARENTID</column-name>
                        </column>
                   </field-map>
                   <field-map
                        key-type="PrimaryKey">
                        <field-name>id</field-name>
                        <column>
                             <column-name>ID</column-name>
                        </column>
                   </field-map>
                   <finder-descriptor>
                        <method-name>findChildSolutions</method-name>
                        <method-params>
                             <method-param>java.lang.String</method-param>
                        </method-params>
                        <load-selected-objects
                             lock="read"/>
                   </finder-descriptor>
                   <finder-descriptor>
                        <method-name>findTopLevelSolutions</method-name>
                        <method-params/>
                        <load-selected-objects
                             lock="read"/>
                   </finder-descriptor>
              </entity-bean>
         </entity-beans>
         <relationships>
              <table-relation>
                   <help-table>PFL_CONS_SOL_MAP</help-table>
                   <table-relationship-role
                        key-type="PrimaryKey">
                        <ejb-name>ConsultantBean</ejb-name>
                        <cmr-field>solutions</cmr-field>
                        <fk-column>
                             <column-name>CONSULTANTID</column-name>
                             <pk-field-name>id</pk-field-name>
                        </fk-column>
                   </table-relationship-role>
                   <table-relationship-role
                        key-type="PrimaryKey">
                        <ejb-name>SolutionBean</ejb-name>
                        <fk-column>
                             <column-name>SOLUTIONID</column-name>
                             <pk-field-name>id</pk-field-name>
                        </fk-column>
                   </table-relationship-role>
              </table-relation>
         </relationships>
    </persistent-ejb-map>
    The error in the default trace file when calling the method states, there is an "inconsistency in the number of primary keys". Details follow.
    #1.5#000F1F188E5C004400000000000010480003E76C80EFD57A#1098880364327#com.sap.engine.services.ejb#com.atosorigin.tcc/EJBCMPProfilingTest#com.sap.engine.services.ejb#Guest#2####4d2b2370281411d9a40d000f1f188e5c#SAPEngine_Application_Thread[impl:3]_31##0#0#Error##Java###
    [EXCEPTION]
    #1#com.sap.engine.services.ejb.exceptions.BaseRemoteException: Exception in method assignSolution.
         at com.atosorigin.tcc.testing.ejbses.profiling.ProfilerObjectImpl0.assignSolution(ProfilerObjectImpl0.java:822)
         at com.atosorigin.tcc.testing.ejbses.profiling.Profiler_Stub.assignSolution(Profiler_Stub.java:533)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.sap.engine.services.ejb.session.stateless_sp5.ObjectStubProxyImpl.invoke(ObjectStubProxyImpl.java:187)
         at $Proxy73.assignSolution(Unknown Source)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.sap.engine.services.webservices.runtime.EJBImplementationContainer.invokeMethod(EJBImplementationContainer.java:126)
         at com.sap.engine.services.webservices.runtime.RuntimeProcessor.process(RuntimeProcessor.java:146)
         at com.sap.engine.services.webservices.runtime.RuntimeProcessor.process(RuntimeProcessor.java:68)
         at com.sap.engine.services.webservices.runtime.servlet.ServletDispatcherImpl.doPost(ServletDispatcherImpl.java:92)
         at SoapServlet.doPost(SoapServlet.java:51)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:385)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:263)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:339)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:317)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:810)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:238)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:147)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
         at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)
    Caused by: com.sap.engine.services.applocking.exception.SAPAppLockingIllegalArgumentException: Inconsistency in number of primary keys
         at com.sap.engine.services.applocking.TableLockingImpl.getArgument(TableLockingImpl.java:385)
         at com.sap.engine.services.applocking.TableLockingImpl.lock(TableLockingImpl.java:128)
         at com.sap.engine.services.applocking.TableLockingImpl.lock(TableLockingImpl.java:138)
         at com.sap.engine.services.ejb.entity.pm.lock.TableLockingSystem.write(TableLockingSystem.java:82)
         at com.sap.engine.services.ejb.entity.pm.PersistentM2M.create(PersistentM2M.java:172)
         at com.sap.engine.services.ejb.entity.pm.PersistentCacheM2M.add(PersistentCacheM2M.java:197)
         at com.sap.engine.services.ejb.entity.pm.multiple.CollectionM2M.add(CollectionM2M.java:57)
         at com.atosorigin.tcc.testing.ejbses.profiling.ProfilerBean.assignSolution(ProfilerBean.java:201)
         at com.atosorigin.tcc.testing.ejbses.profiling.ProfilerObjectImpl0.assignSolution(ProfilerObjectImpl0.java:771)
         ... 32 more
    I can't figure out what the problem is with the ORM mapping defined.
    On the database level I have three tables. Consultant maps to PFL_CONSULTANT, Solution to PFL_SAPSOLUTIONS. The third table PFL_CONS_SOL_MAP is the help table used for the relationship (having two fields, which are in fact foreign keys from the other two tables to express the assignment of solutions to consultants (where a consultant can have one or more solutions).
    ps. : I am running Netweaver Developer Workplace (Netweaver 2004, at stack level 5)
    Message was edited by: Theo Paesen

    Hm, after disabling 'automatic locking' it works.

Maybe you are looking for

  • FaceTime does not connect, iChat video does not work, Skype video does not work (LION)

    Hi everyone, I am using OS X 10.7.3 2011 Macbook Pro 2.2 Ghz Intel Core I7 8GG 1333MHz DDR3 RAM 500GB HD. What happens when I try to call someone in FaceTime: Webcam light is on and I see myself on my screen. It rings and after a while it says "X is

  • HT1338 how to make my MacBook pro faster

    I was wondering if there is any software to clean and make my MacBook Pro faster and lighter??? I heard about the MacKeeper but I get some negative feedback about it....

  • Multiple files need to be uploaded

    hi guys, I have a jsp form on which i accept from user the data ,images file and one or more audio-video file. Can anyone tell me how to upload multiple files at a time.I was able to upload only one file at a time.How to upload more than one file on

  • SEM 4.0 - BPS Planning Function - Currency Translation (Account Based) !

    Hi, Currently we are migrating from SEM 3.1 to SEM 4.0  and we are using Currency Translation (Account Based)and would like to use the same functionality, but for some reason the CT functionality is not working properly.  It is throwing garbage numbe

  • EJB Vs JSP/POJO/Servlets, etc

    I'm familiar with several J2EE technologies and decided to start learning some design patterns. EJB comes up a lot in the business tier, so I've been looking at more info about them. What I can't find a clear answer on at the moment is why exactly yo