Hello All,

I have gotten the SMSServer working, at least it starts up.  I have
added an Interface type of JMX, which seems to be properly setup, as
JConsole seems to be able to get to it and list information about the
JMX service, however, when I try and call the JMX Remote method from a
client, I get the following exception:
Created JMX URL: service:jmx:rmi:///jndi/rmi://localhost:1988/SMSlib
Called JMX Factory connect
Called jmxc.getMBeanServerConnection
created mxbean and mbean proxy
Exception 5:java.lang.reflect.UndeclaredThrowableException
java.lang.reflect.UndeclaredThrowableException
        at $Proxy0.addOutboundMessage(Unknown Source)
        at
com.mycompany.myapp.communication.smslibmodem.SMSLibModemMessageSender.se
ndToModem(SMSLibModemMessageSender.java:650)
        at
com.mycompany.myapp.communication.smslibmodem.SMSLibModemMessageSender.se
ndBulkMessage(SMSLibModemMessageSender.java:392)
        at com.mycompany.myapp.server.MsgRequestProcessor.sendMessage
(MsgRequest
Processor.java:778)
        at com.mycompany.myapp.server.MsgRequestProcessor.run
(MsgRequestProcesso
r.java:285)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask
(ThreadPoolExecutor.java:
650)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run
(ThreadPoolExecutor.java:675)

        at java.lang.Thread.run(Thread.java:595)
Caused by: javax.management.InstanceNotFoundException:
org.smslib:type=SMSServer
        at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(Unknown
Source)
        at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getClassLoaderFor
(Unknown
 Source)
        at com.sun.jmx.mbeanserver.JmxMBeanServer.getClassLoaderFor
(Unknown Source)
        at javax.management.remote.rmi.RMIConnectionImpl$5.run(Unknown
Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at
javax.management.remote.rmi.RMIConnectionImpl.getClassLoaderFor
(Unknown Source)

        at javax.management.remote.rmi.RMIConnectionImpl.invoke
(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
        at sun.rmi.transport.Transport$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Unknown Source)
        at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown
Source)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0
(Unknown Source)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run
(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask
(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
Source)
        at java.lang.Thread.run(Unknown Source)
        at
sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer
(StreamRemoteCall
.java:247)
        at sun.rmi.transport.StreamRemoteCall.executeCall
(StreamRemoteCall.java:223)
        at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
        at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source)
        at javax.management.remote.rmi.RMIConnectionImpl_Stub.invoke
(Unknown Source)
        at javax.management.remote.rmi.RMIConnector
$RemoteMBeanServerConnection.invoke(RMI
Connector.java:972)
        at javax.management.MBeanServerInvocationHandler.invoke
(MBeanServerInvocationHandl
er.java:201)

Note, maybe this is important, but if so, I am unsure as to what it
should be:
Caused by: javax.management.InstanceNotFoundException:
org.smslib:type=SMSServer

I also know that i labeled some stuff as mxbean, and understand this
is not an mxbean, these are just "legacy" system.out's

My SMSConf server config file contains:
# Here is an example of a JMX interface.
interface.0=jmx1, Jmx
jmx1.registry_port=1988
jmx1.url=service:jmx:rmi:///jndi/rmi://localhost:1988/SMSlib
jmx1.object_name=org.smslib:name=SMSServer

I have not altered the SMSServer code or JMX code in any way

