Bugs item #652520, was opened at 2002-12-12 13:04
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=652520&group_id=22866
Category: JBossServer
Group: v3.0 Rabbit Hole
Status: Closed
Resolution: Fixed
Priority: 9
Submitted By: Artemiy Zinoviev (bedriven)
Assigned to: Adrian Brock (ejort)
Summary: INSERTING AN ALREADY EXISTING BEAN
Initial Comment:
Hello all!
I have a Jboss version 3.0.4 an receive the same error
when trying to create a EJB.
I have tried use commit option A,B,C but it is not work.
When I use commit option C this error appears rarely
but take a place in any case.
I have tried to inspect JBoss source code and I have
found out next code in AbstractInstanceCache:
...
public void insert(EnterpriseContext ctx)
{
if (ctx == null) throw new IllegalArgumentException
("Can't insert a null object in the cache");
CachePolicy cache = getCache();
synchronized (getCacheLock())
{
// This call must be inside the sync block, otherwise can
happen that I get the
// key, then the context is passivated and I will insert in
cache a meaningless
// context.
Object key = getKey(ctx);
if (cache.peek(key) == null)
{
cache.insert(key, ctx);
}
else
{
// Here it is a bug.
// Check for all places where insert is called, and ensure
that they cannot
// run without having acquired the cache lock via
getCacheLock()
throw new IllegalStateException("INSERTING AN
ALREADY EXISTING BEAN, ID = " + key);
}
}
}
...
Could anyone tell me whats going on? My project under
the risk, please, I need help. Is it bug or something?
Stack trace is :
java.lang.IllegalStateException: INSERTING AN
ALREADY EXISTING BEAN, ID = [.]
at org.jboss.ejb.plugins.AbstractInstanceCache.insert
(AbstractInstanceCache.java:222)
at
org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHo
me(EntityInstanceInterceptor.java:103)
at
org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome
(EntityLockInterceptor.java:79)
at
org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHo
me(EntityCreationInterceptor.java:44)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext
(AbstractTxInterceptor.java:111)
at
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransacti
ons(TxInterceptorCMT.java:178)
at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome
(TxInterceptorCMT.java:52)
at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome
(SecurityInterceptor.java:105)
at org.jboss.ejb.plugins.LogInterceptor.invokeHome
(LogInterceptor.java:129)
at org.jboss.ejb.EntityContainer.invokeHome
(EntityContainer.java:487)
at
org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.inv
okeHome(BaseLocalContainerInvoker.java:230)
at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke
(LocalHomeProxy.java:110)
at $Proxy22.create(Unknown Source)
at
com.eurooil.managers.user.basic.DefaultUserManager.cr
eateUser(DefaultUserManager.java:147)
at com.eurooil.web.example.CreateUserAction.perform
(CreateUserAction.java:79)
at
org.apache.struts.action.ActionServlet.processActionPerf
orm(ActionServlet.java:1787)
at org.apache.struts.action.ActionServlet.process
(ActionServlet.java:1586)
at org.apache.struts.action.ActionServlet.doGet
(ActionServlet.java:492)
at javax.servlet.http.HttpServlet.service
(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service
(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalD
oFilter(ApplicationFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperValve.java:260)
at
org.apache.catalina.core.StandardPipeline$StandardPipe
lineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke
(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextValve.java:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipe
lineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.CertificatesValve.invoke
(CertificatesValve.java:246)
at
org.apache.catalina.core.StandardPipeline$StandardPipe
lineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke
(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke
(StandardContext.java:2396)
at org.apache.catalina.core.StandardHostValve.invoke
(StandardHostValve.java:180)
at
org.apache.catalina.core.StandardPipeline$StandardPipe
lineValveContext.invokeNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke
(ErrorDispatcherValve.java:170)
at
org.apache.catalina.core.StandardPipeline$StandardPipe
lineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke
(ErrorReportValve.java:172)
at
org.apache.catalina.core.StandardPipeline$StandardPipe
lineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.AccessLogValve.invoke
(AccessLogValve.java:469)
at
org.apache.catalina.core.StandardPipeline$StandardPipe
lineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke
(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineValve.java:174)
at
org.apache.catalina.core.StandardPipeline$StandardPipe
lineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke
(ContainerBase.java:995)
at
org.apache.catalina.connector.http.HttpProcessor.proces
s(HttpProcessor.java:1040)
at org.apache.catalina.connector.http.HttpProcessor.run
(HttpProcessor.java:1151)
at java.lang.Thread.run(Thread.java:484)
----------------------------------------------------------------------
>Comment By: Artemiy Zinoviev (bedriven)
Date: 2002-12-18 23:44
Message:
Logged In: YES
user_id=640956
This bug occured when I have hierarchy of beans.
For example I have AbstractEntityBean:
public abstract class AbstractEntityBean implements
EntityBean
{
private static final Category log = Category.getInstance
(AbstractEntityBean.class);
// -------------------------------------------------------------------------
// Members
// -------------------------------------------------------------------------
public EntityContext mContext;
private SequenceSessionLocalHome sequenceLocalHome;
private SequenceSessionLocal sequenceSession;
// -------------------------------------------------------------------------
// Methods
// -------------------------------------------------------------------------
public String toString()
{
return super.toString();
}
/**
* Retrive a unique creation id to use for this bean. This
will end up
* demarcating this bean from others when it is stored as a
record
* in the database.
*
* @return Returns an Long that can be used as a unique
creation id.
*
**/
protected Long generateUniqueId()
{
long id =
sequenceSession.getNextGlobalSequenceNumber();
return new Long(id);
//return new Long(IdProvider.getId());
}
// -------------------------------------------------------------------------
// Properties (Getters/Setters)
// -------------------------------------------------------------------------
/**
* Set the AbstractEntity's id.
* @param pId The id of this AbstractEntity.
*
* @ejb:interface-method view-type="local"
*
* @ejb:transaction type="RequiresNew"
*
**/
public abstract void setId(Long Id);
/**
* Retrieve the AbstractEntity's id.
*
* @return Returns an int representing the id of this
AbstractEntity.
*
*
* @ejb:persistent-field
* @ejb:pk-field
*
* @jboss:column-name name="Id"
**/
public abstract Long getId();
// -------------------------------------------------------------------------
// Framework Callbacks
// -------------------------------------------------------------------------
protected void init()
{
log.info("Initing");
try
{
Context context = new InitialContext();
sequenceLocalHome =
(SequenceSessionLocalHome) PortableRemoteObject.narrow(
context.lookup
(SequenceSessionLocalHome.JNDI_NAME),
SequenceSessionLocalHome.class);
sequenceSession = sequenceLocalHome.create();
}
catch(javax.naming.NamingException e)
{
throw new javax.ejb.EJBException(e);
}
catch(CreateException ce)
{
throw new javax.ejb.EJBException(ce);
}
log.info("Inited");
}
public void setEntityContext(EntityContext lContext)
{
init();
mContext = lContext;
}
public void unsetEntityContext()
{
//sequenceSession.remove(); //????
mContext = null;
}
public void ejbActivate()
{
log.info("Bean activated");
}
public void ejbPassivate()
{
log.info("bean id=" + getId() + " passivated");
}
public void ejbLoad()
{
log.info("Load id=" + getId());
}
public void ejbStore()
{
log.info("Store id=" + getId());
}
public void ejbRemove()
throws
RemoveException
{
}
}
And I have a legatee of AbstractEntityBean - with 1 field Name
LegateeEntityBean extends AsbtractEntityBean
{
.....
/**
* Retrieve the LegateeEntity`s name.
*
* @return Returns an String representing the Name of this
LegateeEntity.
*
* @ejb:persistent-field
*
* @jboss:column-name name="Login"
**/
public abstract String getName();
/**
* Sets the LegateeEntity's name.
*
* param pName The name of this LegateeEntity.
**/
public abstract void setName(String pName);
}
After it I run stress test that creates 2000 objects of
LegateeEntity. I use WAPT testing tool and JSP that creates
LegateeEntity. 20 users, each performs 100 requests.
After that I get error described above.
If I used commit option B each second request executed with
error. I have much more errors with commit option A. And
commit option C - I have approximately 200 errors per 2000
requests.
There are no error occurs if I don`t use inheritance. But it is
so ugly.
PS: Sorry for my bad English and so limited part of code. I
have NDA and I cannot post all code of project.
----------------------------------------------------------------------
Comment By: Adrian Brock (ejort)
Date: 2002-12-17 07:02
Message:
Logged In: YES
user_id=9459
Fixed in JBoss-3.0.5RC1 available from CVS
----------------------------------------------------------------------
Comment By: Sacha Labourey (slaboure)
Date: 2002-12-12 14:33
Message:
Logged In: YES
user_id=95900
Please add a test case or at least explain under which
condition it occurs.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=652520&group_id=22866
-------------------------------------------------------
This SF.NET email is sponsored by: Order your Holiday Geek Presents Now!
Green Lasers, Hip Geek T-Shirts, Remote Control Tanks, Caffeinated Soap,
MP3 Players, XBox Games, Flying Saucers, WebCams, Smart Putty.
T H I N K G E E K . C O M http://www.thinkgeek.com/sf/
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development