Tomcat无法部署JAX-WS Web服务实现

时间:2010-07-16 12:32:04

标签: java web-services tomcat jax-ws

我用jdk1.6.0_06和jre6运行Tocmat 6.0.26。我的网络服务仅使用odbc14.jar,这是我在其中包含的唯一库。它构建没有任何错误,但当我尝试部署它时,我得到以下错误:

Jul 16, 2010 7:55:45 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class com.sun.xml.ws.transport.http.servlet.WSServletContextListener
com.sun.xml.ws.transport.http.servlet.WSServletException: WSSERVLET11: failed to parse runtime descriptor: java.lang.NullPointerException
 at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:118)
 at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
 at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
 at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
 at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)
 at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)
 at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
 at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
 at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
 at org.apache.catalina.core.StandardService.start(StandardService.java:519)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.NullPointerException
 at vms.gift.giftingService.(giftingService.java:55)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
 at java.lang.reflect.Constructor.newInstance(Unknown Source)
 at java.lang.Class.newInstance0(Unknown Source)
 at java.lang.Class.newInstance(Unknown Source)
 at com.sun.xml.ws.api.server.InstanceResolver.createNewInstance(InstanceResolver.java:215)
 at com.sun.xml.ws.api.server.InstanceResolver.createDefault(InstanceResolver.java:180)
 at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:124)
 at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:467)
 at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parseAdapters(DeploymentDescriptorParser.java:253)
 at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse(DeploymentDescriptorParser.java:147)
 at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:108)
 ... 24 more
Jul 16, 2010 7:55:47 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class com.sun.xml.ws.transport.http.servlet.WSServletContextListener
com.sun.xml.ws.transport.http.servlet.WSServletException: WSSERVLET11: failed to parse runtime descriptor: java.lang.NullPointerException
 at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:139)
 at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
 at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
 at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
 at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)
 at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)
 at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
 at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
 at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
 at org.apache.catalina.core.StandardService.start(StandardService.java:519)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.NullPointerException
 at vas.vms.wapportal.GiftingService.(GiftingService.java:55)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
 at java.lang.reflect.Constructor.newInstance(Unknown Source)
 at java.lang.Class.newInstance0(Unknown Source)
 at java.lang.Class.newInstance(Unknown Source)
 at com.sun.xml.ws.api.server.InstanceResolver.createNewInstance(InstanceResolver.java:215)
 at com.sun.xml.ws.api.server.InstanceResolver.createDefault(InstanceResolver.java:180)
 at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:123)
 at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:505)
 at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parseAdapters(DeploymentDescriptorParser.java:253)
 at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse(DeploymentDescriptorParser.java:147)
 at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:124)
 ... 24 more
Jul 16, 2010 7:55:49 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class com.sun.xml.ws.transport.http.servlet.WSServletContextListener
com.sun.xml.ws.transport.http.servlet.WSServletException: WSSERVLET11: failed to parse runtime descriptor: javax.xml.ws.WebServiceException: Unable to create JAXBContext
 at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:139)
 at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
 at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
 at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
 at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)
 at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)
 at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
 at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
 at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
 at org.apache.catalina.core.StandardService.start(StandardService.java:519)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: javax.xml.ws.WebServiceException: Unable to create JAXBContext
 at com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:166)
 at com.sun.xml.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:94)
 at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:258)
 at com.sun.xml.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:338)
 at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:201)
 at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:505)
 at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parseAdapters(DeploymentDescriptorParser.java:253)
 at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse(DeploymentDescriptorParser.java:147)
 at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:124)
 ... 24 more
Caused by: java.security.PrivilegedActionException: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 3 counts of IllegalAnnotationExceptions
java.sql.Connection is an interface, and JAXB can't handle interfaces.
 this problem is related to the following location:
  at java.sql.Connection
  at public java.sql.Connection vas.vms.wapportal.jaxws.LogHistory.arg0
  at vas.vms.wapportal.jaxws.LogHistory
java.sql.Connection does not have a no-arg default constructor.
 this problem is related to the following location:
  at java.sql.Connection
  at public java.sql.Connection vas.vms.wapportal.jaxws.LogHistory.arg0
  at vas.vms.wapportal.jaxws.LogHistory
java.lang.StackTraceElement does not have a no-arg default constructor.
 this problem is related to the following location:
  at java.lang.StackTraceElement
  at public java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace()
  at java.lang.Throwable
  at java.lang.Exception
  at java.sql.SQLException
  at public java.sql.SQLException vas.vms.wapportal.jaxws.SQLExceptionBean.nextException
  at vas.vms.wapportal.jaxws.SQLExceptionBean

 at java.security.AccessController.doPrivileged(Native Method)
 at com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:153)
 ... 32 more
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 3 counts of IllegalAnnotationExceptions
java.sql.Connection is an interface, and JAXB can't handle interfaces.
 this problem is related to the following location:
  at java.sql.Connection
  at public java.sql.Connection vas.vms.wapportal.jaxws.LogHistory.arg0
  at vas.vms.wapportal.jaxws.LogHistory