My client code looks like this, note I added aalot of debug...I dont
deal with JMX and RMI all that much ;-):
JMXServiceURL u = null;
        JMXConnector jmxc = null;
        MBeanServerConnection mbsc = null;
        SMSServerMethodsMBean mxbeanProxy = null;
        try
        {
            u = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://
localhost:1988/SMSlib");
            System.out.println("Created JMX URL: " +
"service:jmx:rmi:///jndi/rmi://localhost" + ":" + "1988" +  "/
SMSlib");
            Trace.info( Trace.COMMON, "Created JMX URL: " +
"service:jmx:rmi:///jndi/rmi://localhost" + ":" + "1988" +  "/
SMSlib");
        }catch(Exception e)
        {
            System.out.println("Exception 1:" + e.toString());
            Trace.info( Trace.COMMON, "Exception 1:" + e.toString());
        }
        try
        {
            jmxc = JMXConnectorFactory.connect(u);
            System.out.println("Called JMX Factory connect");
            Trace.info( Trace.COMMON, "Called JMX Factory connect");
        }catch(Exception e)
        {
            System.out.println("Exception 2:" + e.toString());
            Trace.info( Trace.COMMON, "Exception 2:" + e.toString());
        }
        try
        {
            mbsc = jmxc.getMBeanServerConnection();
            System.out.println("Called
jmxc.getMBeanServerConnection");
            Trace.info( Trace.COMMON,
"jmxc.getMBeanServerConnection");
        }catch(Exception e)
        {
            System.out.println("Exception 2.1:" + e.toString());
            Trace.info( Trace.COMMON, "Exception 2.1:" + e.toString
());
        }
        try{
           ObjectName mxbeanName = new ObjectName
("org.smslib:type=SMSServer");
           mxbeanProxy = (SMSServerMethodsMBean)
MBeanServerInvocationHandler.newProxyInstance(mbsc, mxbeanName,
SMSServerMethodsMBean.class, false);
           //mxbeanProxy = (SMSServerMethods)
MBeanServerInvocationHandler.newProxyInstance(mbsc, mxbeanName,
SMSServerMethods.class, false);
           Trace.info( Trace.COMMON, "created mxbean and mbean
proxy");
           System.out.println("created mxbean and mbean proxy");
           mxbeanProxy.addOutboundMessage(msg);
           Trace.info( Trace.COMMON, "called add outbound message");
           System.out.println("called add outbound message");
       }catch(Exception e)
       {
           System.out.println("Exception 5:" + e.toString());
           Trace.info( Trace.COMMON, "Exception 5:" + e.toString());
           e.printStackTrace();
       }

When I fire up the server, it creates the JMX interface:
0 [main] INFO org.smslib  - SMSLib: A Java API library for sending and
receiving SMS via a
 GSM modem or other supported gateways.
This software is distributed under the terms of the Apache v2.0
License.
Web Site: http://smslib.org
16 [main] INFO org.smslib  - Version: 3.3.3
16 [main] INFO org.smslib  - JRE Version: 1.6.0_06
16 [main] INFO org.smslib  - JRE Impl Version: 10.0-b22
16 [main] INFO org.smslib  - O/S: Windows XP / x86 / 5.1
16 [main] INFO org.smslib  - SMSServer: set balancer to:
LeastLoadLoadBalancer
78 [main] INFO org.smslib  - SMSServer: added gateway modem1 / Default
IP Modem Gateway.
78 [main] INFO org.smslib  - SMSServer: added interface jmx1 / JMX
based interface. / INOU
TBOUND
469 [main] INFO org.smslib  - Bound JMX to service:jmx:rmi:///jndi/
rmi://localhost:1988/SM
Slib
469 [main] INFO org.smslib  - SMSServer: interface:
org.smslib.smsserver.interfaces.Jmx st
arted.
469 [SMSLib-WatchDog] DEBUG org.smslib  - WatchDog started.
469 [SMSLib-WatchDog] INFO org.smslib  - WatchDog running...

Everything seems good, until it (the client) tries to call the Beans
Method addOutboundMessage...

Any ideas, suggestions, especially JMX sample client code would be
greatly appreciated, I am stuck at this point ;-)

It seems it doenst like the object name, but I did follow the JMX
interface recommendations from the SMSLib.org page, however it
unfortunately doesnt have any example code,  nor can I find any on the
internet

Thanks all

J

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SMSLib User Group" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/SMSLib?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to