Setting Up Logon Manager on Client side.

236 views
Skip to first unread message

Mithun Patil

unread,
Aug 4, 2021, 1:28:04 AM8/4/21
to jPOS Users
Hi All,

  Implementing Logon manager on client side to manage the sigon or sign off or Echo. 
 But getting Class Not found Exception.  Please help to resolve this issue.

Below is the code and error log :

Error Facing in Q2 :

<log realm="Q2.system" at="Tue Aug 03 21:33:10 IST 2021.595">
  <warn>
    deploy
    <exception name="The MBean class could not be loaded">
    javax.management.ReflectionException: The MBean class could not be loaded
at com.sun.jmx.mbeanserver.MBeanInstantiator.loadClass(MBeanInstantiator.java:654)
at com.sun.jmx.mbeanserver.MBeanInstantiator.findClass(MBeanInstantiator.java:119)
at com.sun.jmx.mbeanserver.MBeanInstantiator.findClass(MBeanInstantiator.java:142)
at com.sun.jmx.mbeanserver.MBeanInstantiator.instantiate(MBeanInstantiator.java:618)
at com.sun.jmx.mbeanserver.MBeanInstantiator.instantiate(MBeanInstantiator.java:527)
at com.sun.jmx.mbeanserver.JmxMBeanServer.instantiate(JmxMBeanServer.java:990)
at org.jpos.q2.QFactory.instantiate(QFactory.java:70)
at org.jpos.q2.Q2.deploy(Q2.java:438)
at org.jpos.q2.Q2.deploy(Q2.java:264)
at org.jpos.q2.Q2.run(Q2.java:168)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: com.ezetap.server.pg.jpos.listener.LogonManager
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at com.sun.jmx.mbeanserver.MBeanInstantiator.loadClass(MBeanInstantiator.java:649)
... 10 more
    </exception>
  </warn>
</log>

Channel.xml :

<?xml version="1.0" ?>
<channel-adaptor name='ni' class="org.jpos.q2.iso.ChannelAdaptor" logger="q2">
<channel class="org.jpos.iso.channel.NACChannel" logger="Q2" packager="com.ezetap.server.pg.jpos.processor.NIPackager" header="49534F303036303030303730">
<property name="host" value="10.3.18.19" />
  <property name="port" value="28070"/>
  </channel> 
  <in>network_intl-send</in>
  <out>network_intl-receive</out>
  <reconnect-delay>10000</reconnect-delay>
</channel-adaptor> 

mux.xml :

<?xml version="1.0" ?>
<mux class="org.jpos.q2.iso.QMUX" logger="Q2" name="network_intl-mux">
<in>network_intl-receive</in>
<out>network_intl-send</out>
<unhandled>network_intl-unhandled</unhandled>
<ready>ni.ready</ready>
<key>11,41</key>
<property name="debug" value="true" />
<request-listener class="com.ezetap.server.pg.jpos.listener.NIResponse" logger="Q2">
</request-listener>
</mux>

logon.xml
<?xml version="1.0" ?>
<ni-logon-mgr class="com.ezetap.server.pg.jpos.listener.LogonManager" logger="Q2" name="ni-logon-mgr">
<property name="mux" value="network_intl-mux" />
<property name="channel-ready" value="ni.ready" />
<property name="timeout" value="90000" />
<property name="logon-interval" value="40000" />
</ni-logon-mgr>

LogonManager.Java

