Java Mailing List Archive

http://www.junlu.com/

Google
Google
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
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
- 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 Source code of java.lang.RuntimeException: Error creating MBeanProxy: trail:service
=calculator
[STDERR]     at org.jboss.mx.util.MBeanProxyExt Source code of org.jboss.mx.util.MBeanProxyExt(MBeanProxyExt.java:415)
[STDERR]     at org.jboss.mx.util.MBeanProxyExt Source code of org.jboss.mx.util.MBeanProxyExt(MBeanProxyExt.java:99)
[STDERR]     at org.jboss.mx.util.MBeanProxyExt Source code of org.jboss.mx.util.MBeanProxyExt(MBeanProxyExt.java:394)
[STDERR]     at org.jboss.mx.util.MBeanProxyExt Source code of 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

©2008 junlu.com - Jax Systems, LLC, U.S.A.