创建会话工厂时出现空指针异常

时间:2014-08-05 09:18:20

标签: java

  

我正在生成一个wsdl文件。每当我点击请求时   SOAPUI,我没有收到回复。在日志中,它显示为null   创建hibernate会话工厂时的指针异常。这是我的   HibernateSessionFactory文件,hibernate.cgf.xml文件,以及   GetFeasibilityDetailsReturns.java文件,我得到null   行tx = session.beginTransaction()的指针异常;我是   无法找到错误。请建议。

HibernateSessionFactory :-

public class HibernateSessionFactory {

/** 
 * Location of hibernate.cfg.xml file.
 * Location should be on the classpath as Hibernate uses  
 * #resourceAsStream style lookup for its configuration file. 
 * The default classpath location of the hibernate config file is 
 * in the default package. Use #setConfigFile() to update 
 * the location of the configuration file for the current session.   
 */
private static String CONFIG_FILE_LOCATION = "/hibernate.cfg.xml";
private static final ThreadLocal<Session> threadLocal = new ThreadLocal<Session>();
private  static Configuration configuration = new Configuration();    
private static org.hibernate.SessionFactory sessionFactory;
private static String configFile = CONFIG_FILE_LOCATION;

static {
    try {
        configuration.configure(configFile);
        sessionFactory = configuration.buildSessionFactory();
    } catch (Exception e) {
        System.err
                .println("%%%% Error Creating SessionFactory %%%%");
        e.printStackTrace();
    }
}




hibernate.cfg.xml :-
_________________




<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
      "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
      "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<!-- Generated by MyEclipse Hibernate Tools.-->
<hibernate-configuration>
<!-- 
    For My SQL 5
    org.hibernate.dialect.MySQL5InnoDBDialect -->
<session-factory>
    <property name="connection.autoReconnect">true</property>
    <property name="connection.autoReconnectForPools">
        true
    </property>
    <property name="connection.is-connection-validation-required">
        true
    </property>
    <property name="show_sql">false</property>
    <property name="format_sql">false</property>
    <property name="cache.use_second_level_cache">false</property>
    <property name="cache.use_query_cache">false</property>



    <property name="hibernate.c3p0.min_size">1</property>
    <property name="hibernate.c3p0.max_size">2</property>
    <property name="hibernate.c3p0.timeout">300</property>
    <property name="hibernate.c3p0.max_statements">50</property>
    <property name="hibernate.c3p0.idle_test_period">3000</property>



    <property name="myeclipse.connection.profile">Oracle1</property>
    <property name="connection.url">
        jdbc:oracle:thin:@10.52.11.33:12331:TSTFPDB
    </property>
    <property name="connection.username">fpdbusr</property>
    <property name="connection.password">fpdbusr</property>
    <property name="connection.driver_class">
        oracle.jdbc.driver.OracleDriver
    </property>
    <property name="dialect">
        org.hibernate.dialect.Oracle9Dialect
    </property>
    <!--





        <property name="connection.datasource">fpdbconnection</property>
        <property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>





    -->
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/EmailRoleMapping.hbm.xml" />

    <mapping
        resource="com/wipro/vel/feasibility/hibernate/Feasibility.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/Stage2Offnet.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/Stage2.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/Stage1.hbm.xml" />

    <mapping
        resource="com/wipro/vel/feasibility/hibernate/Deal.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/AccountManagerMaster.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/Vendor.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/UserMaster.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/CircleMaster.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/Location.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/Nld.hbm.xml" />

    <mapping
        resource="com/wipro/vel/feasibility/hibernate/RfsLocation.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/PopLocation.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/StateMaster.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/CountryMaster.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/UserLog.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/CityMaster.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/EquipmentMaster.hbm.xml" />


    <mapping
        resource="com/wipro/vel/feasibility/hibernate/RoleMaster.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/NodeLocation.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/SalesSummary.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/Vf8ClusterMaster.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/EqTypeMaster.hbm.xml" />

    <mapping
        resource="com/wipro/vel/feasibility/hibernate/EqMuxMaster.hbm.xml" />

    <mapping
        resource="com/wipro/vel/feasibility/hibernate/EqModuleMaster.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/EqItemMaster.hbm.xml" />

    <mapping
        resource="com/wipro/vel/feasibility/hibernate/EqTransactions.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernat/EnterpriseCustomerMaster.hbm.xml"/>
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/ConnectivityType.hbm.xml" />

