[Installation, Configuration & Deployment] - MBean service either has no business interface or does not i
by brettcave
I found the following thread, but no response as yet:
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4180208
We are busy with a jbas4.2.2 -> 5.1.0.GA migration, and have an mbean:
MyMBeanService.java:
| @Service(objectName = "mycompany:service=MyMBeanService")
| @Management(MyMBeanServiceMBean.class)
| public class MyMBeanService extends ServiceMBeanSupport implements MyMBeanServiceMBean {}
|
MyMBeanServiceMBean.java:
| public interface MyMBeanServiceMBean {}
|
It is being mapped as an mbean, via jboss-service.xml:
| <mbean code="com.mycompany.mypackage.management.MyMBeanService"
| name="mycompany:service=MyMBeanService">
| </mbean>
|
When I deploy this to JBAS 5, I get the following error:
| ERROR [org.jboss.management.j2ee.MBean] (main) Could not destroy JSR-77 MBean: mycompany:service=MyMBeanService
| javax.management.MBeanRegistrationException: preDeregister
| at org.jboss.mx.server.registry.BasicMBeanRegistry.unregisterMBean
| ....
| Caused by: javax.management.RunimeOperationsException
| at org.jboss.mx.server.MBeanServerImpl.removeNotficationLister
| ...
| Caused by: java.lang.IllegalArgumentException: The MBean mycompany:service=MyMBeanService exists but does not implement the NotifcationBroadcaster interface.
|
So I added the implementation:
| public class MyMBeanService extends ServiceMBeanSupport implements MyMBeanServiceMBean, NotificationBroadcaster {}
|
which results in the following error
| ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (HDScanner) Error installing to Real: name=vfszip:/usr/share/jbo
| ss/jboss-5.1.0.GA/server/all/farm/7-Project-ear.ear/ state=PreReal mode=Manual requiredState=Real
| org.jboss.deployers.spi.DeploymentException: Error deploying Project.sar: Error creating ejb container MyMBeanService: Bean Class com.mycompany.project
| .management.MyMBeanService has no local, webservice, or remote interfaces defined and does not implement at least one business interface: MyMBeanService
| at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:196)
| at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:99)
|
I found a reference to the EJB 3 spec on JBoss Jira:
"if a bean class implements a single interface, that interface will be assumed to be the business interface of the bean."
And if a bean class implements more than 1 interface, then the business interface is specified through @Local or @Remote.
So I added the annotation to MyMBeanServiceMBean:
| @Local
| public interface MyMBeanServiceMBean {}
|
After deploying this, I get the same error about the mbean existing, but not implementing NotificationBroadcaster interface (even though the bean does implement NotificationBroadcaster).
I have also tried extending NotificationBroadcaster in the ServiceMBean:
| public interface MyMBeanServiceMBean extends NotificationBroadcaster {}
|
which also still results in the not implementing notificationbroadcaster error.
Not sure how to resolve this for this implementation (or perhaps a bug?)
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4263664#4263664
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4263664
16 years, 5 months
[Beginner's Corner] - Re: ManyToMany problem
by swenu
Hi again :D
i found a solution - at least i'm close to a solution.
I added this function to the Role.
| @OneToMany(mappedBy="role")
| private List<RoleFunction> listRoleFunctions;
| ...
| public List<Function> getFunctions(){
| List<Function> functions = new ArrayList<Function>();
| if(this.listRoleFunctions != null){
| for(RoleFunction rf:this.listRoleFunctions){
| Function f = new Function();
| f = rf.getFunction();
| functions.add(f);
| }
| }
| return functions;
| }
|
| public void setFunctions(List<Function> functions){
| if(functions.size() > this.listRoleFunctions.size()){
| //New function to add
| for(Function f:functions){
| boolean add = true;
| for(RoleFunction roleFunction:this.listRoleFunctions){
| if(roleFunction.getId().equals(f.getId())){
| add = false;
| break;
| }
|
| }
| if(add){
| RoleFunction rf = new RoleFunction();
| rf.setFunction(f);
| rf.setRole(this);
| System.out.println("Adding (rf from lRF)"+rf.getRole().getName() +"."+rf.getFunction().getName());
| this.listRoleFunctions.add(rf);
| }
| }
| }else{
| //Function to remove
| System.out.println("remove function");
| for(RoleFunction roleFunction:this.listRoleFunctions){
| boolean remove = true;
| for(Function f:functions){
| if(roleFunction.getId().equals(f.getId())){
| remove = false;
| break;
| }
| }
| if(remove){
| this.listRoleFunctions.remove(roleFunction);
| }
| }
| }
| }
|
The only thing which doesn't work is if a user deselect a already saved function assignment.
I always get this error:
10:49:58,960 INFO [STDOUT] remove function
| 10:49:58,960 SEVERE [component] /roleList.xhtml @72,106 value="#{roleHome.instance.functions}": Error writing 'functions' on type ch.emtm.entity.Role
| java.util.ConcurrentModificationException
| at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
| at java.util.AbstractList$Itr.next(AbstractList.java:343)
| at org.hibernate.collection.AbstractPersistentCollection$IteratorProxy.next(AbstractPersistentCollection.java:577)
| ...
Hope someone got input to solve this issue!
Thanks in advance for any hint
Greets
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4263631#4263631
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4263631
16 years, 5 months