[JBoss-user] [Management, JMX/JBoss] - Re: Problem locating an MBeanServer
ok, I get that now How would I be able to do something like: Beanname.methodxyz(); e.g.: world.tell(); i.e. How can I get a reference? Sorry if that is already explained and I'm just missing it. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3953169#3953169 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3953169 Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Management, JMX/JBoss] - Re: Problem locating an MBeanServer
Hi, executing if (System.getSecurityManager() == null) { | System.setSecurityManager(new RMISecurityManager()); | } | Hashtable env = new Hashtable(); | String factory = "org.jnp.interfaces.NamingContextFactory"; | env.put(Context.INITIAL_CONTEXT_FACTORY, factory); | String url1 = "jnp://localhost:1099"; | env.put(Context.PROVIDER_URL, url1); | Context ctx = new InitialContext(env); | MBeanServerConnection mconn = (MBeanServerConnection)ctx.lookup("jmx/invoker/RMIAdaptor"); | ObjectName name = new ObjectName("jboss.jca:name=ds/DefaultDS,service=ManagedConnectionPool"); | Object val = mconn.getAttribute(name, "InUseConnectionCount"); | System.out.println(name + "\n\tInUseConnectionCount=" + val); leads to: anonymous wrote : javax.management.InstanceNotFoundException: jboss.jca:name=ds/DefaultDS,service=ManagedConnectionPool is not registered. | at org.jboss.mx.server.registry.BasicMBeanRegistry.get(BasicMBeanRegistry.java:523) | at org.jboss.mx.server.MBeanServerImpl.getAttribute(MBeanServerImpl.java:550) | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) | at java.lang.reflect.Method.invoke(Method.java:585) | at org.jboss.jmx.connector.invoker.InvokerAdaptorService.invoke(InvokerAdaptorService.java:266) | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) | 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:155) | at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94) | at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133) | at org.jboss.mx.server.Invocation.invoke(Invocation.java:88) | at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142) | at org.jboss.jmx.connector.invoker.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:108) | at org.jboss.mx.server.Invocation.invoke(Invocation.java:88) | at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264) | at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659) | at org.jboss.invocation.jrmp.server.JRMPProxyFactory.invoke(JRMPProxyFactory.java:179) | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) | 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:155) | at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94) | at org.jboss.mx.server.Invocation.invoke(Invocation.java:86) | at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264) | at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659) | at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:819) | at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:420) | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) | at java.lang.reflect.Method.invoke(Method.java:585) | at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294) | at sun.rmi.transport.Transport$1.run(Transport.java:153) | at java.security.AccessController.doPrivileged(Native Method) | at sun.rmi.transport.Transport.serviceCall(Transport.java:149) | at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460) | at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701) | at java.lang.Thread.run(Thread.java:595) I'm not sure I made myself quite clear on what i want to do. I want to obtain a reference to a Bean of my own, deployed in JBoss named WorldMBean which extends the interface World. What exactly are the lines ObjectName name = new ObjectName("jboss.jca:name=ds/DefaultDS,service=ManagedConnectionPool"); |
[JBoss-user] [Management, JMX/JBoss] - Re: Problem locating an MBeanServer
Thank you so much for pointing that out. One more problem remains: How do i get my stub? Currently I'm using the following code: (World being the ManagementInterface of the Bean I want to use) if (System.getSecurityManager() == null) { | System.setSecurityManager(new RMISecurityManager()); | } | Hashtable env = new Hashtable(); | String factory = "org.jnp.interfaces.NamingContextFactory"; | env.put(Context.INITIAL_CONTEXT_FACTORY, factory); | String url1 = "jnp://localhost:1099"; | env.put(Context.PROVIDER_URL, url1); | Context ctx = new InitialContext(env); | MBeanServerConnection mconn = (MBeanServerConnection)ctx.lookup("jmx/invoker/RMIAdaptor"); | | | world = (World) MBeanProxyExt.create( | World.class, | "trail:service=world"); which does not compile do to a MalformedObjectNameException. I would actually like to use the create methode that takes a third argument(an MBeanServer). Do you happen to know how I can get the MBeanServer from the MBeanServerConnection(which is actually a sub interface of the latter) How do you get acces to your Beans? Again, thank you so much. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3952751#3952751 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3952751 Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Management, JMX/JBoss] - Re: Problem locating an MBeanServer
Here's my current code : try{ | | if (System.getSecurityManager() == null) { | System.setSecurityManager(new RMISecurityManager()); | } | Hashtable env = new Hashtable(); | String factory = "org.jnp.interfaces.NamingContextFactory"; | env.put(Context.INITIAL_CONTEXT_FACTORY, factory); | String url1 = "jnp://localhost:1099"; | env.put(Context.PROVIDER_URL, url1); | Context ctx = new InitialContext(env); | MBeanServerConnection mconn = (MBeanServerConnection)ctx.lookup("jmx/invoker/RMIAdaptor"); | } | catch(NamingException e){e.getMessage(); e.printStackTrace();} with the normal/default java.policy file i get the following error: anonymous wrote : javax.naming.CommunicationException: Could not obtain connection to any of these urls: localhost:1099 and discovery failed with error: java.security.AccessControlException: access denied (java.net.SocketPermission 230.0.0.4 connect,accept,resolve) [Root exception is javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)]] | at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1414) | at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:594) | at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587) | at javax.naming.InitialContext.lookup(InitialContext.java:351) | at trail.SE.client.Client.main(Client.java:42) | Caused by: javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)] | at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:269) | at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1385) | ... 4 more | Caused by: java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve) | at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264) | at java.security.AccessController.checkPermission(AccessController.java:427) | at java.lang.SecurityManager.checkPermission(SecurityManager.java:532) | at java.lang.SecurityManager.checkConnect(SecurityManager.java:1034) | at java.net.Socket.connect(Socket.java:501) | at java.net.Socket.connect(Socket.java:457) | at java.net.Socket.(Socket.java:365) | at java.net.Socket.(Socket.java:265) | at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:84) | at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:77) | at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:239) | ... 5 more This seems to me to be a Problem in configuring the JBoss Server, as it seems to get the request and just deny access. Any ideas on how to configure that? switching to grant { | permission java.security.AllPermission; | }; I get : anonymous wrote : javax.naming.CommunicationException [Root exception is java.lang.ClassNotFoundException: org.jboss.jmx.adaptor.rmi.RMIAdaptor] | at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:728) | at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587) | at javax.naming.InitialContext.lookup(InitialContext.java:351) | at trail.SE.client.Client.main(Client.java:42) | Caused by: java.lang.ClassNotFoundException: org.jboss.jmx.adaptor.rmi.RMIAdaptor | at java.net.URLClassLoader$1.run(URLClassLoader.java:200) | at java.security.AccessController.doPrivileged(Native Method) | at java.net.URLClassLoader.findClass(URLClassLoader.java:188) | at java.lang.ClassLoader.loadClass(ClassLoader.java:306) | at java.lang.ClassLoader.loadClass(ClassLoader.java:251) | at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) | at java.lang.Class.forName0(Native Method) | at java.lang.Class.forName(Class.java:242) | at sun.rmi.server.LoaderHandler.loadProxyInterfaces(LoaderHandler.java:707) | at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:651) | at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:588) | at java.rmi.server.RMIClassLoader$2.loadProxyClass(RMIClassLoader.java:628) | at java.rmi.server.RMIClassLoader.loadProxyClass(RMIClassLoader.java:294) | at sun.rmi.server.MarshalInputStream.resolveProxyClass(MarshalInputStream.java:238) | at java.io.ObjectInputStream.readProxyDesc(ObjectInputStream.java:1494) | at java.io.ObjectInputStream.re
[JBoss-user] [Management, JMX/JBoss] - Re: Problem locating an MBeanServer
@PeterJ: Executing your code leads to the following: anonymous wrote : javax.naming.CommunicationException [Root exception is java.lang.ClassNotFoundException: org.jboss.jmx.adaptor.rmi.RMIAdaptor (no security manager: RMI class loader disabled)] | at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:728) | at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587) | at javax.naming.InitialContext.lookup(InitialContext.java:351) | at trail.SE.client.Client.main(Client.java:37) | Caused by: java.lang.ClassNotFoundException: org.jboss.jmx.adaptor.rmi.RMIAdaptor (no security manager: RMI class loader disabled) | at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:531) | at java.rmi.server.RMIClassLoader$2.loadProxyClass(RMIClassLoader.java:628) | at java.rmi.server.RMIClassLoader.loadProxyClass(RMIClassLoader.java:294) | at sun.rmi.server.MarshalInputStream.resolveProxyClass(MarshalInputStream.java:238) | at java.io.ObjectInputStream.readProxyDesc(ObjectInputStream.java:1494) | at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1457) | at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693) | at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299) | at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339) | at java.rmi.MarshalledObject.get(MarshalledObject.java:135) | at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:72) | at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:652) | ... 3 more any ideas on how i could activate the security manager? anonymous wrote : It seems he's trying to locate the local mbeanserver, which doesn't exist. To be perfectly honest I'm not sure what exactly I should be trying to connect to. At the end of the day I want my client to be able to connect to a server running on a different machine, currently my JBoss Server runs on the same machine but in a different vm. The weird thing is SessionBeans in the client work immediately (looking them up via the InitialContext) Is there a difference in the client code between connecting on a local machine and to a remote machine? thx for your help View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3952286#3952286 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3952286 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Management, JMX/JBoss] - Problem locating an MBeanServer
Hi, I have trouble with the following line of code: MBeanServer server = MBeanServerLocator.locate(); when executing the method it is in I get the following error: anonymous wrote : java.util.NoSuchElementException | at java.util.AbstractList$Itr.next(AbstractList.java:427) | at org.jboss.mx.util.MBeanServerLocator.locate(MBeanServerLocator.java:79) | at org.jboss.mx.util.MBeanServerLocator.locate(MBeanServerLocator.java:92) | at trail.SE.client.Client.main(Client.java:30) The result of the code would be used for getting a stub to a ServiceBean any help would be grealty appreciated, cheers deus machinarum View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3952065#3952065 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3952065 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Make hibernate ignore a certain getter method
hi, we dont want to store the return value of a certain public getter-method of an Entity-Bean in our DB, but we dont know how to annotate this correctly. Is there something like an @Ignore Tag? any help very much appreciated THX View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3950396#3950396 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3950396 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Management, JMX/JBoss] - Make Hibernate ignore certain getter methods of an EntityBea
hi, we dont want to store the return value of a certain getter-method, but we dont know how to annotate this correctly... help needed and very much appreciated THX View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3950308#3950308 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3950308 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Management, JMX/JBoss] - Problems deplyoing a Service POJO
Hi all, I'm doing a MUD game for uni where the central class would be World, a Service POJO that manages all the game logic and that the clients connect to. The problem is that I can't seem to deploy it as a Bean. Here's the code for the Management Interface: package functional; | | import org.jboss.annotation.ejb.Management; | | //@Management | public interface WorldManagement | { |//for testing |String tell(); | |void create() throws Exception; |void start() throws Exception; |void stop() throws Exception; |void destroy() throws Exception; | } Here's the implementing class: package functional; | | import java.util.Vector; | import javax.ejb.Remote; | import org.jboss.annotation.ejb.Service; | import org.jboss.annotation.ejb.RemoteBinding; | import org.jboss.annotation.ejb.Management; | import javax.persistence.*; | import java.io.Serializable; | | @Service (objectName="SE:service=world") | //@Remote(WorldRemote.class) | //@RemoteBinding (jndiBinding="SE/World") | @Management(WorldManagement.class) | @Entity | @Table(name="World") | public class World implements WorldManagement,Serializable{//, WorldRemote{ | //private static final long serialVersionUID; | | private String createdBy; | private String description; | private String name; | private Room startingRoom; | @OneToOne | private Vector rooms; | | public World(String createdBy, String description, String name, Vector rooms){ | this.name = name; | this.description = description; | this.createdBy = createdBy; | this.rooms = rooms; | } | | public boolean addRoom(Room room){ | return rooms.add(room); | } | | public boolean removeRoom(Room room){ | return rooms.remove(room); | } | | /** | * @return The description of the new Room | */ | public String move(Player player, Exit exit){ | String temp = "This is a default debug message."; | if(exit == null) | return "There is no Exit in this direction."; | | if(!exit.isOpen()){ | if(player.hasKey(exit.getOpens_with())){ | exit.open(); | player.removeItemfromInventory(exit.getOpens_with()); | temp = "You used a key to open the door.\n"; | } | else{ | return "You need a key you don't have to open this door."; | } | } | | if(movePlayer(player, player.getCurrentRoom(), exit.getOtherRoom(player.getCurrentRoom({ | temp += player.getCurrentRoom().getDescription(); | return temp; | } | | //default only, should never be reached | return temp; | | } | | private boolean movePlayer(Player player, Room from, Room to){ | if(from.remove(player) && to.add(player)){ | return true; | } | return false; | } | | public boolean addPlayer(Player player){ | return startingRoom.add(player); | } | | public boolean removePlayer(Player player){ | return player.getCurrentRoom().remove(player); | } | | public String tell(){return "test";} | | | | /** | * @return Returns the createdBy. | */ | public String getCreatedBy() { | return createdBy; | } | | /** | * @return Returns the description. | */ | public String getDescription() { | return description; | } | | /** | * @return Returns the name. | */ | @Id | public String getName() { | return name; | } | | public boolean kill(livingThing part){ | //in case of Player GUI Update | return part.getCurrentRoom().remove(part); | } | | public void initiateBattle(livingThing fighter1, livingThing fighter2){ | Battle battle = new Battle(fighter1, fighter2); | livingThing toKill = battle.start(); | kill(toKill); | } | | public void initiateTrade(Player player1, Player player2){ | | } | | public boolean pickUp(Player player, String item){ | return true; | } | | public boolean drop(Player player, String item){ | return true; | } | | /** | * @param The player to update | * @return The Strings concerning