Bean Managed Entity Beans(EJB) using Tangosol.
I am trying to use Bean Managed Entity Beans using Tangosol Coherence.
The entity bean is currently configured in the weblogic-ejb-jar.xml with:
<max-beans-in-cache>200</max-beans-in-cache>
In the public void ejbLoad() method, I am calling the Tangosol Cache to load the entity bean.
If we have have more that 200 request coming at the same time, we get an OutOfMemoryError exception.
Is there anyway to overcome this limitation by somehow having the ejb cache to use the tangosol cache?
Thanks for any help in advance.
Krishan
So far, it's not immediately obvious to us what the exact problem is that you are seeing. It sounds like the VM would be using at least 200MB just for the application server's own internal cache, for example, and that you are also using Coherence within the application server to provide additional caching.
If possible, we should set up a phone call with you and your team, and we could get an engineer from our end to walk through your specific use case with you, so that we could understand what the exact technical challenge(s) is(are) in this particular application.
Peace.
p.s. You can email [email protected] directly to schedule a call.
Similar Messages
-
Clustering read-only bean-managed entity ejbs
I'm designing a data caching approach that relies on using read-only entity ejbs with bean-managed persistence. My design is based on the fact that WebLogic blocks on entity bean access by concurrent users for a given bean instance (unique primary key). I would like to keep only one entity bean instance active(timeoutSetting=0) for eacy primary key for all users to share. That way I only have to hit the database one time to initially populate data in the entity bean. I'm worried about this approach in a WebLogic clustered environment. From reading notes in this newsgroup and other doc, it appears that WebLogic might not use one instance of the entity bean (based upon unique primary key) in a clustered environment. Is that true (that being multiple users could get their own instance of the entity bean with the same primary key)?
Thanks,
Bryan
Typically, the read-write EJBs are on each WL server instance, so there is
no remote invocation -- it is all done by reference.
Cameron Purdy
Tangosol, Inc.
http://www.tangosol.com
+1.617.623.5782
WebLogic Consulting Available
"Bryan Dixon" <[email protected]> wrote in message
news:[email protected]...
>
> I guess I'm confused about read-write (not read-only) entity beans being
pinned or not. This is from WebLogic 5.1 EJB doc:
> "read-write entity EJBs do not use a clustered EJBObject stub; a client's
method calls to a particular EJB always go to a single WebLogic Server
instance. If the server that a client is using fails, the client must
re-find the entity EJB using the cluster-aware home stub."
>
> Doesn't that mean the entity bean instance for a primary key is pinned to
a single WebLogic Server instance? Maybe I'm just misunderstanding
terminology about what a "particular EJB" is - I was thinking it is an
entity bean instance for a unique primary key.
>
> Thanks,
> Bryan
>
>
> "Cameron Purdy" <[email protected]> wrote:
> >>I was thinking that read-write entity beans were pinned.
> >
> >Not unless you pin them. Basically, that means that the JAR/XML that
> >contains/specifies the EJB only is on one server.
> >
> >> So if two separate weblogic instances in a cluster did a find on an
entity
> >ejb with the same primary key and then performed some business method on
> >that entity ejb, would there really be two separate bean instances in
each
> >weblogic instance for the same primary key?
> >
> >If it is not pinned, yes.
> >
> >--
> >Cameron Purdy
> >Tangosol, Inc.
> >http://www.tangosol.com
> >+1.617.623.5782
> >WebLogic Consulting Available
> >
> >
> >"Bryan Dixon" <[email protected]> wrote in message
> >news:[email protected]...
> >>
> >> Toa, thanks again.
> >>
> >> There are a couple of things I'm not clear about though. One is that I
> >want one instance of an entity bean per primary key, not a singleton of
the
> >entity bean itself. How would JNDI in a clustered environment help me
> >there?
> >>
> >> The other question I have is about having multiple instances of an
entity
> >bean for the same primary key in the cluster. I was thinking that
> >read-write entity beans were pinned. So if two separate weblogic
instances
> >in a cluster did a find on an entity ejb with the same primary key and
then
> >performed some business method on that entity ejb, would there really be
two
> >separate bean instances in each weblogic instance for the same primary
key?
> >>
> >> Thanks again,
> >> Bryan
> >>
> >> "Tao Zhang" <[email protected]> wrote:
> >> >
> >> >"Bryan Dixon" <[email protected]> wrote:
> >> >>
> >> >>The reason I was wanting one instance per primary key is that I want
to
> >use this entity bean to cache some data from database tables. This data
> >doesn't change frequently, so we were wanting to get it from this entity
> >bean's memory instead of constantly hitting the database. This data is
> >global to all users, so we don't want to store it in stateful session
beans.
> >> >>
> >> >>After reading more about the read-only cache-strategy it doesn't
appear
> >that any sycnhronization will occur if the entity bean for a given
primary
> >key is updated (state data is updated) in one weblogic instance, that
change
> >will not get synced up with other weblogic instances for that same
primary
> >key. Is that correct?
> >> >>
> >> >It's correct. If you do want to have exact one copy in the cluster.
You
> >can read Using JNDI in cluster environment.
> >> >
> >> >>If I deploy this entity bean with read-write cache-strategy the
WebLogic
> >doc reads as if I will get one instance per primary key that is pinned to
> >one WebLogic instance and I won't get any fail-over or load-balancing on
the
> >ejbObject (the entity bean instance). Did I read this correctly? If
that
> >is the case, what is the advantage of setting up read-write entity beans
to
> >be clusterable - just the Home objects? I definitely could be
> >misunderstanding something in the doc since I'm very new to clustering.
> >> "Tao
> >> >Zhang"
> >> ><[email protected]> wrote:
> >> >>>
> >> >
> >> >It's not only instance in the cluster. Probably many instances.
> >> >
> >> >If you use 2 tier clustering, failover will not happen because of
> >co-location. But if you use 3 tier cluster, you can write the special
code
> >in the client side to do failover and load-balance.
> >> >
> >> >In a 2 tier cluster, actually the ejb load balancing and failover is
> >almost useless.
> >> >
> >> >But in 3 tier, you can use it.
> >> >
> >> >Hope this help.
> >> >
> >> >
> >> >
> >> >>>"Bryan Dixon" <[email protected]> wrote:
> >> >>>>
> >> >>>>Thanks Tao.
> >> >>>>
> >> >>>>A couple more questions...
> >> >>>>I was planning deploying this entity bean with the read-only
> >cache-strategy which means our transaction attribute would be
> >TXN_NOT_SUPPORTED. Also, our db isolation is TRANSACTION_READ_COMMITTED.
> >> >>>>
> >> >>>>Based upon how I was planning on deploying this entity bean, would
> >WebLogic create an instance of the bean for each primary key in each
> >cluster? I'm just trying to figure out how many duplicate bean instances
> >for the primary key I could have across all clusters. I was really just
> >wanting one instance that is shared among all clients and was hoping that
> >the clustering would provide me with fail-over if that one cluster went
> >down.
> >> >>>>
> >> >>>If you use 3 tier cluster structure, it's impossible to know how
many
> >instances of ejb with the same primary key. Probably one instance for
each
> >wls instance.
> >> >>>In wls5.1, it's impossible to host only read only entity bean
instance
> >in the 3-tier cluster. Because read only entity bean are clusterable in
both
> >home and remote interface.
> >> >>>
> >> >>>>Regarding making the bean a pinned service, which it sounds like I
> >might have to do to get the results I want, how do I do that? Is that a
> >deployment descriptor setting? Also, if I make it a pinned service, do I
> >get any fail-over suport by clustering the bean?
> >> >>>>
> >> >>>For the pinned service, you can just deployed on one or several
server
> >instances. The per-server properties file is a good place to put the
> >weblogic.ejb.deploy property. If only one pinned service in the cluster,
you
> >can't get fail over. If the that server instance fails, the home stub
will
> >be removed from the jndi in other server instances.
> >> >>>
> >> >>>Why do you must need only one instance in the cluster? Do you want
> >exact-only-copy? You can read Using JNDI doc about its in cluster
> >environment.
> >> >>>
> >> >>>
> >> >>>
> >> >>>
> >> >>>>Thanks again,
> >> >>>>Bryan
> >> >>>>
> >> >>>>
> >> >>>>
> >> >>>>"Tao Zhang" <[email protected]> wrote:
> >> >>>>>
> >> >>>>>
> >> >>>>>Bryan Dixon <[email protected]> wrote in message
> >> >>>>>news:[email protected]...
> >> >>>>>>
> >> >>>>>> I'm designing a data caching approach that relies on using
> >read-only
> >> >>>>>entity ejbs with bean-managed persistence. My design is based on
the
> >fact
> >> >>>>>that WebLogic blocks on entity bean access by concurrent users for
a
> >given
> >> >>>>>bean instance (unique primary key). I would like to keep only one
> >entity
> >> >>>>>bean instance active(timeoutSetting=0) for eacy primary key for
all
> >users to
> >> >>>>>share. That way I only have to hit the database one time to
> >initially
> >> >>>>>populate data in the entity bean. I'm worried about this approach
in
> >a
> >> >>>>>WebLogic clustered environment. From reading notes in this
newsgroup
> >and
> >> >>>>>other doc, it appears that WebLogic might not use one instance of
the
> >entity
> >> >>>>>bean (based upon unique primary key) in a clustered environment.
Is
> >that
> >> >>>>>true (that being multiple users could get their own instance of
the
> >entity
> >> >>>>>bean with the same primary key)?
> >> >>>>>>
> >> >>>>>
> >> >>>>>
> >> >>>>>It's true. In a cluster environment, each wls instance can have
their
> >ejb
> >> >>>>>instance. The block of concurrent access to the ejb data is up to
> >your
> >> >>>>>transaction attribute and isolation level and your database.
> >> >>>>>
> >> >>>>>If you only want to keep one instance active, you can make the
> >read-only
> >> >>>>>entity bean a pinned service, to be deployed in one instance. But
the
> >> >>>>>network overhead is worse.
> >> >>>>>
> >> >>>>>
> >> >>>>>> Thanks,
> >> >>>>>> Bryan
> >> >>>>>
> >> >>>>>
> >> >>>>
> >> >>>
> >> >>
> >> >
> >>
> >
> >
>
-
Insert data into table from JSP page using Entity Beans(EJB 3.0)
I want to insert data into a database table from JSP page using Entity Beans(EJB 3.0).
1. I have a table 'FRIENDS', (in Oracle 10g database).
2. It has two columns, 'NAME' and 'CITY'. Both have datatype strings(varchar2).
3. Now from a JSP page, having two textfields, 'NAME' and 'CITY', I want to insert data into table 'FRIENDS'.
4. In between JSP and database is a Entity Bean(EJB 3.0) and a stateless session bean.
5. I am using JDev as editor.
Please provide me code ASAP or link with similar example.
Thank you.
AnuragHi,
I am also trying that scenario. So u can
Post the jsp form data to a Servlet which will act as a Controller.
In the servlet invoke the business method.
Similar kind of app is in www.roseindia.net
Hope this would help u.
Meanwhile if u get any optimal solution, pls post it.
Thanks,
Happy Java Coding. -
How to use application managed entity manager in EJB?
I finish reading The EntityManager Interface in JEE tutorial.
I know I can use container manager entity manager in EJB, but I want to explore how to use application managed entity manager in EJB.
Can I use application managed entity manager in EJB (container management JTA transaction is used)? Where do I should close entity manager if can?
The following is an example from JEE tutorial, but didn't find where to calose entity manager. and can I create mutiple EntityManagerFactory objects and Entity Manager objects to use them in a JTA transaction?
@PersistenceUnit
EntityManagerFactory emf;
EntityManager em;
@Resource
UserTransaction utx;
em = emf.createEntityManager();
try {
utx.begin();
em.persist(SomeEntity);
em.merge(AnotherEntity);
em.remove(ThirdEntity);
utx.commit();
} catch (Exception e) {
utx.rollback();Seems like a very poor example, the whole power of EJBs is to use Container Managed Transactions so you don't NEED to manage the transaction and the entity manager yourself. What you posted is code I would expect in a non-JEE application, or in a piece of code which requires fine-tuned transaction boundaries such as batched data importing logic.
If I were you I'd research JPA in steps.
a) learn about JPA as an API outside of the scope of EJBs (recommended reading: the book 'Pro JPA 2')
b) learn about Container Managed Transactions in EJBs
c) learn about Bean Managed Transactions in EJBs
Right now you're rushing into c). I can understand that it raises many question marks at this point. -
Can EJB 3.0 beans be used with tables that do not have a primary key?
Can a EJB 3.0 persistence bean be used with tables that do not have a primary key defined? I am building a test application based on the HowTo - Building EJB 3.0 Faces App paper posted after Openworld (schalk). The issue I am running into when trying to run the application is: Exception Description: Entity class [class com.persistence.Rpthead] has no primary key specified. Note: I get a simular error when using toplink directly.
The tables I am binding to do not have primary keys defined. They use unique constraints to manage the table integrity.
Is it possible to use EJB 3.0 on tables without a primary key? If not, are there plans to support this in the future?The spec requires a primary key Id annotation. I will take your suggestion to EJB 3.0 expert group.
Can you also send an email to [email protected] with your requirement?
-Debu -
Finder method in container-managed entity bean
Finder method of a container entity bean is taking the primary key class object of another entity bean. How to map this in the xml descriptor file weblogic-cmp-rdbms.xml for this type of beans.
I am trying to deploy the jasmine computer store of Mastering EJB by EdRoman.
I couldn't write the deployment file weblogic-cmp-rdbms.xml for Order Entity bean which uses CustomerPK as an argument in its finder method.
Please tell me how to write this. I am trying on weblogic 5.1
Thanx in advance
Srivatsahello,
in container managed persistence, you specify on your xml file the name of your table. so the primary key you want to use have to be a foreign key in your table. otherwise i don't think that you can use a container managed persistence.
Najib. -
Container Managed Entity Beans and Client Identifier in Oracle
Is it possible to use Container Managed Entity Beans (EJB with CMP)
in a way that the Oracle database sessions still know the
individual Client Identifiers of the actual users
(not just the Identifier of the proxy user defined in the
Connection Pool)?
If Yes: How?
If No: The consequence would be that the
technologies EJB with CMP cannot be user together with
Oracle Virtual Private Databases (VPN) because VPN requires
some kind of Client Identifier.
I am grateful for any hint.
Regards,
Martin Siepmann
+49 (0)163 / 7765328Not quite an auto-incrementing PK, but it is managed by the container. the following is from the turorial
Generating Primary Key Values
For some entity beans, the value of a primary key has a meaning for the business entity. For example, in an entity bean that represents a phone call to a support center, the primary key might include a time stamp that indicates when the call was received. But for other beans, the key's value is arbitrary--provided that it's unique. With container-managed persistence, these key values can be generated automatically by the EJB container. To take advantage of this feature, an entity bean must meet these requirements:
* In the deployment descriptor, the primary key class is defined as a java.lang.Object. The primary key field is not specified.
* In the home interface, the argument of the findByPrimaryKey method must be a java.lang.Object.
* In the entity bean class, the return type of the ejbCreate method must be a java.lang.Object.
In these entity beans, the primary key values are in an internal field that only the EJB container can access. You cannot associate the primary key with a persistent field or any other instance variable. However, you can fetch the bean's primary key by invoking the getPrimaryKey method, and you can locate the bean by invoking its findByPrimaryKey method.
Maybe that is good enough
christina -
Hi,
I have created two bean managed entity beans, User and Role, abstracting users
and groups in a ldap base. A User may have more than one Role. This is represented
by a (bean managed) 1:many relationship directed from User to Role. For some weird
reasons I get a transaction rollback when reading data, when transactions are
turned on (REQUIRED).
While we where running WLS 6.1 sp1 we had no problems with this as we could set
transaction to NOTSUPPORTED for these two EJBs. Due to other hickups we had to
upgrade to sp2 and suddenly the error reappears leading me to believe that NOTSUPPORTED
isn't allowed anymore by the WLS. I know that NOTSUPPORTED isn't required by the
EJB spec, but containers may support it and obviously WLS used to do just that.
I have not seen any change in the release notes of sp2 that indicates that this
behaviour has changed.
Does anybody know if WLS really doesn't support NOTSUPPORTED for enity beans anymore
in sp2?
If anybody are curiuos or have any good ideas, the stacktrace I get is:
javax.ejb.TransactionRolledbackLocalException: EJB Exception:
- with nested exception:
[javax.ejb.EJBException
- with nested exception:
[weblogic.transaction.RollbackException: Unexpected exception in beforeCompletion:
sync=weblogic.ejb20.internal.TxManager$TxListener@1c2906 - with nested exception:
[java.util.ConcurrentModificationException]]]
Start server side stack trace:
java.rmi.RemoteException: EJB Exception: ; nested exception is:
javax.ejb.TransactionRolledbackLocalException: EJB Exception:
- with nested exception:
[javax.ejb.EJBException
- with nested exception:
[weblogic.transaction.RollbackException: Unexpected exception in beforeCompletion:
sync=weblogic.ejb20.internal.TxManager$TxListener@1c2906 - with nested exception:
[java.util.ConcurrentModificationException]]]
java.util.ConcurrentModificationException
at java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:535)
at java.util.LinkedList$ListItr.next(LinkedList.java:476)
at weblogic.ejb20.manager.DBManager.beforeCompletion(DBManager.java:370)
at weblogic.ejb20.internal.TxManager$TxListener.beforeCompletion(TxManager.java:481)
at weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(ServerSCInfo.java:551)
at weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(ServerSCInfo.java:88)
at weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAndChain(ServerTransactionImpl.java:980)
at weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(ServerTransactionImpl.java:1504)
at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:216)
at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:190)
at weblogic.ejb20.internal.BaseEJBLocalObject.postInvoke(BaseEJBLocalObject.java:207)
at com.takecargo.domainentities.role.RoleBean_1ipw6_ELOImpl.getName(RoleBean_1ipw6_ELOImpl.java:86)
at com.takecargo.domainentities.role.RoleConverter.getVOforRoleLocal(RoleConverter.java:51)
Any kind of help would be appreciated:)
Regards,
Brynjar GlesnesWLS support NotSupported on Entity Beans.
It looks like you've hit a bug in the EJB container where an internal Collection class has been modified while the
container is running through an iterator on it.
You should open a case with [email protected]
-- Rob
Brynjar Glesnes wrote:
Hi,
I have created two bean managed entity beans, User and Role, abstracting users
and groups in a ldap base. A User may have more than one Role. This is represented
by a (bean managed) 1:many relationship directed from User to Role. For some weird
reasons I get a transaction rollback when reading data, when transactions are
turned on (REQUIRED).
While we where running WLS 6.1 sp1 we had no problems with this as we could set
transaction to NOTSUPPORTED for these two EJBs. Due to other hickups we had to
upgrade to sp2 and suddenly the error reappears leading me to believe that NOTSUPPORTED
isn't allowed anymore by the WLS. I know that NOTSUPPORTED isn't required by the
EJB spec, but containers may support it and obviously WLS used to do just that.
I have not seen any change in the release notes of sp2 that indicates that this
behaviour has changed.
Does anybody know if WLS really doesn't support NOTSUPPORTED for enity beans anymore
in sp2?
If anybody are curiuos or have any good ideas, the stacktrace I get is:
javax.ejb.TransactionRolledbackLocalException: EJB Exception:
- with nested exception:
[javax.ejb.EJBException
- with nested exception:
[weblogic.transaction.RollbackException: Unexpected exception in beforeCompletion:
sync=weblogic.ejb20.internal.TxManager$TxListener@1c2906 - with nested exception:
[java.util.ConcurrentModificationException]]]
Start server side stack trace:
java.rmi.RemoteException: EJB Exception: ; nested exception is:
javax.ejb.TransactionRolledbackLocalException: EJB Exception:
- with nested exception:
[javax.ejb.EJBException
- with nested exception:
[weblogic.transaction.RollbackException: Unexpected exception in beforeCompletion:
sync=weblogic.ejb20.internal.TxManager$TxListener@1c2906 - with nested exception:
[java.util.ConcurrentModificationException]]]
java.util.ConcurrentModificationException
at java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:535)
at java.util.LinkedList$ListItr.next(LinkedList.java:476)
at weblogic.ejb20.manager.DBManager.beforeCompletion(DBManager.java:370)
at weblogic.ejb20.internal.TxManager$TxListener.beforeCompletion(TxManager.java:481)
at weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(ServerSCInfo.java:551)
at weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(ServerSCInfo.java:88)
at weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAndChain(ServerTransactionImpl.java:980)
at weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(ServerTransactionImpl.java:1504)
at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:216)
at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:190)
at weblogic.ejb20.internal.BaseEJBLocalObject.postInvoke(BaseEJBLocalObject.java:207)
at com.takecargo.domainentities.role.RoleBean_1ipw6_ELOImpl.getName(RoleBean_1ipw6_ELOImpl.java:86)
at com.takecargo.domainentities.role.RoleConverter.getVOforRoleLocal(RoleConverter.java:51)
Any kind of help would be appreciated:)
Regards,
Brynjar Glesnes -
Entity Bean EJB 2.0 Deployment error
Hi !!!
I am new in EJB .
I have developed an Entity Bean (EJB 2.0) and using IDE MyEclipse and JBoss Server.
while I deploying the Application I getting the following Exceptions :
--- MBeans waiting for other MBeans ---
ObjectName: jboss.j2ee:service=EjbModule,module=EntityExample.jar
State: FAILED
Reason: org.jboss.deployment.DeploymentException: No abstract accessors for field named 'id' found in entity class account.AccountEJB
--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: jboss.j2ee:service=EjbModule,module=EntityExample.jar
State: FAILED
Reason: org.jboss.deployment.DeploymentException: No abstract accessors for field named 'id' found in entity class account.AccountEJB
can any one give suggetion on it what i am doing incorrect.
thanks in AdvanceThere should be some error in looking up the Jndi..
In weblogic server I have been using the following code:
try
Context ctx = getContext.getInitialContext();
HelloHome home = (HelloHome)ctx.lookup("MyHello");
Hello hello = home.create();
System.out.println(hello.display());
catch(Exception e)
System.out.println("Error :");
e.printStackTrace();
static String user = null;
static String password = null;
static String url = "t3://localhost:7001";
* Gets an initial context.
* @return Context
* @exception java.lang.Exception if there is
* an error in getting a Context
static public Context getInitialContext() throws Exception
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
p.put(Context.PROVIDER_URL, url);
if (user != null)
System.out.println ("user: " + user);
p.put(Context.SECURITY_PRINCIPAL, user);
if (password == null)
password = "";
p.put(Context.SECURITY_CREDENTIALS, password);
return new InitialContext(p);
this works fine in weblogic..
also check if ur classpath is ok.. -
Setting composite key in Container Managed Entity Bean
In my database table i set primary key to two columns making them as composite key. how do i set that in my container managed entity bean home interface findByPrimaryKey() method and in deployment descriptor file.
1. create another class (say CompositePK) that will embed the two fields keyA and keyB corresponding to the two pk of your table (declare them public) .
2. in your Bean declare keyA and keyB public.
3. in the dd declare your bean primary-key-class as CompositePK and the primary-key-field as keyA and keyB.
this is the method i use (with BAS) even if the key is simple (such as Integer). -
A cmr-field and a cmp-field on the bean are using the same name. The names
Hi:
I am using weblogic 8.1 and MyEclipse 5.1.1. I am deploying my ear application through MyEclipse 5.1.1 as an ear file.
When I ran the following EJB QL:
SELECT OBJECT(p) FROM Product p.category = ?1
I get the following error:
n relation Category-Product, a cmr-field and a cmp-field on the bean are using the same name. The names of cmr and cmp fields must be unique.
It is basically complaining that I have a field
<cmr-field>
<cmr-field-name>category</cmr-field-name>
</cmr-field>
in my ejb-jar.xml and also the same category in the
<cmp-field><field-name>category</field-name></cmp-field>
field. The problem is that if I changed the value of the cmr-field, I have to add a get and set in my productLocal.java and when you do that you have to do the same in the ejb-jar.xml.
Here is my ejb-jar.xml:
<?xml version="1.0"?>
<!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>
<enterprise-beans>
<entity>
<ejb-name>CategoryEJB</ejb-name>
<local-home>com.CategoryHomeLocal</local-home>
<local>com.CategoryLocal</local>
<ejb-class>com.CategoryBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>Category</abstract-schema-name>
<cmp-field><field-name>categoryId</field-name></cmp-field>
<cmp-field><field-name>categoryName</field-name></cmp-field>
<cmp-field><field-name>picture</field-name></cmp-field>
<cmp-field><field-name>pictureWidth</field-name></cmp-field>
<cmp-field><field-name>pictureHeight</field-name></cmp-field>
<cmp-field><field-name>labelOn</field-name></cmp-field>
<cmp-field><field-name>labelOff</field-name></cmp-field>
<cmp-field><field-name>button</field-name></cmp-field>
<primkey-field>categoryId</primkey-field>
<security-identity><use-caller-identity/></security-identity>
<query>
<query-method>
<method-name>findCategory</method-name>
<method-params></method-params>
</query-method>
<ejb-ql>
SELECT OBJECT(c) FROM Category c
</ejb-ql>
</query>
</entity>
<entity>
<ejb-name>ProductEJB</ejb-name>
<local-home>com.ProductHomeLocal</local-home>
<local>com.ProductLocal</local>
<ejb-class>com.ProductBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>Product</abstract-schema-name>
<cmp-field><field-name>productId</field-name></cmp-field>
<cmp-field><field-name>brandName</field-name></cmp-field>
<cmp-field><field-name>productDescription</field-name></cmp-field>
<cmp-field><field-name>purchasePrice</field-name></cmp-field>
<cmp-field><field-name>category</field-name></cmp-field>
<primkey-field>productId</primkey-field>
<security-identity><use-caller-identity/></security-identity>
<query>
<query-method>
<method-name>findProduct</method-name>
<method-params>
<method-param>com.CategoryLocal</method-param>
</method-params>
</query-method>
<ejb-ql>
SELECT OBJECT(p) FROM Product p.category = ?1
</ejb-ql>
</query>
</entity>
</enterprise-beans>
<relationships>
<ejb-relation>
<ejb-relation-name>Category-Product</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>
Category-has-many-Product-numbers
</ejb-relationship-role-name>
<multiplicity>one</multiplicity>
<relationship-role-source>
<ejb-name>CategoryEJB</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>productNumbers</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>
Product-belongs-to-Category
</ejb-relationship-role-name>
<multiplicity>many</multiplicity>
<cascade-delete/>
<relationship-role-source>
<ejb-name>ProductEJB</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>category</cmr-field-name>
</cmr-field>
</ejb-relationship-role>
</ejb-relation>
</relationships>
<assembly-descriptor>
<security-role>
<role-name>Employees</role-name>
</security-role>
<method-permission>
<role-name>Employees</role-name>
<method>
<ejb-name>CategoryEJB</ejb-name>
<method-name>*</method-name>
</method>
</method-permission>
<container-transaction>
<method>
<ejb-name>CategoryEJB</ejb-name>
<method-name>*</method-name>
</method>
<method>
<ejb-name>ProductEJB</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
Here is my weblogic-cmp-rdbms-jar.xml:
<!DOCTYPE weblogic-rdbms-jar PUBLIC
'-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB RDBMS Persistence//EN'
'http://www.bea.com/servers/wls810/dtd/weblogic-rdbms20-persistence-810.dtd'>
<weblogic-rdbms-jar>
<weblogic-rdbms-bean>
<ejb-name>CategoryEJB</ejb-name>
<data-source-name>ShoeStore</data-source-name>
<table-map>
<table-name>category</table-name>
<field-map>
<cmp-field>categoryId</cmp-field>
<dbms-column>categoryID</dbms-column>
</field-map>
<field-map>
<cmp-field>categoryName</cmp-field>
<dbms-column>categoryName</dbms-column>
</field-map>
<field-map>
<cmp-field>picture</cmp-field>
<dbms-column>Picture</dbms-column>
</field-map>
<field-map>
<cmp-field>pictureWidth</cmp-field>
<dbms-column>PictureWidth</dbms-column>
</field-map>
<field-map>
<cmp-field>pictureHeight</cmp-field>
<dbms-column>PictureHeight</dbms-column>
</field-map>
<field-map>
<cmp-field>labelOn</cmp-field>
<dbms-column>LabelOn</dbms-column>
</field-map>
<field-map>
<cmp-field>labelOff</cmp-field>
<dbms-column>LabelOff</dbms-column>
</field-map>
<field-map>
<cmp-field>button</cmp-field>
<dbms-column>Button</dbms-column>
</field-map>
</table-map>
<automatic-key-generation>
<generator-type>SQL_SERVER</generator-type>
</automatic-key-generation>
</weblogic-rdbms-bean>
<weblogic-rdbms-bean>
<ejb-name>ProductEJB</ejb-name>
<data-source-name>ShoeStore</data-source-name>
<table-map>
<table-name>PRODUCT</table-name>
<field-map>
<cmp-field>productId</cmp-field>
<dbms-column>productId</dbms-column>
</field-map>
<field-map>
<cmp-field>brandName</cmp-field>
<dbms-column>brandName</dbms-column>
</field-map>
<field-map>
<cmp-field>productDescription</cmp-field>
<dbms-column>productDescription</dbms-column>
</field-map>
<field-map>
<cmp-field>purchasePrice</cmp-field>
<dbms-column>purchasePrice</dbms-column>
</field-map>
<field-map>
<cmp-field>category</cmp-field>
<dbms-column>categoryId</dbms-column>
</field-map>
</table-map>
<!-- Automatically generate the value of ID in the database on inserts using sequence table -->
<automatic-key-generation>
<generator-type>SQL_SERVER</generator-type>
</automatic-key-generation>
</weblogic-rdbms-bean>
<weblogic-rdbms-relation>
<relation-name>Category-Product</relation-name>
<weblogic-relationship-role>
<relationship-role-name>Product-belongs-to-Category</relationship-role-name>
<relationship-role-map>
<column-map>
<foreign-key-column>categoryId</foreign-key-column>
<key-column>categoryID</key-column>
</column-map>
</relationship-role-map>
</weblogic-relationship-role>
</weblogic-rdbms-relation>
</weblogic-rdbms-jar>
Here is my productLocal.java:
package com;
import javax.ejb.CreateException;
import javax.naming.NamingException;
import java.util.Date;
import java.util.Vector;
import java.util.Collection;
public interface ProductLocal extends javax.ejb.EJBLocalObject
public Integer getProductId();
public void setProductId(Integer productId);
public String getBrandName();
public void setBrandName(String brandName);
public String getProductDescription();
public void setProductDescription(String productDescription);
public Double getPurchasePrice();
public void setPurchasePrice(Double purchasePrice);
public CategoryLocal getCategory();
public void setCategory(CategoryLocal category);
Here is my ProductBean.java:
package com;
import javax.naming.InitialContext;
import javax.ejb.EntityContext;
import javax.ejb.CreateException;
import javax.naming.NamingException;
import java.util.Date;
import java.util.Collection;
import java.util.Iterator;
import java.util.Vector;
import java.lang.Integer;
public abstract class ProductBean implements javax.ejb.EntityBean
public Integer ejbCreate(Integer id)
this.setProductId(id);
return null;
public void ejbPostCreate(Integer id)
//public abstract Integer getCategoryId();
// public abstract void setCategoryId(Integer categoryId);
public abstract CategoryLocal getCategory();
public abstract void setCategory(CategoryLocal category);
public abstract Integer getProductId();
public abstract void setProductId(Integer productId);
public abstract String getBrandName();
public abstract void setBrandName(String brandName);
public abstract String getProductDescription();
public abstract void setProductDescription(String productDescription);
public abstract Double getPurchasePrice();
public abstract void setPurchasePrice(Double purchasePrice);
public void setEntityContext(EntityContext ec)
System.out.println("ProductBean setEntityContext");
public void unsetEntityContext()
System.out.println("ProductBean unsetEntityContext");
public void ejbLoad()
System.out.println("ProductBean ejbLoad");
public void ejbStore()
System.out.println("ProductBean ejbStore");
public void ejbActivate()
System.out.println("ProductBean ejbActivate");
public void ejbPassivate()
System.out.println("ProductBean ejbPassivate");
public void ejbRemove()
System.out.println("ProductBean ejbRemove");
What do I needed to do to fix this problem.
Any hint or help would be greatly appreciated!!!
Yours,
Frustratedcmr field which is "category" in ur mapping , u can't use as cmp field in abstract schema mapping. just remove category from cmp field . and every thing is fine
-
Message driven beans practical use
Hi,
I wanted to know,where Message driven beans are used in actual commercial projects???
Thanks in advance.Hi,
Without naming any particular projects, i can asure you that MessageDriven Beans are used in commercially deployed systems.
Most important is to recognise the goal of MDBs. Everything inside a J2EE server is Request-Response like. Session and Entity beans react on requests. Because of the life cycle of these types of EJBs waiting for incoming messages is not realy a good idea.
In all cases were asynchronous middleware solutions are used, like MQ series for example, MDBs are used to listen for and react on incoming messages.
Furthermore, MDBs are used to decouple web tier from business tier where processing times of incoming data is too long to wait for by the clients.
Robert -
Question about 'Beans in Use' statistic in weblogic console
I am trying to figure out why the weblogic server is taking up so much
memory in our system.
We are running weblogic 6.1sp3 on solaris 2.7 and are quickly running
out of memory.
I run a 5 user test for an hour that results in around 240 'budgets'
being created via a Budget entity bean.
At the start of the run, the java weblogic process takes up 157meg.
At the end of the run(actually many hours after the run has stopped
and there has been no other activity), it is at to 696 meg
The weblogic console tells me the following information on my Budget
entity bean at the end:
Idle: 0
Beans in use: 246
Cached: 50
Passivated: 191
My question is this, is 246 'Beans in use' a sign that I am not
releasing resources correctly? what does it mean to have 246 'Beans
in use'? the help on that screen says that 'beans in use' is the
number of beans in use, active or ready state. I understand that an
'active' bean is one that has a PK assigned and has been moved from
'pooled' to 'ready'. passivated bean does not have PK associated and
moved from 'ready' to 'pooled'. I can't figure out why it has 246
beans ready or active? If someone could better explain what 'beans in
use' means I'd greatly appreciate it. I put print outs in
active/passivate/unsetEntityContext and I see active/passivate get
called but no unsetEntityContext. It also seems that it doesn't reuse
the 'container'. After a passivate, I'd expect the next 'activate' to
re-use that seem bean that was just passivated, but it does not seem
to.
I feel like I'm missing the boat here on something. I understand
'cached' beans and how to control that number. Where I feel I need
some help is understanding what happens to the bean once it is
'passivated'. Why aren't those being reused? why don't they have
some 'max' that will cause them to be removed? (does
max-beans-in-free-pool work for entity beans in 6.1??)
any feedback would be greatly appreciated!
thanks
KellyHi Kelly,
Semantics of ejbPassivate/ejbActivate methods of Entity
beans is quite different from SFSB.
For Entity Bean ejbPassivate is called when a bean loses its
identity and transitions from Ready to Pooled state. ejbActivate
is called when a bean transitions from Pooled to Ready state.
Hope this helps,.
Regards,
Slava Imeshev
"Kelly Kingdon" <[email protected]> wrote in message
news:[email protected]...
I am trying to figure out why the weblogic server is taking up so much
memory in our system.
We are running weblogic 6.1sp3 on solaris 2.7 and are quickly running
out of memory.
I run a 5 user test for an hour that results in around 240 'budgets'
being created via a Budget entity bean.
At the start of the run, the java weblogic process takes up 157meg.
At the end of the run(actually many hours after the run has stopped
and there has been no other activity), it is at to 696 meg
The weblogic console tells me the following information on my Budget
entity bean at the end:
Idle: 0
Beans in use: 246
Cached: 50
Passivated: 191
My question is this, is 246 'Beans in use' a sign that I am not
releasing resources correctly? what does it mean to have 246 'Beans
in use'? the help on that screen says that 'beans in use' is the
number of beans in use, active or ready state. I understand that an
'active' bean is one that has a PK assigned and has been moved from
'pooled' to 'ready'. passivated bean does not have PK associated and
moved from 'ready' to 'pooled'. I can't figure out why it has 246
beans ready or active? If someone could better explain what 'beans in
use' means I'd greatly appreciate it. I put print outs in
active/passivate/unsetEntityContext and I see active/passivate get
called but no unsetEntityContext. It also seems that it doesn't reuse
the 'container'. After a passivate, I'd expect the next 'activate' to
re-use that seem bean that was just passivated, but it does not seem
to.
I feel like I'm missing the boat here on something. I understand
'cached' beans and how to control that number. Where I feel I need
some help is understanding what happens to the bean once it is
'passivated'. Why aren't those being reused? why don't they have
some 'max' that will cause them to be removed? (does
max-beans-in-free-pool work for entity beans in 6.1??)
any feedback would be greatly appreciated!
thanks
Kelly -
Simple Java Bean Generator use
Hello everybody,
I'd like to know if someone managed to use the Simple Java Bean Generator, useful tool for web dynpro application in order to import complete database model.
I read the doc, and I think it's usable for SQLServer database. My command is as follows :
java -D com.sap.test.DBTest com.microsoft.jdbc.sqlserver.SQLServerDriver sa 123erty TSP c:\GenerateDB CONFIG
where CONFIG is my database name, sa/123erty the couple login/pwd, and TSP the pattern (what does it mean pattern in this case ?).
When executing this command, the response is : datasouce not found and driver not specified...
I don't understand, can someone help me please ??
Thanx.
Message was edited by: Sistiaga MarcThanks about your answer.
Without code modifying I wan't to use it with a Maxdb database.
Which driver is ucurrently used ? com.sap.dbtech.jdbc.DriverSapDB ?
Where do i have to launch this script knowing that my J2EE engine is installed in a linux platform ?
My command become :
java -D com.sap.test.DBTest com.sap.dbtech.jdbc.DriverSapDB SAPNW1DB SAPNW1DB CC_ c:\GenerateDB CONFIG_DB
and i always get the response : datasource not found,n driver not specified...
Am I wrong to try this generator in a windows platform where j2ee engine is in a linux platform ??
Thanx a lot in advance ! -
Call stateless session bean EJB 2.0 from Webdynpro Java UI
Hello,
Can someone please tell me asto how to call a stateless session bean EJB 2.0 from Webdynpro Java UI?
The NWDS version is 7.0.
Thanks and Regards,
AryaHi Aryadipta
Please check this pdfs
https://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/b00917dc-ead4-2910-3ebb-b0a63e49ef10&overridelayout=true
Steps for calling stateless session bean in Webdynpro java
Go to NWDS -> open perspective ->j2ee
select EJB Module Project ->create a project with name
Open the Project -->RC on ejb-jar.xml -> Select new --> EJB
Give name to EJB Bean (First letter should be in capital letters)
select the type of bean as Stateless session bean and give the package name to store that EJB bean.
After that Expand ejb-jar.xml and then select the <projectEJB>
Double click on this on method tab double click you will get business method where we will create the methods for business logic
Double click on projectEJB and then RC on bean tab and write required business logic in bean window as follows(based on requirement we will design a business logic).
After writing the business logic go to project -> rebuild
Till now we have created one EJB jar file
then go to File-->Enterprise Application Project -->create a project (projectEAR)
After creating a project click on next-> here we will have ear projects and then we select specific project required for our application.(here select projectEJB)
After that Calculate EAR project will be available on j2ee explorer.
Right click on <Bean> here
select New->Web Service->give a name to webservice and select Default configuration type as simple SOAP
-->click next -> Finish.
That webservice and related are created in ejb-jar.xml .
Expand the ejb-jar.xml.and double click on < webservice>
RC ProjectEJB -> Build EJB Archive RC on CalculateEAR ->Build applicationarchive.
Expand the projectEAR->RC on CalculateEAR.ear->Deploy to J2EE Engine
Double click on calculateEAR.ear ->Webservice navigator tab ->we eill servers expand the node
select the specific WebService
Here we test the webservice by click on Test and test it.
After that go to Web dynpro perspective ->create one webdynpro Project and one component
RC on model> Select import Web Service model(last)>give model name and package
and select radio button as local file system or URL
Go to WSnavigator->copy the WSDL path and paste it in model WSDL path and click on finish.
from here onwards steps are same as that adaptive RFC model
Hope it helps
Thanks
Tulasi Palnati
Edited by: Tulasi Palnati on Aug 26, 2009 12:15 PM
Edited by: Tulasi Palnati on Aug 26, 2009 12:43 PM
Maybe you are looking for
-
How do I make Flash use the original Photoshop file, not a .png one?
Hi, this might be kind of a basic question/problem but I can't seem get Google to help me. Since I've recently started out with Flash, I guess I just missed some newbie thing out, still very greatful for help though, since this'll soon be causing a b
-
I uninstalled shockwave and reinstalled it with the same result. what gives?
-
Master and Document Tables ...
What relation do Master and Document tables have to parent and child tables? Should I declare all my created tables master and master details ? how can I establish my relationships, foreign keys and primary keys with all these fields created by SAP
-
PO Output type with Option 5 External Send (&EKKO-EBELN&)
Dear Friends, We have come across and interesting issue. We want PO output to be send to vendor via email and the email subject should be "New Purchase Order <po document no>". To achieve this requirement we have set the Output type NEU --> Mail titl
-
I have a chapter in track 1 that is a DVD@cess. It points to a website http://ouranthemaz.net and works in the sim. When I burn it i get the following message Track1, Chapter 4: MArker position in movie not at GOP boundary. Then the build is cancelle