我试图通过SIP-servlet初始化一些类。为此,我使用sip.xml为我的mss-2.0.0.FINAL-jboss-as-7.1.2服务器。
Sip.xml:
<?xml version="1.0" encoding="UTF-8"?>
<sip-app xmlns="http://www.jcp.org/xml/ns/sipservlet" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jcp.org/xml/ns/sipservlet" xmlns:javaee="http://java.sun.com/xml/ns/javaee"
xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.1">
<app-name>service.ngsi.multimediaconference</app-name>
<servlet-selection>
<servlet-mapping>
<servlet-name>multimedia-conference</servlet-name>
<pattern>
<equal>
<var>request.method</var>
<value>INVITE</value>
</equal>
</pattern>
</servlet-mapping>
</servlet-selection>
<servlet>
<servlet-name>multimedia-conference</servlet-name>
<servlet-class>com.abc.multimediaconference.ServletSipMultimediaConference</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<session-config>
<session-timeout>120</session-timeout>
</session-config>
</sip-app>
我的日志:
16:11:03,896 INFO [org.jboss.modules] JBoss Modules version 1.1.2.GA
16:11:04,903 INFO [org.jboss.msc] JBoss MSC version 1.0.2.GA
16:11:04,989 INFO [org.jboss.as] JBAS015899: JBoss AS 7.1.2.Final "Steropes" starting
16:11:09,072 INFO [org.jboss.as.server.deployment.scanner] JBAS01 5003: Found Conference.war in deployment directory. To trigger deployment create a file called Conference.war.dodeploy
16:11:09,073 INFO [org.jboss.as.server.deployment.scanner] JBAS015003: Found my-sipapp.war in deployment directory. To trigger deployment create a file called my-sipapp.war.dodeploy
16:11:09,134 INFO [org.jboss.as.server] JBAS015888: Creating http management service using socket-binding (management-http)
16:11:09,157 INFO [org.xnio] XNIO Version 3.0.3.GA
16:11:09,198 INFO [org.xnio.nio] XNIO NIO Implementation Version 3.0.3.GA
16:11:09,207 INFO [org.jboss.remoting] JBoss Remoting version 3.2.7.GA
16:11:09,263 INFO [org.jboss.as.logging] JBAS011502: Removing bootstrap log handlers
16:11:09,270 INFO [org.jboss.as.configadmin] (ServerService Thread Pool -- 27) JBAS016200: Activating ConfigAdmin Subsystem
16:11:09,283 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 39) JBAS011800: Activating Naming Subsystem
16:11:09,294 INFO [org.jboss.as.osgi] (ServerService Thread Pool -- 40) JBAS011906: Activating OSGi Subsystem
16:11:09,305 INFO [org.jboss.as.security] (ServerService Thread Pool -- 45) JBAS013101: Activating Security Subsystem
16:11:09,361 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 32) JBAS010280: Activating Infinispan subsystem.
16:11:09,388 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 50) JBAS015537: Activating WebServices Extension
16:11:09,472 INFO [org.jboss.as.connector.logging] (MSC service thread 1-4) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.11.Final)
16:11:09,615 INFO [org.jboss.as.security] (MSC service thread 1-5) JBAS013100: Current PicketBox version=4.0.9.Final
16:11:10,532 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 28) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3) 16:11:10,567 INFO [org.jboss.as.naming] (MSC service thread 1-2) JBAS011802: Starting Naming Service
16:11:10,571 INFO [org.jboss.as.mail.extension] (MSC service thread 1-4) JBAS015400: Bound mail session [java:jboss/mail/Default]
16:11:11,137 INFO [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-5) Starting Coyote HTTP/1.1 on `http-localhost/127.0.0.1:8080`
16:11:11,217 INFO [org.mobicents.servlet.sip.catalina.SipStandardService] (MSC service thread 1-7) Pretty encoding of headers enabled ? true
16:11:11,218 INFO [org.mobicents.servlet.sip.catalina.SipStandardService] (MSC service thread 1-7) Sip Stack path name : gov.nist
16:11:11,397 INFO [org.mobicents.servlet.sip.catalina.SipStandardService] (MSC service thread 1-7) Mobicents Sip Servlets sip stack properties :
{gov.nist.javax.sip.DEBUG_LOG=/opt/mss-2.0.0.FINAL-jboss-as-7.1.2.Final/standalone/tmp/logs/mss-jsip-debuglog.txt,
gov.nist.javax.sip.PASS_INVITE_NON_2XX_ACK_TO_LISTENER=true,
gov.nist.javax.sip.MAX_LISTENER_RESPONSE_TIME=120,
gov.nist.javax.sip.LOG4J_LOGGER_NAME=gov.nist,
javax.sip.AUTOMATIC_DIALOG_SUPPORT=off,
gov.nist.javax.sip.SERVER_LOG=/opt/mss-2.0.0.FINAL-jboss-as-7.1.2.Final/standalone/tmp/logs/mss-jsip-messages.xml,
gov.nist.javax.sip.REENTRANT_LISTENER=true,
gov.nist.javax.sip.MAX_FORK_TIME_SECONDS=0,
org.mobicents.ha.javax.sip.REPLICATE_APPLICATION_DATA=false,
gov.nist.javax.sip.RECEIVE_UDP_BUFFER_SIZE=65536,
javax.sip.STACK_NAME=Mobicents-SIP-Servlets,
gov.nist.javax.sip.TCP_POST_PARSING_THREAD_POOL_SIZE=30,
gov.nist.javax.sip.LOOSE_DIALOG_VALIDATION=true,
org.mobicents.ha.javax.sip.REPLICATION_STRATEGY=ConfirmedDialog,
gov.nist.javax.sip.AGGRESSIVE_CLEANUP=true,
gov.nist.javax.sip.TRACE_LEVEL=LOG4J,
gov.nist.javax.sip.MAX_MESSAGE_SIZE=10000,
gov.nist.javax.sip.AUTOMATIC_DIALOG_ERROR_HANDLING=false,
gov.nist.javax.sip.SEND_UDP_BUFFER_SIZE=65536,
gov.nist.javax.sip.LOG_MESSAGE_CONTENT=true,
gov.nist.javax.sip.THREAD_POOL_SIZE=64,
gov.nist.javax.sip.DELIVER_UNSOLICITED_NOTIFY=true,
javax.sip.ROUTER_PATH=org.mobicents.ext.javax.sip.dns.DNSAwareRouter}
16:11:11,576 INFO [gov.nist.javax.sip.stack.SIPTransactionStack] (MSC service thread 1-7) value -1000 will be used for reliableConnectionKeepAliveTimeout stack property
16:11:11,576 INFO [gov.nist.javax.sip.stack.SIPTransactionStack] (MSC service thread 1-7) Setting Stack Thread priority to 10
16:11:11,579 WARN [gov.nist.javax.sip.SipStackImpl] (MSC service thread 1-7) using default tls security policy
16:11:11,641 INFO [gov.nist.javax.sip.stack.timers.DefaultSipTimer] (MSC service thread 1-7) the sip stack timer gov.nist.javax.sip.stack.timers.DefaultSipTimer has been started
16:11:11,642 INFO [org.mobicents.servlet.sip.catalina.SipStandardService] (MSC service thread 1-7) no AddressResolver will be used since none has been specified.
16:11:11,642 INFO [org.mobicents.servlet.sip.catalina.SipStandardService] (MSC service thread 1-7) SIP stack initialized
16:11:11,643 INFO [org.mobicents.servlet.sip.core.SipApplicationDispatcherImpl] (MSC service thread 1-7) SIP Base Timer Interval set to 500ms
16:11:11,643 INFO [org.mobicents.servlet.sip.core.SipApplicationDispatcherImpl] (MSC service thread 1-7) SIP Timer T2 Interval set to 4000ms
16:11:11,643 INFO [org.mobicents.servlet.sip.core.SipApplicationDispatcherImpl] (MSC service thread 1-7) SIP Timer T4 Interval set to 5000ms
16:11:11,643 INFO [org.mobicents.servlet.sip.core.SipApplicationDispatcherImpl] (MSC service thread 1-7) SIP Timer D Interval set to 32000ms
16:11:11,643 INFO [org.mobicents.servlet.sip.core.SipApplicationDispatcherImpl] (MSC service thread 1-7) Memory threshold set to 85%
16:11:11,644 INFO [org.mobicents.servlet.sip.core.SipApplicationDispatcherImpl] (MSC service thread 1-7) Back To Normal Memory threshold set to 75%
16:11:11,644 INFO [org.mobicents.servlet.sip.core.SipApplicationDispatcherImpl] (MSC service thread 1-7) Congestion Control policy set to ErrorResponse
16:11:11,644 INFO [org.mobicents.servlet.sip.core.SipApplicationDispatcherImpl] (MSC service thread 1-7) Queue Size set to 1500
16:11:11,644 INFO [org.mobicents.servlet.sip.core.SipApplicationDispatcherImpl] (MSC service thread 1-7) Back To Normal Queue Size set to 1300
16:11:11,644 INFO [org.mobicents.servlet.sip.core.SipApplicationDispatcherImpl] (MSC service thread 1-7) Gathering Statistics set to true
16:11:11,645 INFO [org.mobicents.servlet.sip.core.SipApplicationDispatcherImpl] (MSC service thread 1-7) Container wide Concurrency Control set to SipApplicationSession
16:11:11,645 INFO [org.mobicents.servlet.sip.core.SipApplicationDispatcherImpl] (MSC service thread 1-7) Bypass Request Executor enabled ?true
16:11:11,645 INFO [org.mobicents.servlet.sip.core.SipApplicationDispatcherImpl] (MSC service thread 1-7) Bypass Response Executor enabled ?true
16:11:11,645 INFO [org.mobicents.servlet.sip.core.SipApplicationDispatcherImpl] (MSC service thread 1-7) Using the Service Provider Framework to load the application router provider
16:11:11,652 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
16:11:11,654 INFO [org.mobicents.servlet.sip.core.SipApplicationDispatcherImpl] (MSC service thread 1-7) org.mobicents.servlet.sip.core.SipApplicationDispatcherImpl@4da19f89 Using the following Application Router instance: org.mobicents.servlet.sip.router.DefaultApplicationRouter@2df10330
16:11:11,697 INFO [org.mobicents.servlet.sip.core.SipApplicationDispatcherImpl] (MSC service thread 1-7) Sip Application dispatcher registered under following name jboss.sip:type=SipApplicationDispatcher
16:11:11,697 INFO [org.mobicents.servlet.sip.core.SipApplicationDispatcherImpl] (MSC service thread 1-7) bypassRequestExecutor ? true
16:11:11,698 INFO [org.mobicents.servlet.sip.core.SipApplicationDispatcherImpl] (MSC service thread 1-7) bypassResponseExecutor ? true
16:11:11,707 INFO [org.mobicents.servlet.sip.core.SipApplicationDispatcherImpl] (MSC service thread 1-7) AsynchronousThreadPoolExecutor size is 15
16:11:11,709 INFO [org.mobicents.servlet.sip.core.SipApplicationDispatcherImpl] (MSC service thread 1-7) No Congestion control background task started since the checking interval is equals to -1 milliseconds.
16:11:11,710 INFO [org.mobicents.servlet.sip.core.Version] (MSC service thread 1-7) Release ID: (Mobicents) Sip Servlets 2.0.0.FINAL (build: Git Hash=r031dc15b05f0bbe5d5e3a9af6a2fb0e2560d9426 date=201210011610)
16:11:11,711 INFO [org.mobicents.servlet.sip.core.Version] (MSC service thread 1-7) Mobicents Sip Servlets 2.0.0.FINAL (build: Git Hash=r031dc15b05f0bbe5d5e3a9af6a2fb0e2560d9426 date=201210011610) Started.
16:11:11,711 INFO [org.mobicents.servlet.sip.core.Version] (MSC service thread 1-7) Thank you for running Mobicents Community code. For Commercial Grade Support, please purchase a Telscale subscription from http://www.telestax.com
16:11:11,969 INFO [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-3) JBoss Web Services - Stack CXF Server 4.0.2.GA
16:11:12,162 INFO [org.mobicents.servlet.sip.catalina.SipProtocolHandler] (MSC service thread 1-4) Sip Connector started on ip address: localhost, port 5081, transport tls, useStun false, stunAddress null, stunPort : -1, useStaticAddress: false, staticServerAddress null, staticServerPort -1
16:11:12,162 INFO [org.mobicents.servlet.sip.catalina.SipProtocolHandler] (MSC service thread 1-6) Sip Connector started on ip address: localhost, port 5080, transport tcp, useStun false, stunAddress null, stunPort : -1, useStaticAddress: false, staticServerAddress null, staticServerPort -1
16:11:12,514 INFO [org.mobicents.servlet.sip.catalina.SipProtocolHandler] (MSC service thread 1-8) Sip Connector started on ip address: localhost, port 5080, transport udp, useStun false, stunAddress null, stunPort : -1, useStaticAddress: false, staticServerAddress null, staticServerPort -1
16:11:12,523 INFO [org.mobicents.servlet.sip.catalina.SipProtocolHandler] (MSC service thread 1-7) Sip Connector started on ip address: localhost, port 5082, transport ws, useStun false, stunAddress null, stunPort : -1, useStaticAddress: false, staticServerAddress null, staticServerPort -1
16:11:12,614 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-4) JBAS015012: Started FileSystemDeploymentService for directory /opt/mss-2.0.0.FINAL-jboss-as-7.1.2.Final/standalone/deployments
16:11:12,630 INFO [org.jboss.as.remoting] (MSC service thread 1-7) JBAS017100: Listening on `127.0.0.1:9999`
16:11:12,657 INFO [org.jboss.as.remoting] (MSC service thread 1-5) JBAS017100: Listening on `127.0.0.1:4447`
16:11:12,753 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015876: Starting deployment of "Conference.war"
16:11:14,165 WARN [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry xercesImpl.jar in /opt/mss-2.0.0.FINAL-jboss-as-7.1.2.Final/standalone/deployments/Conference.war/WEB-INF/lib/xalan-2.7.0.jar does not point to a valid jar for a Class-Path reference.
16:11:14,166 WARN [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry xml-apis.jar in /opt/mss-2.0.0.FINAL-jboss-as-7.1.2.Final/standalone/deployments/Conference.war/WEB-INF/lib/xalan-2.7.0.jar does not point to a valid jar for a Class-Path reference.
16:11:14,167 WARN [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry serializer.jar in /opt/mss-2.0.0.FINAL-jboss-as-7.1.2.Final/standalone/deployments/Conference.war/WEB-INF/lib/xalan-2.7.0.jar does not point to a valid jar for a Class-Path reference.
16:11:14,934 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-1) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
16:11:14,976 INFO [org.jboss.as.osgi] (MSC service thread 1-2) JBAS011907: Register module: Module "deployment.Conference.war:main" from Service Module Loader
16:11:15,113 INFO [org.jboss.web] (MSC service thread 1-7) JBAS018210: Registering web context: /Conference
16:11:15,128 INFO [org.jboss.as.server] (ServerService Thread Pool -- 29) JBAS018559: Deployed "Conference.war"
16:11:15,329 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on `http://127.0.0.1:9990`
16:11:15,330 INFO [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss AS 7.1.2.Final "Steropes" started in 12503ms - Started 182 of 270 services (87 services are passive or on-demand)
之后我的模块可以使用,并且REST通信也可以工作,但是启动时应该通过servlet初始化的所有变量/对象都是null。
有人有想法吗?
答案 0 :(得分:0)
SipServlet主要初始化一些对象。
ServletSipMultimediaConfrence.java:
@javax.servlet.sip.annotation.SipServlet
public class ServletSipMultimediaConference extends SipServlet {
...
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
ctx = config.getServletContext();
System.out.println("Init SIP Servlet!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
SipFactory sipFactory = (SipFactory) getServletContext().getAttribute(
SipServlet.SIP_FACTORY);
if (sipFactory == null) {
getServletContext().log("SIP Factory is null");
} else {
getServletContext().log("SIP Factory set.");
}
ContextManager.getInstance().setSipFactory(sipFactory);
getServletContext().log("SipServlet MultimediaConference initialized.");
configureThirdPartyCallModule();
}
...
}
如果我尝试邀请参与者参加会议,我会收到NullPointerException,因为我的SipFactory为空!
MultimediaConferenceImpl.java:
@POST
@Path("/inviteParticipant")
@Override
public void inviteParticipant(@QueryParam("sessionId") String sessionId,
@QueryParam("callSessionIdentifier") String callSessionIdentifier,
@QueryParam("participant") String participant) throws PolicyException,
ServiceException {
CallSessionConference conferenceSession = getConferenceSession(null,
callSessionIdentifier);
if (conferenceSession == null)
throw new ServiceException("No conference found using id: "
+ callSessionIdentifier);
conferenceSession.inviteParticipant(participant);
}
这会导致以下异常:
Servlet.service() for servlet de.fhg.fokus.ngni.broker.sip.multimediaconference.JaxRsActivator threw exception: org.jboss.resteasy.spi.UnhandledException: java.lang.NullPointerException
at org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:340) [resteasy-jaxrs-2.3.3.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:214) [resteasy-jaxrs-2.3.3.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:190) [resteasy-jaxrs-2.3.3.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:540) [resteasy-jaxrs-2.3.3.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:502) [resteasy-jaxrs-2.3.3.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119) [resteasy-jaxrs-2.3.3.Final.jar:]
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) [resteasy-jaxrs-2.3.3.Final.jar:]
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs-2.3.3.Final.jar:]
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.3.3.Final.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.1.Final.jar:1.0.1.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.16.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.16.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.16.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.16.Final.jar:]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.2.Final.jar:7.1.2.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.16.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.16.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.16.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.16.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.16.Final.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:679) [jbossweb-7.0.16.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931) [jbossweb-7.0.16.Final.jar:]
at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25]
Caused by: java.lang.NullPointerException
at de.fhg.fokus.ngni.broker.sip.thirdpartycall.Call.<init>(Call.java:100) [classes:]
at de.fhg.fokus.ngni.broker.sip.thirdpartycall.CallSessionThirdParty.createCallee(CallSessionThirdParty.java:141) [classes:]
at de.fhg.fokus.ngni.broker.sip.thirdpartycall.CallSessionThirdParty.<init>(CallSessionThirdParty.java:104) [classes:]
at de.fhg.fokus.ngni.broker.sip.multimediaconference.CallSessionConference.inviteParticipant(CallSessionConference.java:96) [classes:]
at de.fhg.fokus.ngni.broker.sip.multimediaconference.MultimediaConferenceImpl.inviteParticipant(MultimediaConferenceImpl.java:242) [classes:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_25]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_25]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_25]
at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_25]
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167) [resteasy-jaxrs-2.3.3.Final.jar:]
at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257) [resteasy-jaxrs-2.3.3.Final.jar:]
at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222) [resteasy-jaxrs-2.3.3.Final.jar:]
at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:211) [resteasy-jaxrs-2.3.3.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:525) [resteasy-jaxrs-2.3.3.Final.jar:]
... 19 more
当Call.java尝试从servlet-context获取它时,我的SipFactory为null。
static {
factory = ContextManager.getInstance().getSipFactory();
}
ContextManager是一个帮助类:
public class ContextManager {
private SipFactory factory;
// private BundleContext bundleContext;
private static ContextManager cm = new ContextManager();
public static ContextManager getInstance() {
return cm;
}
public SipFactory getSipFactory() {
return factory;
}
public void setSipFactory(SipFactory factory) {
this.factory = factory;
}
}
我在这里完整登录DEBUG级别:https://community.jboss.org/thread/232864
答案 1 :(得分:0)
你说问题是SipFactory为null。 但是您发布的代码从未初始化SipFactory。 查看ServletSipMultimediaConference.init()方法。 您只需检查SipFactory是否为空,但不进行初始化:
public class ServletSipMultimediaConference extends SipServlet {
...
@Override
public void init(ServletConfig config) throws ServletException {
...
SipFactory sipFactory = (SipFactory)getServletContext()
.getAttribute(SipServlet.SIP_FACTORY);
if (sipFactory == null) {
getServletContext().log("SIP Factory is null");
// --> Maybe set up a new SIP Factory here?! <--
} else {
getServletContext().log("SIP Factory set.");
}
ContextManager.getInstance().setSipFactory(sipFactory);
...
}
}
答案 2 :(得分:0)
您是否也可以为org.mobicents类别提供DEBUG日志?看起来你的init方法甚至都没有被调用。
我看到SIP Servlet既在sip.xml中定义,也作为注释定义,在您尝试将loadOnStartup = 1添加到@javax.servlet.sip.annotation.SipServlet注释时,注释可能优先于此?
在部署应用程序时,应在启动日志中显示init方法日志记录语句
答案 3 :(得分:0)
我发现了问题。这是一个maven / pom.xml失败!我忘记在输入后输入我的maven plugin-config:<warSourceDirectory>WebContent</warSourceDirectory>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>