java.sql.Connection does not have a no-arg default constructor.
 this problem is related to the following location:
  at java.sql.Connection
  at public java.sql.Connection vas.vms.wapportal.jaxws.LogHistory.arg0
  at vas.vms.wapportal.jaxws.LogHistory
java.lang.StackTraceElement does not have a no-arg default constructor.
 this problem is related to the following location:
  at java.lang.StackTraceElement
  at public java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace()
  at java.lang.Throwable
  at java.lang.Exception
  at java.sql.SQLException
  at public java.sql.SQLException vas.vms.wapportal.jaxws.SQLExceptionBean.nextException
  at vas.vms.wapportal.jaxws.SQLExceptionBean

 at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:102)
 at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:472)
 at com.sun.xml.bind.v2.runtime.JAXBContextImpl.(JAXBContextImpl.java:302)
 at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1140)
 at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:154)
 at com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:106)
 at com.sun.xml.ws.developer.JAXBContextFactory$1.createJAXBContext(JAXBContextFactory.java:109)
 at com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:161)
 at com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:154)
 ... 34 more

有人可以请帮帮我是什么原因?据我所知,它与版本有关。请求帮助! :S

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package vms.wap;

import java.io.*;
import java.net.*;
import java.sql.*;
import java.util.*;
import javax.jws.*;
import oracle.jdbc.pool.OracleDataSource;

/**
 *
 * @author muhammad.awais
 */