public class LogonManager extends QBeanSupport implements Runnable, Configurable {

private Space sp = SpaceFactory.getSpace();
public long echoInterval =600000;
private static Logger logger = Logger.getLogger(LogonManager.class);
public QMUX mux = null;

public LogonManager() {
super();
}

@Override
protected void startService() throws Exception {
String muxName = SwitchUtil.getInstance().getMux(PG.NETWORK_INTL.name());
mux = (QMUX) NameRegistrar.getIfExists(muxName);
this.run();
}

@Override
public void run() {
String readyKey = cfg.get("channel-ready");
while (running()) {
getLog().info ("Channel [" + readyKey + "] running ready");
Object sessionId = sp.rd(readyKey, cfg.getLong("timeout"));
getLog().info ("sessionId =" + sessionId);
if (sessionId == null) {
getLog().info ("Channel " + readyKey + " not ready");
NameRegistrar.register("LOGON"+readyKey, false);
continue;
}

try {
if (!sessionId.equals (sp.rdp ("LOGON"+readyKey))) {
doLogOn();
} else if (sp.rdp ("ECHO"+readyKey) == null) {
doEcho ();
}
} catch (Throwable t) {
getLog().warn (t);
}
ISOUtil.sleep(10000);
}
}

public void doLogOn() {
try {
String readyKey = cfg.get("channel-ready");
String muxName = SwitchUtil.getInstance().getMux(PG.NETWORK_INTL.name());
QMUX qmx = (QMUX) NameRegistrar.get(muxName);
ISOMsg logOn = createMsg(PG.NETWORK_INTL.name());
logOn.set(70,"001");
logOn.set(48,"6011002112N007842");
ISOMsg resp = qmx.request(logOn, Long.parseLong(SwitchUtil
.getInstance().getTimeOut(PG.NETWORK_INTL.name())));
logger.debug("LOGIN RESPONSE = [" + resp + "]");
if(resp!=null && resp.getString(39).equals(SwitchConstants.SUCCESS)) {
logger.info("Logon response from host:"+PG.NETWORK_INTL.name()+"success");
sp.out ("LOGON", new Object());
NameRegistrar.register("LOGON"+readyKey, true);
} else {
logger.error("Logon response failure from host:" + PG.NETWORK_INTL.name());
new SwitchException("Logon Response failure from host:"+PG.NETWORK_INTL.name());
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
}

}

public void doEcho() {
try {
String readyKey = cfg.get("channel-ready");
String muxName = SwitchUtil.getInstance().getMux(PG.NETWORK_INTL.name());
QMUX qmx = (QMUX) NameRegistrar.get(muxName);
ISOMsg resp = qmx.request(createMsg(PG.NETWORK_INTL.name()), Long.parseLong(SwitchUtil
.getInstance().getTimeOut(PG.NETWORK_INTL.name())));
if (resp != null
&& resp.getString(39).equals(SwitchConstants.SUCCESS)) {
logger.info("Echo response from host:" + PG.NETWORK_INTL.name() + "success");
NameRegistrar.register("LOGON"+readyKey, true);
sp.out ("ECHO", new Object(),echoInterval);
} else {
logger.error("Echo Response failure from host:" + PG.NETWORK_INTL.name()
+ "Connectivity might be down...");
new SwitchException("Echo Response failure from host:" + PG.NETWORK_INTL.name()
+ "Connectivity might be down...");
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
}

}

private ISOMsg createMsg(String host) throws ISOException {
Date d = new Date();
String gmt = ISODate.getDateTime(d, TimeZone.getTimeZone("GMT"));
String stan = getSTAN();
ISOMsg login = new ISOMsg("0800");
login.set(7, gmt);
login.set(11, stan);
login.set(70, "301");
login.setHeader(("ISO026000070").getBytes());
return login;
}

public String getSTAN() throws ISOException {
long stan = SpaceUtil.nextLong(sp, "stan") + 7400L;
if (stan >= 999999) {
sp.in("stan", 10000);
stan = SpaceUtil.nextLong(sp, "stan") + 7400L;
}
String sstan = ISOUtil.padleft((new StringBuffer(String.valueOf(stan)))
.toString(), 6, '0');
return sstan;
}


private Configuration configuration;
@Override
public void setConfiguration(Configuration configuration) throws ConfigurationException {
this.configuration = configuration;
}
}








kes...@phsolutions.in

unread,
Aug 4, 2021, 5:05:37 AM8/4/21
to jPOS Users
It seems Q2 is unable to find your LogonManager class (com.ezetap.server.pg.jpos.listener.LogonManager). Please make sure that the path is correct and is available in CLASSPATH.
Reply all
Reply to author
Forward
0 new messages