I have been getting this quite a lot lately, with JBoss
3.2.4RC1 from CVS (about a month old). The exception is
thrown from the following code:
public void linkExpressionProbesAndAnnotations()
throws AnalysisException {
try {
// Load all of the ExpressionProbe records
and process them so that their one-to-one
// relations with the
ExpressionProbeAnnotation database are correct.
// This could take a long time, and with
CMP, also a lot of memory, unfortunately.
Collection probes =
ExpressionProbeUtil.getLocalHome().findAll();
for (Iterator i = probes.iterator();
i.hasNext();) {
ExpressionProbeLocal probe =
(ExpressionProbeLocal)i.next();
String probeName = probe.getName();
String chipName =
probe.getChipType().getName();
Collection annotations =
ExpressionProbeAnnotationUtil.getLocalHome().findByProbeNameAndChipName(probeName,
chipName);
if (!annotations.isEmpty() &&
annotations.size() > 0) {
probe.setAnnotation((ExpressionProbeAnnotationLocal)annotations.iterator().next());
} else {
log.warn("Empty Annotations!
"+annotations.size());
}
probe = null;
annotations.clear();
}
} catch(Exception e) {
e.printStackTrace();
throw new AnalysisException("Unable to link
expression annotations.", e);
}
}
The line that it is thrown from is the line which
begins 'probe.setAnnotation'. Since there is no
EJBCreate actually ocurring (unless it's somewhere in
the container) -- all I'm doing is finding objects
using a finder -- I think this is a bug in the container.
Thanks.
-S
10:25:50,446 ERROR [LogInterceptor]
TransactionRolledbackLocalException in metho
d: public abstract void
ca.scgp.stembase.ejb.ExpressionProbeLocal.setAnnotation(
ca.scgp.stembase.ejb.ExpressionProbeAnnotationLocal),
causedBy:
java.lang.IllegalStateException: A CMR field cannot be
set in ejbCreate; this sh
ould be done in the ejbPostCreate method instead [EJB
2.0 Spec. 10.5.2].
at
org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.setValue(JDB
CCMRFieldBridge.java:604)
at
org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler.invoke
(EntityBridgeInvocationHandler.java:121)
at
org.jboss.proxy.compiler.Runtime.invoke(Runtime.java:59)
at
ca.scgp.stembase.ejb.ExpressionProbeCMP$Proxy.setAnnotation(<generate
d>)
at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.jboss.ejb.EntityContainer$ContainerInterceptor.invoke(EntityConta
iner.java:1096)
at
org.jboss.ejb.plugins.cmp.jdbc.JDBCRelationInterceptor.invoke(JDBCRel
ationInterceptor.java:72)
at
org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntityS
ynchronizationInterceptor.java:282)
at
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invo
ke(CachedConnectionInterceptor.java:185)
at
org.jboss.ejb.plugins.EntityReentranceInterceptor.invoke(EntityReentr
anceInterceptor.java:114)
at
org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstance
Interceptor.java:175)
at
org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockIntercep
tor.java:89)
at
org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreation
Interceptor.java:54)
at
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInte
rceptor.java:84)
at
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxIntercep
torCMT.java:305)
at
org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:1
47)
at
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.
java:118)
at
org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
at
org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFacto
ryFinderInterceptor.java:122)
at
org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:489
)
at
org.jboss.ejb.Container.invoke(Container.java:700)
at
org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalPro
xyFactory.java:375)
at
org.jboss.ejb.plugins.local.EntityProxy.invoke(EntityProxy.java:38)
Logged In: YES
user_id=543482
In JDBCStoreManager, does the following method look like this?
public void activateEntity(EntityEnterpriseContext ctx)
{
activateEntityCommand.execute(ctx);
// looad at the cache for preloaded data
boolean loaded = readAheadCache.load(ctx);
// if there was some preloaded (in this current tx)
data, we can set valid to true
// and avoid executing load command when the instance
is accessed.
if(loaded)
{
ctx.setValid(true);
entityBridge.setCreated(ctx);
}
}
Please, try it with fresh 3.2.4 copy from CVS. Thanks.
Logged In: YES
user_id=237922
I updated my 3.2.4RC1 to the CVS release from today, and the
error can no longer be reproduced. It took me a little while
to adapt to Tomcat 5, but it no longer gives the
IllegalStateException with the same code I mentioned above.
Thanks, Alexey.
Logged In: YES
user_id=543482
Thanks.