@WebService()
public class giftingService {
/**
 * Web service operation
 */
  private String parameterFile;


//return codes

private String VMSUserName;
private String VMSPassword;
private String VMSjdbcUrl;
private String sendSMSUrl;
private String xmsFrom;
private int sessionLA;
private String partyAmessage;
private String partyBmessage;
private String MTLA;
private String tID;
private String mode;

/**
 *
 */
public giftingService(){
     parameterFile=giftingService.class.getClassLoader()
     .getResource("parameters.conf").getPath()
    .replaceAll("%20", " ");

     LoadParameters();
}

/**
 *
 * @param username
 * @param password
 * @param partyA
 * @param partyB
 * @param serviceID
 * @param serviceName
 * @param channel
 * @return
 * @throws SQLException
 */
@WebMethod(operationName = "giftRequest")
public String giftRequest(@WebParam(name = "username")
String username, @WebParam(name = "password")
String password, @WebParam(name = "partyA")
String partyA, @WebParam(name = "partyB")
String partyB, @WebParam(name = "serviceID")
String serviceID, @WebParam(name = "serviceName")
String serviceName, @WebParam(name = "channel")
String channel) throws SQLException {
    //TODO write your implementation code here:

    String UserAuthResp ="";
    String response="0";
    String lookupResp="";
    String createSessResp="";
    //String lookupArr[];
    int correlationid=0;
    String sendSMSResp = "";


    int LA=0;
    Connection vmsConn = createVMSConnection(VMSUserName, VMSPassword, VMSjdbcUrl);

    UserAuthResp = verifyCredentials (vmsConn,username,password,channel);
    if(UserAuthResp.equals("1"))
    {
        lookupResp=lookUpSession (vmsConn, partyB, serviceID);
        if(!lookupResp.equals("-8"))
        {
            LA=getNewSessionLA(LA, sessionLA);
            correlationid = getCorrelationID (vmsConn);
            createSessResp=createSession(vmsConn, partyA, partyB, correlationid, serviceID,String.valueOf(LA));
            if(createSessResp.equals("1"))
            {
                sendSMSResp=sendSMS(partyB, partyBmessage, correlationid, serviceID, MTLA, createSessResp);
                if(sendSMSResp.equals("1"))
                    response="1";
            }
        }
    }
    logHistory (vmsConn, partyA, partyB, partyBmessage, correlationid, serviceID, LA, UserAuthResp, lookupResp, createSessResp, sendSMSResp,response);
    vmsConn.close();
    return response;
}


/**
 *
 * @param VMSUsername
 * @param VMSPassword
 * @param VMSUrl
 * @return
 * @throws SQLException
 */
public Connection createVMSConnection(String VMSUsername, String VMSPassword, String VMSUrl) throws SQLException
{
    Connection vmsConn = null;
    OracleDataSource vmsDS = new OracleDataSource();
    //vmsConn=null;
    try
    {
        vmsDS.setURL(VMSUrl);
        vmsConn = vmsDS.getConnection(VMSUsername, VMSPassword);
    }
    catch (SQLException ex)
    {

    }
    return vmsConn;
}

/**
 *
 * @param vmsConn
 * @param username
 * @param password
 * @param channel
 * @return
 * @throws SQLException
 */
public String verifyCredentials(Connection vmsConn, String username, String password, String channel) throws SQLException
{
    ResultSet rs = null;
    Statement stmt=null;
    String sql="";
    String response = "";
    try
    {
        stmt = vmsConn.createStatement();
        sql = "select * from lu_vms_wap_users where WAP_Uname = '"+username+"' and WAP_Pwd='"+password+"'and Channel ='"+channel+"' and status = '1'";
        rs = stmt.executeQuery(sql);
        if(rs.next())
        {
            response = "1";
        }
    }
    catch (SQLException ex)
    {
        response="-4";
    }

    return response;
}

/**
 *
 * @param vmsConn
 * @param partyB
 * @param serviceid
 * @return
 * @throws SQLException
 */
public String lookUpSession(Connection vmsConn, String partyB, String serviceid) throws SQLException
{
    ResultSet rs=null;
    Statement stmt=null;
    String sql="";
    String response="";
    try
    {
        stmt = vmsConn.createStatement();
        sql = "select LA from tbl_vms_wap_sessions where partyB='"+partyB+"' /*and serviceid='"+serviceid+"'*/ and status = '0' order by LA desc";
        rs = stmt.executeQuery(sql);
        if(rs.next())
        {
            response = rs.getString("LA");
        }
        else
            response = "0";
    }
    catch (SQLException ex)
    {
        response = "-8";
    }
    return response;
}

/**
 *
 * @param LA
 * @param sessionLA
 * @return
 */
public int getNewSessionLA(int LA, int sessionLA)
{
    if(LA == 0)
    {
        LA=sessionLA;
    }
    return LA + 1;
}

/**
 *
 * @param vmsConn
 * @return
 * @throws SQLException
 */
public int getCorrelationID(Connection  vmsConn) throws SQLException
{
    ResultSet rs=null;
    Statement stmt=null;
    String sql="";
    int ret=0;
    try
    {
        stmt = vmsConn.createStatement();
        sql = "select SEQ_TBLCPAMSGS_ID.nextval from dual";
        rs = stmt.executeQuery(sql);
        if(rs.next())
        {
            ret=Integer.parseInt(rs.getString(1));
            return ret;
        }
        else
            return 0;
    }
    catch (SQLException ex)
    {
        return -5;
    }
}

/**
 *
 * @param vmsConn
 * @param partyA
 * @param partyB
 * @param correlationid
 * @param serviceid
 * @param LA
 * @return
 * @throws SQLException
 */
public String createSession(Connection vmsConn, String partyA, String partyB, int correlationid, String serviceid, String LA) throws SQLException
{
    Statement stmt=null;
    String sql="";
    String response="1";
    try
    {
        stmt = vmsConn.createStatement();
        sql = "insert into tbl_vms_wap_sessions (id, partyA, partyB, correlationid, serviceid, LA, status) values (seq_vms_wap_session.nextval, '"+partyA+"','"+partyB+"','"+correlationid+"','"+ serviceid+"','"+ LA+"','0')";
        stmt.executeQuery(sql);
    }
    catch (SQLException ex)
    {
        response="-5";
    }

    return response;
}

/**
 *
 * @param vmsConn
 * @param partyA
 * @param partyB
 * @param partyBmessage
 * @param correlationid
 * @param serviceid
 * @param LA
 * @param UserAuthResp
 * @param lookupResp
 * @param createSessResp
 * @param sendSMSResp
 * @param ReturnCode
 * @return
 * @throws SQLException
 */
public String logHistory(Connection vmsConn, String partyA, String partyB, String partyBmessage, int correlationid, String serviceid, int LA, String UserAuthResp, String lookupResp, String createSessResp, String sendSMSResp, String ReturnCode)  throws SQLException
{
    Statement stmt=null;
    String sql="";
    String response="1";
    try
    {
        stmt = vmsConn.createStatement();
        sql = "insert into tbl_vms_wap_hist (id, partyA, partyB, partyBmessage, correlationid, serviceid, LA, UserAuthResp, lookupResp, createSessResp, sendSMSResp, ReturnCode) values (seq_vms_wap_history.nextval, '"+partyA+"','"+partyB+"','"+partyBmessage+"','"+correlationid+"','"+ serviceid+"','"+ LA+"','"+UserAuthResp+"','"+lookupResp+"','"+createSessResp+"','"+sendSMSResp+"','"+ReturnCode+"')";
        stmt.executeQuery(sql);
    }
    catch (SQLException ex)
    {
        response="-5";
    }

    return response;
}

/**
 *
 * @param partyB
 * @param partyBmessage
 * @param correlationid
 * @param serviceid
 * @param MTLA
 * @param ErrorCode
 * @return
 */
public String sendSMS(String partyB, String partyBmessage, int correlationid, String serviceid, String MTLA, String ErrorCode)
{
   URL url=null;
   URLConnection connection=null;
   PrintStream outStream=null;
   InputStreamReader isr=null;
   BufferedReader inStream=null;
   String cgi_Response="";
   String inputLine="";

       try{
            url = new URL(sendSMSUrl);
            connection = url.openConnection();
            connection.setDoOutput(true);
            connection.setUseCaches(false);
            outStream = new PrintStream(connection.getOutputStream());
            outStream.println((new StringBuilder()).append("to=").append(URLEncoder.encode(partyB, "UTF-8")).append("&from=").append(URLEncoder.encode(xmsFrom, "UTF-8")).append("&service=").append(URLEncoder.encode(String.valueOf(serviceid), "UTF-8")).append("&LA=").append(URLEncoder.encode(MTLA, "UTF-8")).append("&message=").append(URLEncoder.encode(partyBmessage, "UTF-8")).append("&correlationID=").append(URLEncoder.encode(String.valueOf(correlationid), "UTF-8")).append("&serviceID=").append(URLEncoder.encode(String.valueOf(serviceid), "UTF-8")).append("&mode=").append(URLEncoder.encode(String.valueOf(mode), "UTF-8")).append("&tid=").append(URLEncoder.encode(String.valueOf(tID), "UTF-8")).toString());
            outStream.flush();
            outStream.close();
            isr = new InputStreamReader(connection.getInputStream());
            inStream = new BufferedReader(isr);

            cgi_Response = "";
            while ((inputLine = inStream.readLine())!=null){
                cgi_Response = cgi_Response+inputLine;
            }
        }
        catch (Exception ex)
        {

        }
        return cgi_Response;
}

private void LoadParameters(){
    String Token=null;
    String fileLine=null;

    try{
        FileReader fr= new FileReader(parameterFile);
        BufferedReader br= new BufferedReader(fr);
        //open file
        do{//while not end of file
        //read from file
            fileLine=br.readLine();
            if (fileLine!=null){
                //tokenize the line read
                StringTokenizer st= new StringTokenizer(fileLine);
                //get first token
                Token=st.nextToken("=");
                if (Token.equals("VMSUserName")){
                    VMSUserName =st.nextToken();
                }else if (Token.equals("VMSPassword")){
                    VMSPassword =st.nextToken();
                }else if (Token.equals("VMSjdbcUrl")){
                    VMSjdbcUrl =st.nextToken();
                }else if (Token.equals("sendSMSUrl")){
                sendSMSUrl =st.nextToken();
                }else if (Token.equals("xmsFrom")){
                    xmsFrom =st.nextToken();
                }else if (Token.equals("MTLA")){
                    MTLA =st.nextToken();
                }else if (Token.equals("TID")){
                    tID =st.nextToken();
                }else if (Token.equals("MODE")){
                    mode =st.nextToken();
                }else if (Token.equals("sessionLA")){
                    sessionLA =Integer.parseInt(st.nextToken());
                }else if (Token.equals("partyBmessage")){
                    partyBmessage = st.nextToken();
                }
            }
        }
        while(fileLine!=null);
        br.close();
    }catch(FileNotFoundException e){

    }catch(IOException e){

    }
}

}

1 个答案:

答案 0 :(得分:1)

您有5种不同的例外:

  1. vms.gift.giftingService.(giftingService.java:55) - 有一个null变量,你正在调用方法

  2. vas.vms.wapportal.GiftingService.(GiftingService.java:55) - 与上述相同

  3. (此处类似3)java.sql.Connection is an interface, and JAXB can't handle interfaces.X does not have a no-arg default constructor.

  4. 应通过检查哪个对象为null

    来修复前2个

    其他3 - 你应该完全重新审视暴露的物体。你不能暴露java.sql.Connection对象 - 它没有任何意义。同样适用于StackTraceElement

    更新:您有两种选择:

    • 使用@WebMethod(exclude=true)注释当前未注释的所有方法。默认情况下,包含所有公共方法。
    • 将您的方法设为私有(如果需要,可以保护您的方法)。如果您未将此方法公开为软件包中的公共API,则首选此选项。