Please help with writing EJB 3.0 Service. I can't get it to deploy. I wrote the following EJB 3.0 Service:
| @Service(objectName = "ejb3:service=PollingService") | @Management(PollingServiceManagement.class) | public class PollingService implements PollingServiceManagement { | | Thread pollingThread = null; | int pollingInterval = 30; | boolean destroy; | | public int getPollInterval() { | // TODO Auto-generated method stub | return pollingInterval; | } | | public void setPollInterval(int pollingInterval) { | this.pollingInterval = pollingInterval; | } | | // Lifecycle methods | public void create() throws Exception { | System.out.println("PollingService - Creating"); | pollingThread = new PollingThread(); | pollingThread.start(); | } | | public void destroy() { | System.out.println("PollingService - Destroying"); | destroy = true; | if(pollingThread != null && pollingThread.isAlive()) | pollingThread.interrupt(); | } | | public class PollingThread extends Thread { | @Override | public void run() { | while(!destroy){ | try{ | sleep(pollingInterval*1000); | System.out.println("Starting Poll..."); | }catch(InterruptedException ex){ | System.out.println("PollingThread interrupted: "+ex.getMessage()); | } | } | } | } | } | I could not get it to deploy without the jboss-service.xml. So I created one to describe the MBean: | <?xml version="1.0" encoding="UTF-8"?> | <server> | <mbean code="org.vss.jboss.service.PollingService" | name="ejb3:service=PollingService"> | </mbean> | </server> | I am getting the following error while trying to deploy a Service "sar" file. --------------------------------------------------- | 22:23:30,000 ERROR [MainDeployer] Could not create deployment: file:/F:/java/jboss-4.0.3SP1/server/default/deploy/ejb3Service.sar | org.jboss.deployment.DeploymentException: - nested throwable: (java.lang.reflect.UndeclaredThrowableException) | at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:178) | at org.jboss.system.ServiceController.install(ServiceController.java:215) | at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source) | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) | at java.lang.reflect.Method.invoke(Method.java:585) | at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141) | at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80) | at org.jboss.mx.server.Invocation.invoke(Invocation.java:72) | at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245) | at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644) | at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176) | at $Proxy4.install(Unknown Source) | at org.jboss.deployment.SARDeployer.create(SARDeployer.java:232) | at org.jboss.deployment.MainDeployer.create(MainDeployer.java:935) | at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:789) | at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:753) | at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source) | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) | at java.lang.reflect.Method.invoke(Method.java:585) | at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141) | at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80) | at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118) | at org.jboss.mx.server.Invocation.invoke(Invocation.java:74) | at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127) | at org.jboss.mx.server.Invocation.invoke(Invocation.java:74) | at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245) | at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644) | at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176) | at $Proxy6.deploy(Unknown Source) | at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:319) | at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:507) | at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:192) | at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:203) | at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:182) | Caused by: java.lang.reflect.UndeclaredThrowableException | at org.jboss.system.ServiceCreator.install(ServiceCreator.java:203) | at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.java:431) | at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:153) | ... 33 more | Caused by: java.lang.Error: Unresolved compilation problems: | Type mismatch: cannot convert from Service to Annotation | Management cannot be resolved to a type | | at org.vss.jboss.service.PollingService.<init>(PollingService.java:19) | at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) | at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) | at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) | at java.lang.reflect.Constructor.newInstance(Constructor.java:494) | at org.jboss.mx.server.MBeanServerImpl.instantiate(MBeanServerImpl.java:1218) | at org.jboss.mx.server.MBeanServerImpl.instantiate(MBeanServerImpl.java:271) | at org.jboss.mx.server.MBeanServerImpl.createMBean(MBeanServerImpl.java:329) | at org.jboss.system.ServiceCreator.install(ServiceCreator.java:124) | ... 35 more | View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3911874#3911874 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3911874 ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user