    <mapping
        resource="com/wipro/vel/feasibility/hibernate/NldFinalizeStatus.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/NldFinalizeTransactions.hbm.xml"/>
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/UserQuickLinks.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/VendorEmailMaster.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/ActivityMaster.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/EmailActivityMaster.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/UserEmailActivity.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/RoleActivityMapping.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/Category.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/TickerMaster.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/FeasibilityHistoryTrns.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/Stage2Ubr.hbm.xml" />

    <mapping
        resource="com/wipro/vel/feasibility/hibernate/Stage2Microwave.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/CometMaster.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/EndwiseStageDetails.hbm.xml" />

    <!--
        STAGE 2_3g service mapping
    -->

    <mapping
        resource="com/wipro/vel/feasibility/hibernate/PendencyMaster.hbm.xml" />

    <mapping
 resource="com/wipro/vel/feasibility/hibernate/NotFeasibleCateogoryDetails.hbm.xml />   

    <mapping
        resource="com/wipro/vel/feasibility/hibernate/NotFeasibleCategory.hbm.xml" />


    <mapping
        resource="com/wipro/vel/feasibility/hibernate/Stage23g.hbm.xml" />



    <mapping
        resource="com/wipro/vel/feasibility/hibernate/SiteIssuesMaster.hbm.xml" />

    <mapping
        resource="com/wipro/vel/feasibility/hibernate/EchoMaster.hbm.xml" />

    <mapping
        resource="com/wipro/vel/feasibility/hibernate/Tnoc.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/Enoc.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/SuperhotApproval.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/ReqSolCircles.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/ServiceMaster.hbm.xml" />


    <mapping
        resource="com/wipro/vel/feasibility/hibernate/EqUbrTransaction.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/UbrConfigTrans.hbm.xml" />

    <mapping
        resource="com/wipro/vel/feasibility/hibernate/UbrconfigItem.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/UbrconfigLotType.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/UbrconfigVendorType.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/Stage2MicrowaveNu.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/IduOduType.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/IduOduItem.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/EqMicrowaveTransaction.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/IduOduTransactions.hbm.xml" />

    <mapping
        resource="com/wipro/vel/feasibility/hibernate/FinalizeTransaction.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/MwEqMaterial.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/MwEqTransactions.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/MwEqVendor.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/MwEqSubmaterial.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/MwEqType.hbm.xml" />
    <mapping
    resource="com/wipro/vel/feasibility/hibernate/ServiceDeliveryTimeline.hbm.xml" />

