Hi all,
I am running Timer Mbean and JBoss call it each 10 seconds.
I handle the notification in Listener class and i want to look up a
session bean here,
but i get NamingException and exception.getMessage() return null.
My Listener class:
package sonix;
import javax.management.*;
import javax.naming.*;
import sonix.session.*;
import javax.rmi.PortableRemoteObject;
import java.util.Properties;
public class Listener implements NotificationListener
{
public void handleNotification(Notification pNotification, Object
pHandback)
{
// Here to whatever you want or call a method
// in the outer class
System.out.println( "You got a Notification: " + pNotification );
Properties env = new Properties();
env.setProperty("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
env.setProperty("java.naming.provider.url", "localhost:1099");
// env.setProperty("java.naming.provider.url", "192.168.27.148:1099");
env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
try
{
InitialContext jndiContext = new InitialContext(env);
Object ref = jndiContext.lookup("sonix/session/ProcessNewAlarmS");
ProcessNewAlarmSHome alarmhome =
(ProcessNewAlarmSHome)PortableRemoteObject.narrow (ref,
ProcessNewAlarmSHome.class);
ProcessNewAlarmS alarm = alarmhome.create();
alarm.notifyAlarms();
}
catch(javax.naming.NamingException e)
{
System.out.println("Error: " + e.getMessage());
}
catch(javax.ejb.CreateException e)
{
System.out.println("Error: " + e.getMessage());
}
catch(java.rmi.RemoteException e)
{
System.out.println("Error: " + e.getMessage());
}
catch(Exception e)
{
System.out.println("Error: " + e.getMessage());
}
}
}
Line Object ref = jndiContext.lookup("sonix/session/ProcessNewAlarmS");
throws NamingException
Can someone help me?
Thank you in advance.
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user