ConcurrentModificationException on remove call on an ejb
Hi guys,
I'm using weblogic7.0 sp1 and developping with JBuilder8.
The following error appear when i try to remove an ejb. I'm iterating on an
collection of primary key and i try to remove all ejb of this collection
(source code at the bottom).
The same source code is running on weblogic6.1sp2, have you already see this
problem somewhere? Do you know if it's a programming error or an other
thing?
<Mar 19, 2003 10:25:54 AM CET> <Error> <T3Services> <000000> <M&H BOE Engine
ERROR :
java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.next(HashMap.java:731)
at
weblogic.ejb20.internal.TxManager.flushModifiedBeans(TxManager.java:292)
at
weblogic.ejb20.manager.BaseEntityManager.flushModifiedBeans(BaseEntityManage
r.java:1626)
at
weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.flushModifiedBeans(RDBMSPer
sistenceManager.java:1945)
at
weblogic.ejb20.manager.BaseEntityManager.cascadeDeleteRemove(BaseEntityManag
er.java:1202)
at weblogic.ejb20.manager.DBManager.remove(DBManager.java:1024)
at
weblogic.ejb20.internal.EntityEJBLocalObject.remove(EntityEJBLocalObject.jav
a:102)
at
com.mh.app.boe.engine.dba.instanceprocess.InstanceProcessBean_n65kai_ELOImpl
.remove(InstanceProcessBean_n65kai_ELOImpl.java:1015)
at
com.mh.app.boe.engine.model.EngineWorker.removeProcess(EngineWorker.java:513
at
com.mh.app.boe.engine.model.EngineWorker.modifyProcesses(EngineWorker.java:4
57)
at
com.mh.app.boe.engine.model.EngineWorker.dealEvent(EngineWorker.java:280)
at
com.mh.app.boe.engine.model.EngineWorker.dealEvent(EngineWorker.java:226)
at
com.mh.app.boe.engine.model.EngineWorker.progressInstanceByStep(EngineWorker
.java:402)
at
com.mh.app.boe.engine.model.EngineWorker.progressInstance(EngineWorker.java:
303)
at
com.mh.app.boe.engine.model.EngineWorker.dealEvent(EngineWorker.java:284)
at
com.mh.app.boe.engine.model.EngineWorker.dealEvent(EngineWorker.java:226)
at
com.mh.app.boe.engine.model.EngineWorker.dealEvent(EngineWorker.java:205)
at
com.mh.app.boe.engine.model.EngineBean.dealEvent(EngineBean.java:89)
at
com.mh.app.boe.engine.model.EngineBean_yehaoy_ELOImpl.dealEvent(EngineBean_y
ehaoy_ELOImpl.java:99)
at
com.mh.app.boe.engine.net.EngineControllerEJBBean.dealEvent(EngineController
EJBBean.java:74)
at
com.mh.app.boe.engine.net.EngineControllerEJBBean_agu4tb_EOImpl.dealEvent(En
gineControllerEJBBean_agu4tb_EOImpl.java:262)
at
com.mh.app.boe.engine.net.EngineControllerEJBBean_agu4tb_EOImpl_WLSkel.invok
e(Unknown Source)
at
weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:362)
at
weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java
:114)
at
weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:313)
at
weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
r.java:821)
at
weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:308)
at
weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:3
0)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:213)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:189)
>
Collection precedentProcesses =
process.findPrecedentProcesses(processIdToActivate, stateMachineId);
for (Iterator precedentProcessesIterator = precedentProcesses.iterator();
precedentProcessesIterator.hasNext(); ) {
String precedentProcessId = (String) precedentProcessesIterator.next();
InstanceProcessPK instanceProcessPKToPassivate = new
InstanceProcessPK(instance.getInstanceId(),
processIdToPassivate,instance.getStateMachineId());
InstanceProcess instanceProcessToPassivate =
serviceLocator.getInstanceProcessHome().findByPrimaryKey(instanceProcessPKTo
Passivate);
if (instanceProcessToPassivate != null)
instanceProcessToPassivate.remove(); //exception is thows on this
instruction
Thanks in advance,
Joel.
Hello Ryan,
There are no other threads of execution that try to access to this
collection of InstanceProcess in my code.
Could it be the application server?
Nota: I 'm using transaction managed by container.
Best regards,
Joel.
"Ryan LeCompte" <[email protected]> wrote in message
news:[email protected]...
>
Hello Joel,
After giving your code a second look, it appears that the Collectionreturned
by your finder method is composed of Strings, and not the actual localinterfaces
of the underlying entity beans. Are you sure that there aren't otherthreads of
execution that are iterating through a collection of InstanceProcesses'while
you are calling the remove() method of the current InstanceProcess in thecode
that you wrote?
Best regards,
Ryan LeCompte
[email protected]
http://www.louisiana.edu/~rml7669
"Ryan LeCompte" <[email protected]> wrote:
Hello Joel,
You should remove your particular bean instance by calling the remove()
method
on the Iterator object as opposed to calling the remove() method directly
on the
local interface of the entity bean. The latter will generate the
ConcurrentModificationException(),
because the underlying collection will be modified while you areiterating
through
it, which generates the exception. This is because thecollection/iterator
is
"fail-safe." Therefore, in your code you would callprecedentProcessesIterator.remove()
instead of instanceProcessToPassivate.remove();
Best regards,
Ryan LeCompte
[email protected]
http://www.louisiana.edu/~rml7669
"Joel Rolland" <[email protected]> wrote:
Hi guys,
I'm using weblogic7.0 sp1 and developping with JBuilder8.
The following error appear when i try to remove an ejb. I'm iterating
on an
collection of primary key and i try to remove all ejb of this collection
(source code at the bottom).
The same source code is running on weblogic6.1sp2, have you alreadysee
this
problem somewhere? Do you know if it's a programming error or an other
thing?
<Mar 19, 2003 10:25:54 AM CET> <Error> <T3Services> <000000> <M&H BOE
Engine
ERROR :
java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.next(HashMap.java:731)
at
weblogic.ejb20.internal.TxManager.flushModifiedBeans(TxManager.java:292)
at
weblogic.ejb20.manager.BaseEntityManager.flushModifiedBeans(BaseEntityMana
ge
r.java:1626)
at
weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.flushModifiedBeans(RDBMSP
er
sistenceManager.java:1945)
at
weblogic.ejb20.manager.BaseEntityManager.cascadeDeleteRemove(BaseEntityMan
ag
er.java:1202)
at weblogic.ejb20.manager.DBManager.remove(DBManager.java:1024)
at
weblogic.ejb20.internal.EntityEJBLocalObject.remove(EntityEJBLocalObject.j
av
a:102)
at
com.mh.app.boe.engine.dba.instanceprocess.InstanceProcessBean_n65kai_ELOIm
pl
..remove(InstanceProcessBean_n65kai_ELOImpl.java:1015)
at
com.mh.app.boe.engine.model.EngineWorker.removeProcess(EngineWorker.java:5
13
at
com.mh.app.boe.engine.model.EngineWorker.modifyProcesses(EngineWorker.java
:4
57)
at
com.mh.app.boe.engine.model.EngineWorker.dealEvent(EngineWorker.java:280)
at
com.mh.app.boe.engine.model.EngineWorker.dealEvent(EngineWorker.java:226)
at
com.mh.app.boe.engine.model.EngineWorker.progressInstanceByStep(EngineWork
er
..java:402)
at
com.mh.app.boe.engine.model.EngineWorker.progressInstance(EngineWorker.jav
a:
303)
at
com.mh.app.boe.engine.model.EngineWorker.dealEvent(EngineWorker.java:284)
at
com.mh.app.boe.engine.model.EngineWorker.dealEvent(EngineWorker.java:226)
at
com.mh.app.boe.engine.model.EngineWorker.dealEvent(EngineWorker.java:205)
at
com.mh.app.boe.engine.model.EngineBean.dealEvent(EngineBean.java:89)
at
com.mh.app.boe.engine.model.EngineBean_yehaoy_ELOImpl.dealEvent(EngineBean
_y
ehaoy_ELOImpl.java:99)
at
com.mh.app.boe.engine.net.EngineControllerEJBBean.dealEvent(EngineControll
er
EJBBean.java:74)
at
com.mh.app.boe.engine.net.EngineControllerEJBBean_agu4tb_EOImpl.dealEvent(
En
gineControllerEJBBean_agu4tb_EOImpl.java:262)
at
com.mh.app.boe.engine.net.EngineControllerEJBBean_agu4tb_EOImpl_WLSkel.inv
ok
e(Unknown Source)
at
weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:362)
at
weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.ja
va
:114)
at
weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:313)
at
weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceMana
ge
r.java:821)
at
weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:308
at
weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java
:3
0)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:213)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:189)
>
Collection precedentProcesses =
process.findPrecedentProcesses(processIdToActivate, stateMachineId);
for (Iterator precedentProcessesIterator =precedentProcesses.iterator();
precedentProcessesIterator.hasNext(); ) {
String precedentProcessId = (String)precedentProcessesIterator.next();
>>>
InstanceProcessPK instanceProcessPKToPassivate = new
InstanceProcessPK(instance.getInstanceId(),
processIdToPassivate,instance.getStateMachineId());
InstanceProcess instanceProcessToPassivate =
serviceLocator.getInstanceProcessHome().findByPrimaryKey(instanceProcessPK
To
Passivate);
if (instanceProcessToPassivate != null)
instanceProcessToPassivate.remove(); //exception is thows on this
instruction
Thanks in advance,
Joel.
Similar Messages
-
Hi
remove is failing on my entity beans. The exception I get is
javax.ejb.EJBException: Error saving state: ORA-01407: cannot update ("AXIS_LIVE_DBO"."MEMBER_LOCATIONS"."MEMBER_REF") to NULL
MEMBER_REF is the primary key of the table and cannot be null. Does OC4J need the primary key field to be nullable?I am having the same issue. I currently have a M:M relationship that is bombing out on a remove call. The code seems to work fine on 9.0.4.1.0 standalone version on Windows. When I migrate the code to our 10G linux box, which is version 9.0.4.0.0. running the latest patch, I get the following error. I also tried the code on version 10.1.2.0.0 and I get the same error. If I change the foreign key columns to nullable the remove works file. Making the foreign keys nullable defeats the purpose of having data integrity. I have also enclosed the SQL generated by the container.
Error in Requisition Model removeVendor:
com.evermind.server.rmi.OrionRemoteException: Transaction was rolled back: javax.ejb.EJBException: Error saving state: ORA-01407: cannot update ("FINANCEDEV"."REQ_SUGG_VENDOR"."RQ_ID") to NULL
at RequisitionSession_StatelessSessionBeanWrapper5.removeVendor(RequisitionSession_StatelessSessionBeanWrapper5.java:724)
at edu.suny.sysadm.finance.procurement.model.RequisitionModel.removeVendor(RequisitionModel.java:382)
at edu.suny.sysadm.finance.procurement.struts.action.VendorRemoveAction.execute(VendorRemoveAction.java:53)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:765)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:793)
at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:208)
at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:125)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
at java.lang.Thread.run(Thread.java:534)
Works
1109613632663|16|3|statement|update REQ_SUGG_VENDOR set RQ_ID = ? where RQ_SUGG_VND_ID = ?|update REQ_SUGG_VENDOR set RQ_ID = 1422 where RQ_SUGG_VND_ID = 374
Does not work.
1109613500250|92|2|statement|update REQ_SUGG_VENDOR set RQ_ID = ? where RQ_SUGG_VND_ID = ?|update REQ_SUGG_VENDOR set RQ_ID = '' where RQ_SUGG_VND_ID = 370 -
ConcurrentModificationException when removing from hashmap
Why when i remove an object from a HashMap in an iterator loop, i get: ConcurrentModificationException, in the call to Next()???
This is the code:
HashMap mapa;
Object temp=null;
Set keys=mapa.keySet();
for(Iterator iter=keys.iterator();iter.hasNext();cont++){
Object key=iter.next(); //getting an exception here after calling remove
temp=mapa.get(key);
SomeClass.process($temp);
mapa.remove(key);
is there a way to remove each object after i process it (to free memory)?DrLaszloJamf wrote:
Exactly, what i think is , iter.remove() will remove the reference , but mapa.remove(key) will remove the reference and the object too, won't it?We seem to be talking around in circles, but I will give it another try:
iter.remove() removes the (key, value) entry from the map (of the key last returned by iter.next()).
mapa.remove(key) removes the (key, value) entry from the map (of the given key).Ok, i get it. The thing is that in the profiler , the number of objects doen't seem to decrease while i'm removin the objects while looping the hashmap, that's why i t thought it wasn't working, but i print the number of items left int the hashmap and it is decreasing.... -
Hi,
I have senerio in which i need to call RFC through EJB.
Thanks.
Abhilasha
Edited by: Abhilasha Dahare on Oct 3, 2008 1:29 PMHi,
Go through the following links:
Extract R/3 data via EJB
http://help.sap.com/saphelp_nw04/helpdata/en/35/42e13d82fcfb34e10000000a114084/frameset.htm
Siddharth -
Can i call Bean managed EJB with transaction attribute Required New
I am calling a BeanManaged EJB which has a transaction attribute
set to Required New from a container managed bean. Does it create a new transaction
other than the Bean managed transaction. Do i really need a required new field
transaction attribute.All i need is user controlled transaction.Do i need to set
the transaction aatibute.
Thanks
Krish.
Hi Krish,
The question does not make much sense.
I would suggest that you set all your tx settings to "Required" unless you
have a specific reason to do otherwise, and in those few instances that you
have a specific reason to do otherwise, then change it in just those places.
Peace,
Cameron Purdy
Tangosol Inc.
<< Tangosol Server: How Weblogic applications are customized >>
<< Download now from http://www.tangosol.com/download.jsp >>
"KRISH" <[email protected]> wrote in message
news:[email protected]..
>
> I am calling a BeanManaged EJB which has a transaction attribute
> set to Required New from a container managed bean. Does it create a new
transaction
> other than the Bean managed transaction. Do i really need a required new
field
> transaction attribute.All i need is user controlled transaction.Do i need
to set
> the transaction aatibute.
>
> Thanks
>
> Krish.
>
-
How to call the secured EJB from timer ejb timedout method.
Hi All,
I have a couple of questions on EJB 3.1 Timer Service.
1. How to call the secured EJB (annotated @RolesAllowed) from Timer EJB @Timeout Method?
2. What's the default role/principal with which the Timer @Timeout Method gets called?
Please let me know any info regarding the same.
Thanks,
SureshI'd start here:
http://ant.apache.org/manual/index.html
If that doesn't help, go to the table of contents and start poking around. You don't need to read the whole thing front to back, but if you're not willing to spend some time researching and reading, you're not going to get very far. -
Calling from an EJB into a JSF Backing Bean
Hello all,
I'm looking for some help in making calls from an EJB into a Backing Bean (the converse is fairly straightforward). My basic question is: what is regarded as the best way to do this?
However, for anybody who's interested, I'll describe what I've been trying...
Here's my situation (I'm working with OC4J 10.1.3.2). I have a simple application-scoped backing bean:
public class BackingBean implements SimpleInterface, Serializable {
private String greeting = "Hello, World";
private SessionEJBRemote blBeanRemote = null;
public BackingBean() {
// get hold of EJB
// [ ... code to obtain EJB's remote interface snipped ... ]
// set the callback with the EJB
try {
blBeanRemote.setCallback(this);
} catch (Exception ex) {
ex.printStackTrace();
// methods to manipulate the greeting string
public String getGreeting() {
return greeting;
public void setGreeting(String greeting) {
this.greeting = greeting;
}SimpleInterface, which my Backing Bean implements is, well, a simple interface:
public interface SimpleInterface {
public void setGreeting(String greeting);
}And my EJB is also pretty straightforward:
@Stateful(name="SessionEJB")
public class SessionEJBBean implements SessionEJBRemote, SessionEJBLocal {
private SimpleInterface callback = null;
public void setCallback(SimpleInterface callback) {
this.callback = callback;
callback.setGreeting("Goodbye, World");
}Now, by using SimpleInterface, my intention was to ensure a one-way dependency: i.e. the JSF-level code would depend on the EJB-level code, but not vice versa.
However, my experimentation has shown that when I make the call to blBeanRemote.setCallback, the parameter appears to be passed by value rather than by reference. This means firstly that, at runtime, by EJB needs to have access to my backing bean class and secondly, that the call to callback.setGreeting has no effect.
Can anybody suggest how to work around this? Is it possible to pass the backing bean by reference? Is there a better way to achieve this callback? I appreciate that these questions might be more general Java/AppServer queries rather than JSF-specific ones - but hopefully this is something that all you JSF experts have encountered before.
(Incidentally, I realise that what I'm doing in this example is pointless - what I'm building towards is using the ICEFaces framework to have the EJBs prod a backing bean which will in turn cause a user's browser to rerender.)
Many thanks - any help very much appreciated!
Alistair.Hi Raymond - yes, you've pretty much got that spot on: an event occurs (say receipt of a JMS message - which is spontaneous, as far as the users are concerned). As a result of that event, the client's view (in their browser) needs to be re-rendered.
ICEFaces uses the AJAX technique to allow server-pushes, and rather than refreshing the whole page it uses "Direct-to-DOM" rendering to maninpulate the page components. If you've not come across it, and you're interested, then there are some pretty interesting demos here: http://www.icefaces.org/main/demos/ - the "chat" feature of the Auction Monitor demo (if you open it up in two browsers) is the nearest to the effect I'm looking for.
The Auction Monitor demo uses a number of session-scoped beans, each implementing the ICEFaces "Renderable" interface, and each of which registers itself with an application-scoped bean. The application-scoped bean can thus iterate through each of the session-scoped beans and cause the corresponding browser to refresh.
Unfortunately, in the Auction Monitor demo, the entry point is always from a browser - albeit the result is then mirrored across all connected browsers. I haven't found any examples of this processing being driven by an external event, hence my experimentation in this area! -
Is it possible to monitor all calls into all EJBs deployed on a server?
Is there any way of monitoring all calls into the EJBs deployed in a server?
I'd like to be able to externally log the calls, and perhaps do some monitoring at the call level, without modifying the EJBs themselves. Something along the lines of servlet filters for servlets, but for EJBs instead..
JBoss has a nice plugin interface, and one could either extend the Logging plugin, or write another one, that can do this.
But is there an analog in other J2EE servers (e.g. weblogic and websphere)? Or is that a standard or clever way of intercepting all calls? (I suppose one could use Ethereal, but I was hoping for a higher-level solution).
Duke dollars available!Hi,
In JBoss they use Log4J to log and intercept the Bean calls and JDBC calls. You can use Log4J to do the same with other servers also, cause I configured OC4J(Oracle 9iAS) Server to use log4J and it worked for me. I think other servers can also be configured to use log4j. I've only tried this with JBoss and OC4J. I don't have much experience with other servers.
So, my advise is : try LOG4J and try to configure server to use LOG4J
Hope this works!
Indy. -
Webserver/jsp engine call into weblogic ejb container
Which one of these architectures would give the best performance.
First architecture:
3 boxes -
1st box - webserver(IIS or IPlaner) with a JSP engine. (The JSP's
produce dynamic content.)
2nd box - weblogic 5.1 hosting EJB's
3rd box - Oracle or DB2
The 1st box is used to server up dynamic contect. The JSP's make dynamic
contect from calls into the EJB container in the 2nd box. The EJB's then
calls the DB in the 3rd box.
2nd architecture:
3 boxes-
1st box - webserver with weblogic plug-ins for IIS or IPlanet
2nd box - weblogic 5.1 - hosting JSP pages and EJBs
3rd box - Oracle or DB2
The 1st box's webserver just receives the request to JSPs and lets the
plug-in find the appropriate weblogic instance. The JSPs that are processed
on the 2nd box make calls into the EJB container on the 2nd box. The EJBs
then make calls to the DB on the 3rd box.
thanks
-cb
thanks you both for you input
"Cameron Purdy" <[email protected]> wrote in message
news:[email protected]...
> It is certainly more efficient in terms of JSP/Servlet to EJB invocations
if
> you use WebLogic to do all three (JSP/Servlet/EJB) due to the
well-designed
> client stubs for EJBs that do pass-by-reference. If you have lots of
small
> invocations to EJBs, that is a good reason to consider WL for all three
> (JSP/Servlet/EJB).
>
> OTOH there are a good number of developers that I have spoken with that
> prefer other Servlet engines. These developers have had excellent
> experiences with WL EJB handling, but some issues with JSP/Servlets, or
> simply needed features offered by other servers. A few may have decided
on
> a price basis. Some of the technical issues were related to WL class
> loading issues that are scheduled to be completely improved in the fall WL
> release.
>
> All of that said, I personally would probably stick with WL to do all
three
> (JSP/Servlet/EJB). I believe that I have found most of the problems that
WL
> has ;-) and I have come through the other side still really liking the
> product -- so even it's worst points (like the linkage error that had me
> pulling out my hair and even searching through the Sun JVM sources ;-)
> aren't that bad because it is a strong enough product that there are
always
> ways to work through or around just about anything. If I had to look at a
> different JSP/Servlet engine, I would start with Caucho Resin, simply
> because I like their approach and I know it works well with WL.
>
> Lastly remember that in the J2EE world, "no one ever got fired for buying
> BEA WebLogic!"
>
> --
>
> Cameron Purdy
> http://www.tangosol.com
>
>
> "Chris Bick" <[email protected]> wrote in message
> news:[email protected]...
> > So you would not support/advise an architecture that has the JSP/Servlet
> > engine on a different box then weblogic? If this is the case, could you
> > give some reasons why?
> >
> > thanks,
> > -cb
> > "Cameron Purdy" <[email protected]> wrote in message
> > news:[email protected]...
> > > 1. Your bottleneck will probably be the third box (database server)
in
> > > either scenario. That's probably your biggest up-front cost -- making
> > sure
> > > the db server is up to the task.
> > > 2. The second architecture is suggested by WL. The reason is that if
> box
> > > #2 (WL) is a cluster, you can theoretically add more boxes easily to
get
> > > pseudo-linear scaling for JSP and EJB processing. Of course, that
only
> > > helps if your database is not a bottleneck ;-) WL cluster is $17k per
> > CPU.
> > > 3. The real answer is that it depends on your application and the
> number
> > of
> > > users that you are expecting. You want to make sure that when your
site
> > is
> > > loaded that there is no significant queueing of requests on the WL
side.
> > I
> > > believe you can see that information in the WL monitor.
> > >
> > > --
> > >
> > > Cameron Purdy
> > > http://www.tangosol.com
> > >
> > >
> > > "Chris Bick" <[email protected]> wrote in message
> > > news:[email protected]...
> > > > Which one of these architectures would give the best performance.
> > > >
> > > > First architecture:
> > > >
> > > > 3 boxes -
> > > >
> > > > 1st box - webserver(IIS or IPlaner) with a JSP engine. (The
> > JSP's
> > > > produce dynamic content.)
> > > > 2nd box - weblogic 5.1 hosting EJB's
> > > > 3rd box - Oracle or DB2
> > > >
> > > > The 1st box is used to server up dynamic contect. The JSP's make
> > dynamic
> > > > contect from calls into the EJB container in the 2nd box. The
EJB's
> > then
> > > > calls the DB in the 3rd box.
> > > >
> > > > 2nd architecture:
> > > >
> > > > 3 boxes-
> > > >
> > > > 1st box - webserver with weblogic plug-ins for IIS or IPlanet
> > > > 2nd box - weblogic 5.1 - hosting JSP pages and EJBs
> > > > 3rd box - Oracle or DB2
> > > >
> > > > The 1st box's webserver just receives the request to JSPs and lets
the
> > > > plug-in find the appropriate weblogic instance. The JSPs that are
> > > processed
> > > > on the 2nd box make calls into the EJB container on the 2nd box.
The
> > EJBs
> > > > then make calls to the DB on the 3rd box.
> > > >
> > > > thanks
> > > > -cb
>
>
>
-
Calling OC4J deployed EJB from Oracle 8.1.7 DB
Hi
I have deployed a Stateless Session Bean to OC4J (9.0.2). The client works fine. The Servlet and JSP works fine.
What I need to do now is call this EJB from PL/SQL , ie call from Database PL/SQL package to wrapper to OC4j EJB.
Trying to get this loaded into Oracle DB we get a class compilation error with the
com.evermind....rmi... class. I do believe this is the OC4J implementation of RMI lookup. Is there a comparable class to load in the DB?
Any ideas how to ??
Tks
Andre
Here is a client sample of calls to the EJB
package SampleWizUpdates;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import WizUpdates.WizAllocTotals;
import WizUpdates.WizAllocTotalsHome;
import resTotals;
import resSuccess;
import javax.rmi.*;
public class WizAllocTotalsClient2
public static void main(String [] args)
WizAllocTotalsClient2 wizAllocTotalsClient2 = new WizAllocTotalsClient2();
try
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
env.put(Context.SECURITY_PRINCIPAL, "admin");
env.put(Context.SECURITY_CREDENTIALS, "manager");
env.put(Context.PROVIDER_URL, "ormi://sdt10645:23791/WizAllocTotals");
Context ctx = new InitialContext(env);
WizAllocTotals totalsBean;
Object homeObject = ctx.lookup("WizAllocTotals");
WizAllocTotalsHome home =
(WizAllocTotalsHome)PortableRemoteObject.narrow(homeObject,
WizAllocTotalsHome.class);
totalsBean = (WizAllocTotals)PortableRemoteObject.narrow(home.create(),
WizAllocTotals.class);
// create new EJB instance
totalsBean = home.create( );
// Call any of the Remote methods below to access the EJB
int operatorId = 1238;
resTotals newRes = new resTotals();
resSuccess newResSucc = new resSuccess();
String newDataBase = "dwz3";
int eventRefNo = 17445291;
int actionNumber = 3;
int allocValue = 125;
totalsBean.setDataBase( newDataBase );
newRes = totalsBean.getOperatorTotals( operatorId, eventRefNo );
System.out.println("Result total 1 is "+newRes.totTransactLimitValue);
System.out.println("Result total 2 is "+newRes.totDailyLimitValue);
System.out.println("Result total 3 is "+newRes.totWeeklyLimitValue);
System.out.println("Result total 4 is "+newRes.totMonthlyLimitValue);
System.out.println("Result total 5 is "+newRes.remDailyLimitValue);
System.out.println("Result total 6 is "+newRes.remWeeklyLimitValue);
System.out.println("Result total 7 is "+newRes.remMonthlyLimitValue);
System.out.println("Result success code is "+newRes.resCode);
System.out.println("Result success message is "+newRes.resMessage);
newRes = totalsBean.setOperatorTotals(operatorId,
eventRefNo,
actionNumber,
allocValue,
"C",
"Testing Reason");
System.out.println("Insert result success code is "+newRes.resCode);
System.out.println("Insert result success message is "+newRes.resMessage);
catch(Throwable ex)
ex.printStackTrace();
}Hi Andre,
I am using stand-alone OC4J version 9.0.2.0.0 under (SUN) Solaris 7
with JDK 1.3.1 and Oracle DBMS version 8.1.7.4.
I have not yet been able to create a java stored procedure in the
database that directly looks up an EJB deployed to OC4J.
The only two ways I have found to "talk to" an EJB from a java stored
procedure is
1) go through a servlet
2) go through a "remote" object (using RMI)
For the first option, deploy an application to OC4J that contains
your EJBs and a servlet (which acts as the client for the EJBs).
Then, from your java stored procedure, contact the servlet using
the classes in the "java.net" package -- including "URL" and "URLConnection".
For the second option, use the "rmiregistry" to register a remote
object. This remote object acts as the EJB client. The remote object
does not need to be part of an application deployed to OC4J. Then
contact the remote object from your java stored procedure.
Hope this helps.
Good Luck,
Avi. -
Removing calls that are in the resource selection queue
Hi Folks, I have a strange query. Is there any way to remove calls that have been presented to the resource selection step but are in the queue waiting for a free agent? I have created a varable that gets the current time and then created another varable that is poplated with the same syntax that is received from the T[now] step then done a IF atep with a > between to check if the current time varable is greater than the other varables but thi sis then applied after the queued after the select resource step but it doesnt work obviously BUT I was wondering if it can be. If the system has already accepted a call and tried to present it to an agent, can it be removed?
ThanksI think I see clearer now.
Ok, so what you want to do is very logical and good practice. Instead of doing the time stamps, which will work, you could just use the time of day step.
Also, if you wanted to take it a step further, you could take the callers Estimated Wait Time (EWT) from the Get Reporting Statistics step (not all that accurate, but could be a good guess at times), and then see if the closing time (5:00 in your example) is more than the number of minutes away held in EWT, from the current time.
Example: Caller calls in a 4:55, and you close at 5:00. The EWT says they'll wait only 1 minute, then you queue them. However, if the EWT says they'll wait 8 minutes, then you do not queue them, and tell them you're already closed.
Just a thought, but it does sound like you are doing it right. I have seen too many times to count, people forgetting to put logic within the queue loop to cover things like business hours, day changes, holidays, no agents logged in, etc.
Good luck and happy scripting!
Anthony Holloway
Please use the star ratings to help drive great content to the top of searches. -
Hi,
I have a entity EJB with following methods:
findByPrimaryKey(PK)
create(PK)
get and set methods
I wanna add a remove method which will take the PK and delete the record for
me.
Please tell me the changes I have to incorporate. and How do i do it. I am using VA 3.5 and WAS 3.5
Thanx & Regards
Ravi Mittalhi,
after adding access bean & generating deployed code you have to add remove method in Access Bean by yourself. remove(object) is in EJBhome interface.
you have to pass object of key class. so add empty remove() in acees bean. instantiate ur key class there & call remove(keclassobject) method. I think it will help you.
-priya -
Help needed in EJB - to call AS from EJB a Session Bean
Hi All ,
I have been strictly told not to use Web Services as all the applications are on the same server
actually I have to make an EJB invocation to an Application Service from the CAF layer from a Session Bean of another EJB Project(Not a CAF Service).
the CAF layer has 5 parts metadata , permissions , dictionary , ear and ejbmodule.
I added the ejbModule to the Build Path of the calling EJB Session Bean. And so I was able to access the operations of the Application Service which in turn accesses a BAPI(The Appl Service operation returns a String).
But while executing I got the exception java.lang.RuntimeException: java.lang.NoClassDefFoundError
My method :
Normally from a Dynamic Web Project acting as a client to an EJB Session bean, I was able to get access to EJB Local Interface by using
private ConverterLocal converterBean = null;
public void jspInit() {
try {
InitialContext ic = new InitialContext();
converterBean = (ConverterLocal)
ic.lookup("java:comp/env/Converter");
} catch (Exception ex) {
System.out.println("Couldn't create converter bean."+
ex.getMessage());
BigDecimal dollarAmount = converterBean.euroToDollar(value);
So I created a JNDI field in ejb-j2ee-engine.xml
enterprise-beans>
<enterprise-bean>
<ejb-name>com.sap*******.bapi_company_getlist.BAPI_COMPANY_GETLIST</ejb-name>
<jndi-name>COMPANY</jndi-name>
</enterprise-bean>
</enterprise-beans>
And from my Session Bean , I tried to access it using the code in already existing Bean which was working fine
BAPI_COMPANY_GETLISTBeanImpl bean = new BAPI_COMPANY_GETLISTBeanImpl();
try {
InitialContext ctx = new InitialContext();
bean = (BAPI_COMPANY_GETLISTBeanImpl)ctx.lookup("COMPANY");
} catch (NamingException e) {
System.out.println("Converter Bean can't be created");
String send = bean.returnDetails();
And I tried to print the String , but I got the above error
I have a doubt :
1) How do I specify the JNDI name ie in the ejb-j2ee-engine.xml file , what should I add as the name of the ejb
is this sufficient , or are there more steps ??Hi Ekaterina,
I have the document to access my Bean from another Bean.
I could access my Bean from a standalone Java class with this code
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,"com.sap.engine.services.jndi.InitialContextFactoryImpl");
props.put(Context.PROVIDER_URL,"hostname:port");
try{
Context ctx = new InitialContext(props);
Object o = ctx.lookup("sap.com/TestEAR/REMOTE/TestBean/com.@#$.TestRemote");
TestRemote testRem = (TestRemote)javax.rmi.PortableRemoteObject.narrow(o, TestRemote.class);
String msg = testRem.getMessage();
System.out.println(msg);
And in this document there is a way shown to access a bean from another Bean.
http://help.sap.com/saphelp_nw04/helpdata/en/13/c8633e0084e946e10000000a114084/frameset.htm
If your client is another enterprise bean, declare the EJB reference in the ejb-jar.xml.
-For more information, see Declaring EJB References.
But the problem is that in EJB 3.0 , I can't see the ejb-jar.xml file .
So how should I have a Bean as a client to another Bean, I am not that familiar with Annotations. -
Can anyone point me in the right direction on the best practice for calling an RFC using SSO from an EJB?
When using the local interface for the EJB, the only solution I see is to pass the authenticated IUser instance from the portal component to the EJB business method through the method signature.
I am guessing that there is a better way to get access to an authenticated user in the EJB container.Thanks for the reply.
Actually I was able to solve the problem last night. To get SSO to work in my local EJBs I created an RFC destination in the destination service using the visual administrator. I then used the destination service at runtime to pull the system definition from the J2EE system definitions store instead of the portal system landscape definitions and my connection object was created as expected.
Here is the code to create the connection in my EJB business method:
//get the user
IUser user = UMFactory.getUserFactory().getUserByUniqueName(this.myContext.getCallerPrincipal().getName());
// get the destination service
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sapportals.portal.prt.registry.PortalRegistryFactory");
InitialContext context = new InitialContext(env);
IDestinationsService destinationsService =
(IDestinationsService) context.lookup(IDestinationsService.SERVICE_JNDI_NAME);
// define a destination filter to restrict to the RFC defined destinations
DestinationFilter destinationFilter1 =
new DestinationFilter(DestinationFilter.SOURCE_J2EE_DESTINATION_SERVICE, DestinationFilter.TYPE_SAP);
// get a user specific connection
IConnection connection = destinationsService.getConnection(user, "ECC", destinationFilter1); -
How to call RFC using EJB module.
hi,
I want to call the RFC using EJB module in java. how to do it.
if someone having the code plz post it.
regards,
Shanthakumar./***Start of JRA specific code***//
// Retrive connection factory
InitialContext initialcontext = new InitialContext();
connectionfactory = (ConnectionFactory) initialcontext.lookup("java:comp/env/ConnFactory");
//Request a connection handle:
connection = connectionfactory.getConnection();
//Create a RecordFactory object to get a metadata description
// of the RFC SALERT_CREATE
RecordFactory recordFactory = connectionfactory.getRecordFactory();
// Create Record objects containing all
// necessary information about the RFM.
MappedRecord input = recordFactory.createMappedRecord("SALERT_CREATE");
//Fill in the import parameters and the import table structure data here
input.put("IP_CAT", "ALRT_CAT"); // alert category
// Refer to the SW_CONT structure of the table of RFC SALERT_CREATE
ResultSet inputITContainer = (ResultSet) input.get("IT_CONTAINER");
int tabIndex = 0;
inputITContainer.moveToInsertRow();
inputITContainer.updateString("ELEMENT", "CONT_1");
inputITContainer.updateString("TAB_INDEX", "" + tabIndex++);
inputITContainer.updateString("ELEMLENGTH", "250");
inputITContainer.updateString("TYPE", "C");
inputITContainer.updateString("VALUE","Container_1 value");
inputITContainer.insertRow();
inputITContainer.moveToInsertRow();
inputITContainer.updateString("ELEMENT", "CONT_N");
inputITContainer.updateString("TAB_INDEX", "" + tabIndex++);
inputITContainer.updateString("ELEMLENGTH", "250");
inputITContainer.updateString("TYPE", "C");
inputITContainer.updateString("VALUE","Container_N value");
inputITContainer.insertRow();
interaction = connection.createInteraction();
// execute the call with the input parameters.
interaction.execute(null, input);
}catch(Exception e){
// Error handling code goes here
}finally{
try {
if (interaction != null)
interaction.close();
if (connection != null)
connection.close();
} catch (Exception ignored) {
// Do nothing
// Pass on module data to the next module in chain, unaltered
return moduleData;
Maybe you are looking for
-
Badi ISU_PRODUCT_CHANGE and creation of a new contract line item
Hello Gurus; I have this requirement: Once a contract gets close the ending date (30 days before) i need to automatically renew the contract. In order to do that i thought that an action in the Contract Item might get the job done and browsing i foun
-
Implementation Of Badi ME_GUI_PO_CUST for adding fields in Purchase Order
Hi All I am implementing BADI ME_GUI_PO_CUST / ME_PROCESS_PO_CUST to add additional fields in Purchase Order. The implementation of the BADI ie the Subscreen of the fields to be added appears in transaction ME23N but it does not appear in the tra
-
I'm trying to write a function internal function isObscured(o: DisplayObject, p: DisplayObject): Boolean; which tells whether the given object o is partially or completely obscured by the object p. I already tried using hitTestObject and hitTestP
-
Itunes 10.0 Crash/Freeze when beginning to importing CD
All, I recently bought my father an iPod Nano 5th gen. We got about 5 CD's properly imported on iTunes 9 when I was showing him how to import and sync his device. However, soon after I 'cut him loose' he reported a problem with the iTunes freezing an
-
Need help merging these two files togehter
I have the following class files one reads in a file another creates a file, Can somebody help me put the two class files together so i have one file which creates a file and reads it in, as i am stuck as to which bits need to be copied and which bit