@Timeout method callbacks accessible only if public, against the EJB spec
-------------------------------------------------------------------------
Key: HHH-4800
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4800
Project: Hibernate Core
Issue Type: Bug
Components: annotations
Affects Versions: 3.3.1
Environment: hibernate-core: 3.3.1.GA
hibernate-annotations: 3.4.0.GA
Reporter: Maillefer Jean-David
Priority: Minor
The EJB 3 spec says that a @Timeout method callbacks can have any level access, but
hibernate find this method only if it's access is public.
What the spec says:
- "Enterprise JavaBeans 3.0, Final Release", 18.2.2 Timeout Callbacks, p 484:
"A Timeout method can have public, private, protected, or package level access"
- "Enterprise JavaBeans 3.1, Final Release", 18.2.5.3 Timeout Callback Method
Requirements, p. 520: "A timeout callback method can have public, private, protected,
or package level access"
Sample stateless bean that will cause an error (at deployment time) :
@Stateless
public class MyBean {
@Timeout
// private should be ok, but a bug prevent it
private void timeout(Timer timer) {
// timeout code here
}
}
Workaround: use public access level.
The (abbreviated) stacktrace of the resulting error:
org.jboss.deployers.spi.DeploymentException: Error deploying SITEJB.jar: No method
timeout(javax.ejb.Timer timer) found on bean MyBean
at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:196)
at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:99)
at
org.jboss.deployers.vfs.spi.deployer.AbstractVFSRealDeployer.internalDeploy(AbstractVFSRealDeployer.java:45)
at
org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
at
org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
at
org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
at
org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
at
org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1210)
at
org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
at
org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
at
org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
at
org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
at
org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
at
org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
at
org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
at
org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
at
org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
at
org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
at
org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
at
org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:362)
at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:255)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(Unknown
Source)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(Unknown
Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown
Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: No method timeout(javax.ejb.Timer timer) found on
bean FdsDAOBean
at org.jboss.ejb3.EJBContainer.getTimeoutCallback(EJBContainer.java:995)
at
org.jboss.ejb3.stateless.StatelessContainer.initializeTimeout(StatelessContainer.java:184)
at
org.jboss.ejb3.stateless.StatelessContainer.<init>(StatelessContainer.java:114)
at
org.jboss.ejb3.Ejb3AnnotationHandler.getStatelessContainer(Ejb3AnnotationHandler.java:310)
at
org.jboss.ejb3.Ejb3DescriptorHandler.getStatelessContainer(Ejb3DescriptorHandler.java:499)
at org.jboss.ejb3.Ejb3AnnotationHandler.getContainers(Ejb3AnnotationHandler.java:203)
at org.jboss.ejb3.Ejb3Deployment.deployElement(Ejb3Deployment.java:718)
at org.jboss.ejb3.Ejb3Deployment.deployElement(Ejb3Deployment.java:669)
at org.jboss.ejb3.Ejb3Deployment.deployUrl(Ejb3Deployment.java:651)
at org.jboss.ejb3.Ejb3Deployment.deploy(Ejb3Deployment.java:614)
at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:491)
at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:182)
... 29 more
Caused by: java.lang.NoSuchMethodException:
ch.etc.sit.impl.service.FdsDAOBean.timeout(javax.ejb.Timer)
at java.lang.Class.getMethod(Unknown Source)
at org.jboss.ejb3.EJBContainer.getTimeoutCallback(EJBContainer.java:987)
... 40 more
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira