SBB context : smppSession not bound Error !!

183 views
Skip to first unread message

Qasim Mansoor

unread,
Jun 4, 2012, 8:09:21 AM6/4/12
to mobicent...@googlegroups.com
Dear All,
 
I am getting following error while deploying SMPP RA, Any ideas how to get over it?
 
17:01:44,227 INFO  [MobicentsCache] Mobicents Cache started, status: STARTED, Mode: LOCAL
17:01:44,229 INFO  [SleeManagementMBean]  >< >< >< >< >< >< >< Mobicents JAIN SLEE 2.6.0.FINAL "GANDHI" starting >< >< >< >< >< >< ><
17:01:44,268 INFO  [SleeManagementMBean]  >< >< >< >< >< >< >< Mobicents JAIN SLEE 2.6.0.FINAL "GANDHI" started >< >< >< >< >< >< ><
17:01:44,281 INFO  [SmppResourceAdaptor] setFaultTolerantResourceAdaptorContext(FaultTolerantResourceAdaptorContext arg0)
17:01:44,281 INFO  [SmppResourceAdaptor] Activation RA SmppRA
17:01:44,400 INFO  [TcpLink] Opening TCP socket to /10.98.136.13:5016
17:01:44,586 INFO  [Session-1] SMSC did not supply SC_INTERFACE_VERSION. Disabling optional parameter support.
17:01:44,589 INFO  [SmppResourceAdaptor] Successfully bound to SMSC.
17:01:44,872 INFO  [SMPPSbbImpl] Trying to set up context ....
17:01:44,872 INFO  [SMPPSbbImpl] Called setSbbContext PtinAudioConf!!!
17:01:44,873 INFO  [SMPPSbbImpl] Could not set SBB context:smppSession not bound
17:01:44,879 INFO  [SMPPSbbImpl] Service Started ...
17:01:46,328 INFO  [Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080
17:01:46,489 INFO  [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
17:01:46,503 INFO  [ServerImpl] JBoss (Microcontainer) [5.1.0.GA (build: SVNTag=JBoss_5_1_0_GA date=200905221634)] Started in 1m:16s:107ms
 
Following is the SbbContext code:
 
public void setSbbContext(SbbContext context) {
 this.sbbContext = (SbbContextExt) context;
 tracer = context.getTracer(this.getClass().getSimpleName());
 this.timerFacility = this.sbbContext.getTimerFacility();  
 tracer.info("Trying to set up context ....");
 
 try {
    tracer.info("Called setSbbContext PtinAudioConf!!!");
 Context myEnv = (Context) new InitialContext().lookup("java:comp/env");
 
 smppSession = (SmppSession) myEnv.lookup("slee/resources/smpp/5.0/smppSession");
    smppAcif = (SmppTransactionACIFactory) myEnv.lookup("slee/resources/smpp/5.0/factoryprovider");
 
 
 } catch (NamingException ne) {
  tracer.info("Could not set SBB context:" + ne.getMessage());
  }
 }
 
Br,
./Qasim
 

Vilius Panevėžys

unread,
Jun 5, 2012, 3:55:34 AM6/5/12
to mobicent...@googlegroups.com
Hi,
that seems like a problem with your service, not the SMPP RA. You should
have defined the binding in your sbb-jar.xml under Resource Adaptor
entity binding element.

--------------------------------------------------------------------------------
<resource-adaptor-type-binding>
<resource-adaptor-type-ref>
<resource-adaptor-type-name>...</resource-adaptor-type-name>
<resource-adaptor-type-vendor>...</resource-adaptor-type-vendor>
<resource-adaptor-type-version>...</resource-adaptor-type-version>
</resource-adaptor-type-ref>

<activity-context-interface-factory-name>
...
</activity-context-interface-factory-name>


<resource-adaptor-entity-binding>
<resource-adaptor-object-name>
slee/resources/smpp/5.0/smppSession
</resource-adaptor-object-name>
<resource-adaptor-entity-link>
...
</resource-adaptor-entity-link>
</resource-adaptor-entity-binding>

</resource-adaptor-type-binding>
--------------------------------------------------------------------------------

Note this is just an example of a _part_ of the descriptor, not
intended as a working sample. You need to insert the omitted values,
the important part is the smppSession binding into the SBB's component
environment.


--
Vilius Panevėžys
Elitnet
> *Following is the SbbContext code:*
>
> public void setSbbContext(SbbContext context) {
> this.sbbContext = (SbbContextExt) context;
> tracer = context.getTracer(this.getClass().getSimpleName());
> this.timerFacility = this.sbbContext.getTimerFacility();
> tracer.info("Trying to set up context ....");
>
> try {
> tracer.info("Called setSbbContext PtinAudioConf!!!");
> Context myEnv = (Context) new
> InitialContext().lookup("java:comp/env");
> smppSession = (SmppSession) myEnv.lookup("slee/resources/smpp/5.0/*
> smppSession*");

Qasim Mansoor

unread,
Jun 5, 2012, 7:27:20 AM6/5/12
to mobicent...@googlegroups.com
 
Dear Vilius ,
 
Thanks a lot, I have modified the code and getting the following error: Can you help me in fixing this issue.
 
16:21:00,646 INFO  [ServiceManagementImpl] Activated ServiceID[name=SMPP,vendor=org.mobicents,version=1.0]
16:21:00,650 INFO  [SMPPSbbImpl] Trying to set up context ....
16:21:00,660 ERROR [SbbEntityImpl] Failed to assign and create sbb object
java.lang.ClassCastException: net.java.slee.resources.smpp.SmppTransactionACIFactoryImpl cannot be cast to org.mobicents.slee.smpp.test.SMPPSbb$SmppTransactionACIFactory
 at org.mobicents.slee.smpp.test.SMPPSbb.setSbbContext(SMPPSbb.java:165)
 at org.mobicents.slee.runtime.sbb.SbbObjectImpl.<init>(SbbObjectImpl.java:137)
 at org.mobicents.slee.runtime.sbb.SbbObjectPoolFactory.makeObject(SbbObjectPoolFactory.java:146)
 at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:974)
 at org.mobicents.slee.runtime.sbb.SbbObjectPoolImpl.borrowObject(SbbObjectPoolImpl.java:68)
 at org.mobicents.slee.runtime.sbbentity.SbbEntityImpl.assignSbbObject(SbbEntityImpl.java:732)
 at org.mobicents.slee.runtime.eventrouter.routingtask.EventRoutingTaskImpl.routeQueuedEvent(EventRoutingTaskImpl.java:360)
 at org.mobicents.slee.runtime.eventrouter.routingtask.EventRoutingTaskImpl.run(EventRoutingTaskImpl.java:126)
 at org.mobicents.slee.runtime.eventrouter.EventRouterExecutorImpl$EventRoutingTaskStatsCollector.run(EventRouterExecutorImpl.java:73)
 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
 at java.lang.Thread.run(Thread.java:662)
 
Adaptor Binding:
 
<resource-adaptor-type-binding>
            <resource-adaptor-type-ref>
                <resource-adaptor-type-name>SMPPResourceAdaptorType</resource-adaptor-type-name>
                <resource-adaptor-type-vendor>net.java</resource-adaptor-type-vendor>
                <resource-adaptor-type-version>5.0</resource-adaptor-type-version>
            </resource-adaptor-type-ref>
            <activity-context-interface-factory-name>slee/resources/smpp/5.0/factoryprovider</activity-context-interface-factory-name>
            <resource-adaptor-entity-binding>
                <resource-adaptor-object-name>slee/resources/smpp/5.0/smppSession</resource-adaptor-object-name>
                <resource-adaptor-entity-link>SmppRA</resource-adaptor-entity-link>
            </resource-adaptor-entity-binding>
        </resource-adaptor-type-binding>
 
Setting up context:
 
try {
 tracer.info("Trying to set up context ....");
 
  
 Context myEnv = (Context) new InitialContext().lookup("java:comp/env");
 
 smppSession = (SmppSession) myEnv.lookup("slee/resources/smpp/5.0/smppSession");

Vilius Panevėžys

unread,
Jun 5, 2012, 8:24:19 AM6/5/12
to mobicent...@googlegroups.com
First question what is SmppTransactionACIFactory? If it's something
that you've defined and not the interface described in the user guide
(http://docs.jboss.org/mobicents/jain-slee/2.6.0.FINAL/resources/smpp5/user-guide/en-US/html/ratype.html#ratype_aci_factory),
the cast should fail. :)

Otherwise, please attach the SBB implementation along with the
descriptor.


--
Vilius Panevėžys
Elitnet
> *Adaptor Binding:*
>
> <resource-adaptor-type-binding>
> <resource-adaptor-type-ref>
>
> <resource-adaptor-type-name>SMPPResourceAdaptorType</resource-adaptor-type-name>
>
> <resource-adaptor-type-vendor>net.java</resource-adaptor-type-vendor>
>
> <resource-adaptor-type-version>5.0</resource-adaptor-type-version>
> </resource-adaptor-type-ref>
>
> <activity-context-interface-factory-name>slee/resources/smpp/5.0/factoryprovider</activity-context-interface-factory-name>
> <resource-adaptor-entity-binding>
>
> <resource-adaptor-object-name>slee/resources/smpp/5.0/smppSession</resource-adaptor-object-name>
>
> <resource-adaptor-entity-link>SmppRA</resource-adaptor-entity-link>
> </resource-adaptor-entity-binding>
> </resource-adaptor-type-binding>
>
> *Setting up context:*

Qasim Mansoor

unread,
Jun 5, 2012, 8:59:23 AM6/5/12
to mobicent...@googlegroups.com
Dear Vilius,
Please find below code & descriptor, there is one timer event that prints a text in logger & there is one deliver SM event.
Code:
package org.mobicents.slee.smpp.test;
import java.io.IOException;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.slee.*;
import javax.slee.facilities.Tracer;
import net.java.slee.resources.smpp.*;
import net.java.slee.resources.smpp.SmppSession;
import net.java.slee.resources.smpp.SmppTransaction;
import net.java.slee.resources.smpp.SmppTransactionACIFactory;
import net.java.slee.resources.smpp.pdu.SubmitSM;
import org.mobicents.slee.*;
import net.java.slee.resources.smpp.pdu.Address;
import net.java.slee.resources.smpp.pdu.SmppRequest;
import net.java.slee.resources.smpp.pdu.SmppResponse;
import javax.slee.facilities.TimerEvent;
import javax.slee.facilities.TimerFacility;
import javax.slee.facilities.TimerOptions;
import javax.slee.facilities.TimerPreserveMissed;
import javax.slee.SbbContext;

public abstract class SMPPSbb implements Sbb, SMPP {
private Tracer tracer;
private TimerFacility timerFacility;
private static TimerOptions timerOptions;

SmppTransactionACIFactory smppAcif;
SmppSession smppSession;
SubmitSM submitSm;
private SbbContextExt sbbContext; // This SBB's SbbContext

public void onServiceStartedEvent(javax.slee.serviceactivity.ServiceStartedEvent event, ActivityContextInterface aci) {

tracer.info("Service Started ...");
setTimer(aci);
}


private TimerOptions getTimerOptions(){
if (timerOptions == null){
timerOptions = new TimerOptions();
timerOptions.setPreserveMissed(TimerPreserveMissed.ALL);
}
return timerOptions;
}


private void setTimer(ActivityContextInterface aci){
timerFacility.setTimer(aci, null, System.currentTimeMillis() + 30000L, getTimerOptions());
}

public interface SmppTransactionACIFactory {
javax.slee.ActivityContextInterface getActivityContextInterface(SmppTransaction txn);
}


public void onTimerEvent(javax.slee.facilities.TimerEvent event, ActivityContextInterface aci) {

tracer.info("this is timer event");

this.setTimer(aci);


public void setSbbContext(SbbContext context) {

this.sbbContext = (SbbContextExt) context;
tracer = context.getTracer(this.getClass().getSimpleName());
this.timerFacility = this.sbbContext.getTimerFacility();
try {
tracer.info("Trying to set up context ....");
Context myEnv = (Context) new InitialContext().lookup("java:comp/env");

smppSession = (SmppSession) myEnv.lookup("slee/resources/smpp/5.0/smppSession");
smppAcif = (SmppTransactionACIFactory) myEnv.lookup("slee/resources/smpp/5.0/factoryprovider");


} catch (NamingException ne) {
tracer.info("Could not set SBB context:" + ne.getMessage());
}
}
public void unsetSbbContext() { this.sbbContext = null; }
// TODO: Implement the life cycle methods if required
public void sbbCreate() throws javax.slee.CreateException {}
public void sbbPostCreate() throws javax.slee.CreateException {}
public void sbbActivate() {}
public void sbbPassivate() {}
public void sbbRemove() {}
public void sbbLoad() {}
public void sbbStore() {}
public void sbbExceptionThrown(Exception exception, Object event, ActivityContextInterface activity) {}
public void sbbRolledBack(RolledBackContext context) {}

/**
* Convenience method to retrieve the SbbContext object stored in setSbbContext.
*
* TODO: If your SBB doesn't require the SbbContext object you may remove this
* method, the sbbContext variable and the variable assignment in setSbbContext().
*
* @return this SBB's SbbContext object
*/

protected SbbContextExt getSbbContext() {
return sbbContext;
}

public void onDELIVER_SM(net.java.slee.resources.smpp.pdu.DeliverSM event, ActivityContextInterface aci) {

tracer.info("Received Message...");

}

}
Descriptor:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE sbb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD JAIN SLEE SBB 1.1//EN"
"http://java.sun.com/dtd/slee-sbb-jar_1_1.dtd">
<sbb-jar>
<sbb>
<description/>
<sbb-name>SMPP</sbb-name>
<sbb-vendor>org.mobicents</sbb-vendor>
<sbb-version>1.0</sbb-version>
<sbb-classes>
<sbb-abstract-class>
<sbb-abstract-class-name>org.mobicents.slee.smpp.test.SMPPSbb</sbb-abstract-class-name>
</sbb-abstract-class>
</sbb-classes>
<event event-direction="Receive" initial-event="True">
<event-name>ServiceStartedEvent</event-name>
<event-type-ref>
<event-type-name>javax.slee.serviceactivity.ServiceStartedEvent</event-type-name>
<event-type-vendor>javax.slee</event-type-vendor>
<event-type-version>1.0</event-type-version>
</event-type-ref>
<initial-event-select variable="ActivityContext"/>
</event>
<event event-direction="Receive" initial-event="False">
<event-name>TimerEvent</event-name>
<event-type-ref>
<event-type-name>javax.slee.facilities.TimerEvent</event-type-name>
<event-type-vendor>javax.slee</event-type-vendor>
<event-type-version>1.0</event-type-version>
</event-type-ref>
</event>
<event event-direction="Receive" initial-event="False">
<event-name>DELIVER_SM</event-name>
<event-type-ref>
<event-type-name>net.java.slee.resources.smpp.DELIVER_SM</event-type-name>
<event-type-vendor>net.java</event-type-vendor>
<event-type-version>5.0</event-type-version>
</event-type-ref>
</event>

<resource-adaptor-type-binding>
<resource-adaptor-type-ref>
<resource-adaptor-type-name>SMPPResourceAdaptorType</resource-adaptor-type-name>
<resource-adaptor-type-vendor>net.java</resource-adaptor-type-vendor>
<resource-adaptor-type-version>5.0</resource-adaptor-type-version>
</resource-adaptor-type-ref>
<activity-context-interface-factory-name>slee/resources/smpp/5.0/factoryprovider</activity-context-interface-factory-name>
<resource-adaptor-entity-binding>
<resource-adaptor-object-name>slee/resources/smpp/5.0/smppSession</resource-adaptor-object-name>
<resource-adaptor-entity-link>SmppRA</resource-adaptor-entity-link>
</resource-adaptor-entity-binding>
</resource-adaptor-type-binding>
</sbb>
</sbb-jar>
Error:
17:50:36,223 INFO [SleeManagementMBean] >< >< >< >< >< >< >< Mobicents JAIN SLEE 2.6.0.FINAL "GANDHI" starting >< >< >< >< >< >< ><
17:50:36,260 INFO [SleeManagementMBean] >< >< >< >< >< >< >< Mobicents JAIN SLEE 2.6.0.FINAL "GANDHI" started >< >< >< >< >< >< ><
17:50:36,273 INFO [SmppResourceAdaptor] setFaultTolerantResourceAdaptorContext(FaultTolerantResourceAdaptorContext arg0)
17:50:36,273 INFO [SmppResourceAdaptor] Activation RA SmppRA
17:50:36,412 INFO [TcpLink] Opening TCP socket to /10.98.136.13:5016
17:50:36,625 INFO [Session-1] SMSC did not supply SC_INTERFACE_VERSION. Disabling optional parameter support.
17:50:36,626 INFO [SmppResourceAdaptor] Successfully bound to SMSC.
17:50:36,738 INFO [SMPPSbbImpl] Trying to set up context ....
17:50:36,747 ERROR [SbbEntityImpl] Failed to assign and create sbb object

java.lang.ClassCastException: net.java.slee.resources.smpp.SmppTransactionACIFactoryImpl cannot be cast to org.mobicents.slee.smpp.test.SMPPSbb$SmppTransactionACIFactory
at org.mobicents.slee.smpp.test.SMPPSbb.setSbbContext(SMPPSbb.java:165)
at org.mobicents.slee.runtime.sbb.SbbObjectImpl.<init>(SbbObjectImpl.java:137)
at org.mobicents.slee.runtime.sbb.SbbObjectPoolFactory.makeObject(SbbObjectPoolFactory.java:146)
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:974)
at org.mobicents.slee.runtime.sbb.SbbObjectPoolImpl.borrowObject(SbbObjectPoolImpl.java:68)
at org.mobicents.slee.runtime.sbbentity.SbbEntityImpl.assignSbbObject(SbbEntityImpl.java:732)
at org.mobicents.slee.runtime.eventrouter.routingtask.EventRoutingTaskImpl.routeQueuedEvent(EventRoutingTaskImpl.java:360)
at org.mobicents.slee.runtime.eventrouter.routingtask.EventRoutingTaskImpl.run(EventRoutingTaskImpl.java:126)
at org.mobicents.slee.runtime.eventrouter.EventRouterExecutorImpl$EventRoutingTaskStatsCollector.run(EventRouterExecutorImpl.java:73)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
17:50:36,763 ERROR [EventRoutingTaskImpl] Caught exception while routing EventContext[event type id = EventTypeID[name=javax.slee.serviceactivity.ServiceStartedEvent,vendor=javax.slee,version=1.0] , event = org.mobicents.slee.container.service.ServiceStartedEventImpl@1ab5ffa , local ac = ACH=SERVICE>ServiceID[name=SMPP,vendor=org.mobicents,version=1.0] , address = null , serviceID = null]

java.lang.ClassCastException: net.java.slee.resources.smpp.SmppTransactionACIFactoryImpl cannot be cast to org.mobicents.slee.smpp.test.SMPPSbb$SmppTransactionACIFactory
at org.mobicents.slee.smpp.test.SMPPSbb.setSbbContext(SMPPSbb.java:165)
at org.mobicents.slee.runtime.sbb.SbbObjectImpl.<init>(SbbObjectImpl.java:137)
at org.mobicents.slee.runtime.sbb.SbbObjectPoolFactory.makeObject(SbbObjectPoolFactory.java:146)
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:974)
at org.mobicents.slee.runtime.sbb.SbbObjectPoolImpl.borrowObject(SbbObjectPoolImpl.java:68)
at org.mobicents.slee.runtime.sbbentity.SbbEntityImpl.assignSbbObject(SbbEntityImpl.java:732)
at org.mobicents.slee.runtime.eventrouter.routingtask.EventRoutingTaskImpl.routeQueuedEvent(EventRoutingTaskImpl.java:360)
at org.mobicents.slee.runtime.eventrouter.routingtask.EventRoutingTaskImpl.run(EventRoutingTaskImpl.java:126)
at org.mobicents.slee.runtime.eventrouter.EventRouterExecutorImpl$EventRoutingTaskStatsCollector.run(EventRouterExecutorImpl.java:73)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Br,
./Qasim

Vilius Panevėžys

unread,
Jun 5, 2012, 9:10:49 AM6/5/12
to mobicent...@googlegroups.com
Why have you defined public interface SmppTransactionACIFactory in your
SBB? You should use the interface provided by the SMPP RA type.


--
Vilius Panevėžys
Elitnet


On Tue, 5 Jun 2012 05:59:23 -0700 (PDT)
Qasim Mansoor <qasimmans...@gmail.com> wrote:

> Dear Vilius,
> Please find below code & descriptor, there is one timer event that
> prints a text in logger & there is one deliver SM event.
> *Code:*
> *Descriptor:*
> **
> **
> <?xml version="1.0" encoding="utf-8"?>
> <!DOCTYPE sbb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD JAIN SLEE
> SBB 1.1//EN"
> "*http://java.sun.com/dtd/slee-sbb-jar_1_1.dtd*<http://java.sun.com/dtd/slee-sbb-jar_1_1.dtd>
> *Error:*
> **
> event = *
> org.mobicents.slee.container.service.ServiceStartedEventImpl@1ab5ffa*<org.mobicents.slee.container.service.ServiceStartedEventImpl@1ab5ffa>,
> > *Following is the SbbContext code:*
> >
> > public void setSbbContext(SbbContext context) {
> > this.sbbContext = (SbbContextExt) context;
> > tracer = context.getTracer(this.getClass().getSimpleName());
> > this.timerFacility = this.sbbContext.getTimerFacility();
> > tracer.info("Trying to set up context ....");
> >
> > try {
> > tracer.info("Called setSbbContext PtinAudioConf!!!");
> > Context myEnv = (Context) new
> > InitialContext().lookup("java:comp/env");
> > smppSession = (SmppSession) myEnv.lookup("slee/resources/smpp/5.0/*
> > smppSession*");

Qasim Mansoor

unread,
Jun 5, 2012, 12:10:48 PM6/5/12
to mobicent...@googlegroups.com
Hi,
 
Issue Resolved, Thanks a lot for your help :-)
 
Br,
./Qasim
 

On Monday, 4 June 2012 17:09:21 UTC+5, Qasim Mansoor wrote:
On Monday, 4 June 2012 17:09:21 UTC+5, Qasim Mansoor wrote:
On Monday, 4 June 2012 17:09:21 UTC+5, Qasim Mansoor wrote:
Reply all
Reply to author
Forward
0 new messages