  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Tomcat - JSP/Servlet container | | Struts - A MVC web framework | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | JSP - A mailing list about Java Server Pages specification and reference | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | |
Struts & Hibernate
|
|
|
  | | | - Error creating MBeanProxy when using @Depends | - Error creating MBeanProxy when using @Depends 2007-06-12 - By mbarker
Back I used a Trailblazer tutorial as the basis for my example. http://trailblazer.demo.jboss.com/EJB3Trail/serviceobjects/jmx/index.html
The managment interfaces are Calculator and InvestmentAdvisor. The MBeans are CalculatorMBean and InvestmentAdvisorMBean. I want to inject Calculator into my other MBean, InvestmentAdvisorMBean. I receive an MBeanProxy error when deploying on JBoss 4.2.0.GA.
[EJBContainer] STARTED EJB: com.csg.mpg.service.CalculatorMBean ejbName: CalculatorMBean [STDOUT] Calculator - Creating [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.service .ServiceContainer [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=mpg-ejbs-1 (See http://jbs-1.ora-code.com).0.0-SNAPSHOT .jar,name=InvestmentAdvisorMBean,service=EJB3 with dependencies: [JmxKernelAbstraction] trail:service=calculator [EJBContainer] STARTED EJB: com.csg.mpg.service.InvestmentAdvisorMBean ejbName: InvestmentAdvisorMBean [STDERR] java.lang.RuntimeException : Error creating MBeanProxy: trail:service =calculator [STDERR] at org.jboss.mx.util.MBeanProxyExt (MBeanProxyExt.java:415) [STDERR] at org.jboss.mx.util.MBeanProxyExt (MBeanProxyExt.java:99) [STDERR] at org.jboss.mx.util.MBeanProxyExt (MBeanProxyExt.java:394) [STDERR] at org.jboss.mx.util.MBeanProxyExt (MBeanProxyExt.java:349)
I'd prefer to stick with the following because I can call calculator.calculate directly.
@(protected) ("trail:service=calculator") public void setCalculator (Calculator calculator) { this.calculator = calculator; }
but I discovered that the following works
@(protected) ("trail:service=calculator") private ObjectName calculatorName; It is clumsy since I have to loop through the various mbean servers (I have two for some reason) in order get the mbean and then call invoke.
Any thoughts on what I am missing?
Here are my classes
| public interface Calculator { | // Attribute | public void setGrowthrate(double g); | | public double getGrowthrate(); | | // The management method | public double calculate(int start, int end, double saving); | | // Life cycle method | public void create() throws Exception; | | public void destroy() throws Exception; | } | | @(protected)(objectName = "trail:service=calculator") | @(protected)(Calculator.class) | public class CalculatorMBean implements Calculator { | | double growthrate; | | public void setGrowthrate(double growthrate) { | this.growthrate = growthrate; | } | | public double getGrowthrate() { | return growthrate; | } | | public double calculate(int start, int end, double saving) { | double tmp = Math.pow(1. + growthrate / 12., 12. * (end - start) + 1); | return saving * 12. * (tmp - 1) / growthrate; | } | | // Lifecycle methods | public void create() throws Exception { | growthrate = 0.08; | System.out.println("Calculator - Creating"); | } | | public void destroy() { | System.out.println("Calculator - Destroying"); | } | | } | public interface InvestmentAdvisor { | | // The management method | public void advise(); | | // Life cycle method | public void create() throws Exception; | | public void destroy() throws Exception; | } | @(protected) (objectName="trail:service=investmentAdvisor") | @(protected)(InvestmentAdvisor.class) | public class InvestmentAdvisorMBean implements InvestmentAdvisor { | | private Calculator calculator; | | @(protected) ("trail:service=calculator") | public void setCalculator (Calculator calculator) { | this.calculator = calculator; | } | | public void create() throws Exception { | System.out.println("InvestmentAdvisorMBean created"); | } | | public void destroy() throws Exception { | System.out.println("InvestmentAdvisorMBean destroyed"); | } | | public void advise() { | System.out.println("InvestmentAdvisorMBean advising"); | calculator.calculate(25, 65, 300); | | } | } |
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic &p=4053675#4053675
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode =reply&p=4053675 __ ____ ____ ____ ____ ____ ____ ____ ____ ____ jboss-user mailing list jboss-user@(protected) https://lists.jboss.org/mailman/listinfo/jboss-user
|
|
 |