    <mapping
        resource="com/wipro/vel/feasibility/hibernate/SignalStrength3g.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/Stage2UbrResurvey.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/PoleVendor.hbm.xml" />
    <mapping
        resource="com/wipro/osm/xsd/feasibility/DesktopFeasibility.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/EqTransactionsDesktop.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/DAO/EqTransactionsDesktop.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/DesktopFeasibility.hbm.xml" />
    <mapping
resource="com/wipro/vel/feasibility/hibernat/ConditionalFeasibilityMaster.hbm.xml"/>    
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/ConditionalFeasibility.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/DesktopConfigTrans.hbm.xml" />
    <mapping
        resource="com/wipro/vel/feasibility/hibernate/OrderTransaction.hbm.xml" />

</session-factory>

</hibernate-configuration>




GetFeasibilityDetailsReutn.java :-
__________________________________________________





public List getFeasibilityList(List feasibilityList)
{
    getFeasibilityDetailsReturn = new ArrayList<GetFeasibilityDetailsReturn>();

    session = HibernateSessionFactory.getSession();

    tx = session.beginTransaction();

    FeasibilityDAO  feasibilityDAO = new FeasibilityDAO();



    List fIds = feasibilityList;

    try {

        for(int i=0;i<fIds.size();i++)
        }



  Get Feasibility Details Response.java
 --------------------------------------------------------

  package com.wipro.osm.xsd.feasibility;


 import java.util.ArrayList;
 import java.util.List;

 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlType;

 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;

 import com.wipro.osm.xsd.feasibility.types.GetFeasibilityDetailsReturn;
 import com.wipro.vel.feasibility.DAO.FeasibilityDAO;
 import com.wipro.vel.feasibility.hibernate.Feasibility;


 /**
 * <p>
 * Java class for GetFeasibilityDetailsResponse complex type.
 * 
 * <p>
 * The following schema fragment specifies the expected content contained within
 * this class.
 * 
 * <pre>
 * &lt;complexType name=&quot;GetFeasibilityDetailsResponse&quot;&gt;
 *   &lt;complexContent&gt;
 *     &lt;restriction base=&quot;{http://www.w3.org/2001/XMLSchema}anyType&quot;&gt;
 *       &lt;sequence&gt;
 *         &lt;element name=&quot;getFeasibilityDetailsReturn&quot; type=&quot;        {http://osm.wipro.com/xsd/Feasibility/types}GetFeasibilityDetailsReturn&quot;        maxOccurs=&quot;unbounded&quot;/&gt;
 *       &lt;/sequence&gt;
 *     &lt;/restriction&gt;
 *   &lt;/complexContent&gt;
 * &lt;/complexType&gt;
 * </pre>
 * 
 * 
 */
 @XmlAccessorType(XmlAccessType.FIELD)
 @XmlType(name = "GetFeasibilityDetailsResponse", propOrder = {       "getFeasibilityDetailsReturn" })
 public class GetFeasibilityDetailsResponse {


@XmlElement(required = true)
protected List<GetFeasibilityDetailsReturn> getFeasibilityDetailsReturn  = null;

/**
 * Gets the value of the getFeasibilityDetailsReturn property.
 * 
 * <p>
 * This accessor method returns a reference to the live list, not a
 * snapshot. Therefore any modification you make to the returned list will
 * be present inside the JAXB object. This is why there is not a
 * <CODE>set</CODE> method for the getFeasibilityDetailsReturn property.
 * 
 * <p>
 * For example, to add a new item, do as follows:
 * 
 * <pre>
 * getGetFeasibilityDetailsReturn().add(newItem);
 * </pre>
 * 
 * 
 * <p>
 * Objects of the following type(s) are allowed in the list
 * {@link GetFeasibilityDetailsReturn }
 * 
 * 
 */
  public List<GetFeasibilityDetailsReturn>    getGetFeasibilityDetailsReturn(GetFeasibilityDetailsRequest getFeasibilityDetailsRequest) {


            getFeasibilityDetailsReturn = new ArrayList<GetFeasibilityDetailsReturn>();


        Log log = LogFactory.getLog(GetFeasibilityDetailsResponse.class);


        List fIds = getFeasibilityDetailsRequest.getFeasibilityId();
        GetFeasibilityDetails getFeasibilityDetails = new GetFeasibilityDetails();
        getFeasibilityDetailsReturn = getFeasibilityDetails.getFeasibilityList(fIds);


        return getFeasibilityDetailsReturn;


    }

    public static void main(String a[])
    {
        FeasibilityDAO  feasibilityDAO = new FeasibilityDAO();
        Feasibility feasibility = feasibilityDAO.findById("FR00022118");

    }
    }




  Hibernate Session Factory
 --------------------------------------------------------
 package com.wipro.vel.feasibility.hibernate;

import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.cfg.Configuration;

/**
* Configures and provides access to Hibernate sessions, tied to the
* current thread of execution.  Follows the Thread Local Session
* pattern, see {@link http://hibernate.org/42.html }.
*/
public class HibernateSessionFactory {

/** 
 * Location of hibernate.cfg.xml file.
 * Location should be on the classpath as Hibernate uses  
 * #resourceAsStream style lookup for its configuration file. 
 * The default classpath location of the hibernate config file is 
 * in the default package. Use #setConfigFile() to update 
 * the location of the configuration file for the current session.   
 */
private static String CONFIG_FILE_LOCATION = "/hibernate.cfg.xml";
private static final ThreadLocal<Session> threadLocal = new ThreadLocal<Session>();
private  static Configuration configuration = new Configuration();    
private static org.hibernate.SessionFactory sessionFactory;
private static String configFile = CONFIG_FILE_LOCATION;

static {
    try {
        configuration.configure(configFile);
        sessionFactory = configuration.buildSessionFactory();
    } catch (Exception e) {
        System.err
                .println("%%%% Error Creating SessionFactory %%%%");
        e.printStackTrace();
    }
}
private HibernateSessionFactory() {
}

/**
 * Returns the ThreadLocal Session instance.  Lazy initialize
 * the <code>SessionFactory</code> if needed.
 *
 *  @return Session
 *  @throws HibernateException
 */
public static Session getSession() throws HibernateException {
    Session session = (Session) threadLocal.get();

    if (session == null || !session.isOpen()) {
        if (sessionFactory == null) {
            rebuildSessionFactory();
        }
        session = (sessionFactory != null) ? sessionFactory.openSession()
                : null;
        threadLocal.set(session);
    }

    return session;
}

/**
 *  Rebuild hibernate session factory
 *
 */
public static void rebuildSessionFactory() {
    try {
        configuration.configure(configFile);
        sessionFactory = configuration.buildSessionFactory();
    } catch (Exception e) {
        System.err
                .println("%%%% Error Creating SessionFactory %%%%");
        e.printStackTrace();
    }
}

/**
 *  Close the single hibernate session instance.
 *
 *  @throws HibernateException
 */
public static void closeSession() throws HibernateException {
    Session session = (Session) threadLocal.get();
    threadLocal.set(null);

    if (session != null) {
        session.close();
    }
}

/**
 *  return session factory
 *
 */
public static org.hibernate.SessionFactory getSessionFactory() {
    return sessionFactory;
}

/**
 *  return session factory
 *
 *  session factory will be rebuilded in the next call
 */
public static void setConfigFile(String configFile) {
    HibernateSessionFactory.configFile = configFile;
    sessionFactory = null;
}

/**
 *  return hibernate configuration
 *
 */
public static Configuration getConfiguration() {
    return configuration;
}

}


  OSMServicesPortImp  
 ------------------------------------     

package com.wipro.osm.wsdl.feasibility;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import com.wipro.osm.xsd.feasibility.GetFeasibilityDetailsRequest;
import com.wipro.osm.xsd.feasibility.GetFeasibilityDetailsResponse;
import com.wipro.osm.xsd.feasibility.UpdateCompleteOrderRequest;
import com.wipro.osm.xsd.feasibility.UpdateCompleteOrderResponse;
import com.wipro.osm.xsd.feasibility.UpdateSubmitOrderRequest;
import com.wipro.osm.xsd.feasibility.UpdateSubmitOrderResponse;


      @javax.jws.WebService(endpointInterface =                                                                                                   "com.wipro.osm.wsdl.feasibility.OSMServicesPortType", targetNamespace =                                                                     "http://osm.wipro.com/wsdl/Feasibility", serviceName = "OSMServices", portName =    "OSMServicesPort", wsdlLocation = "WEB-INF/wsdl/DemoWSDL.wsdl")
  public class OSMServicesPortImpl {
  GetFeasibilityDetailsResponse detailsResponse;
  UpdateSubmitOrderResponse updateSubmitOrderResponse;
  UpdateCompleteOrderResponse updateCompleteOrderResponse;
  public synchronized GetFeasibilityDetailsResponse getFeasibilityDetails(
        GetFeasibilityDetailsRequest getFeasibilityDetailsRequest) {
    try {
        System.out.println("start web service");
         detailsResponse = new GetFeasibilityDetailsResponse();

         detailsResponse.getGetFeasibilityDetailsReturn(getFeasibilityDetailsRequest);

         System.out.println("End web service");

    } catch (RuntimeException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
     //throw new UnsupportedOperationException("Not implemented yet.");

    return detailsResponse;
   }


   public UpdateSubmitOrderResponse updateSubmitOrder(
        UpdateSubmitOrderRequest updateSubmitOrderRequest) {
    // TODO Auto-generated method stub
    try {
        updateSubmitOrderResponse = new UpdateSubmitOrderResponse();
        updateSubmitOrderResponse.getUpdateSubmitOrderReturn(updateSubmitOrderRequest);
    } catch (RuntimeException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return updateSubmitOrderResponse;
    }

    public UpdateCompleteOrderResponse updateCompleteOrder(
        UpdateCompleteOrderRequest updateCompleteOrderRequest) {
    // TODO Auto-generated method stub
    try {
        updateCompleteOrderResponse = new UpdateCompleteOrderResponse();
                                                                                               updateCompleteOrderResponse.getUpdateCompleteOrderReturn(updateCompleteOrderRequest);
    } catch (RuntimeException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return updateCompleteOrderResponse;
   }

   }

我收到错误: -

start web service

%%%% Error Creating SessionFactory %%%%

java.lang.NullPointerException
at          com.wipro.osm.xsd.feasibility.GetFeasibilityDetails.getFeasibilityList(GetFeasibilityDetail    s.java:300)
at   com.wipro.osm.xsd.feasibility.GetFeasibilityDetailsResponse.getGetFeasibilityDetailsReturn(    GetFeasibilityDetailsResponse.java:93)
at        com.wipro.osm.wsdl.feasibility.OSMServicesPortImpl.getFeasibilityDetails(OSMServicesPortImp    l.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at        sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:246)
at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)
at com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257)
at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:93)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:595)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:554)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:539)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:436)
at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:243)
at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:444)
at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)
at    com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:129)
at      com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:160)
at com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at         org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.jav    a:290)
at          org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at      org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java    :581)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)

1 个答案:

答案 0 :(得分:0)

删除以下代码中的方法参数

configuration.configure(configFile);

在上面的代码中进行更改并尝试如下所示

configuration.configure();

默认情况下,hibernate会查找hibernate.cfg.xml,无需手动配置。