2013-09-30 95 views
2

我想通過SIP-servlet初始化一些類。爲此,我爲我的mss-2.0.0.FINAL-jboss-as-7.1.2服務器使用sip.xml。Servlet在啓動時未加載

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) [email protected]9f89 Using the following Application Router instance: [email protected]30 
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的是初始上啓動爲空。

有人想法嗎?

+0

看http://stackoverflow.com/questions/809775/what-does-the-servlet-load-on-startup-value- 0-zero-signify – Kennet

+0

謝謝,但這並沒有多大幫助。如果我使用0或正整數,它並不重要。該servlet在啓動時沒有初始化。 – Grimbo

+0

請在SIP或HTTP調用時分享應用程序和DEBUG日誌的代碼,因爲很難確定您所設置的信息出了什麼問題 – jeand

回答

0

我發現這個問題

init方法logging語句應顯示在日誌上啓動。這是一個maven/pom.xml失敗!我忘了把我的Maven插件,配置如下條目:<warSourceDirectory>WebContent</warSourceDirectory>

<plugin> 
    <artifactId>maven-war-plugin</artifactId> 
    <version>2.2</version> 
    <configuration> 
     <warSourceDirectory>WebContent</warSourceDirectory> 
     <failOnMissingWebXml>false</failOnMissingWebXml> 
    </configuration> 
</plugin> 
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(); 
    } 
... 
} 

如果我嘗試邀請與會者到一個會議上,我得到了一個N​​ullPointerException異常導致我的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 

這種情況會導致我的SipFactory爲空時Call.java嘗試從servlet的情況下得到它。

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

0

你說的問題是,SipFactory爲空。 但是您發佈的代碼從不初始化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); 
    ... 
} 
} 
+0

該servlet和設置工廠後面的一些「魔術」。我的問題是,init()mehtod永遠不會被觸發。我無法通過調試和斷點訪問它,甚至SYSO或日誌永遠不會出現在某處。這個問題旨在找出爲什麼我的servlet沒有在部署時被觸發! – Grimbo

0

你能爲org.mobicents類別提供的調試日誌呢?看起來你的init方法甚至沒有被調用。

我看到SIP Servlet是在sip.xml中定義的,並且作爲一個註釋,註釋可能優先考慮您是否嘗試向@ javax.servlet.sip.annotation.SipServlet註釋添加loadOnStartup = 1?當應用程序部署

+0

是的init方法從來沒有被調用,我不明白爲什麼。我不確定你想要什麼「爲org.mobicents類別提供DEBUG日誌」。我也嘗試了loadOnStartup = 0,結果相同。我怎樣才能將loadOnStartup添加到註釋中? – Grimbo

+0

@ javax.servlet.sip.annotation.SipServlet(loadOnStartup = 1) – jeand

+0

我只用了sip.xml註解(loadOnStartup)。還有sip.xml不帶註釋和兩者。沒有工作! servlet的init()仍未在部署時調用。 – Grimbo