1

这是我的类,我需要初始化 当我运行 web 方法时
,我的类上有一个静态初始化,我得到一个异常

@WebService( serviceName = "SalesManager")

public class SalesManager {
       private static ServerListner serverLister;
       private static  Set<Client> clients;
       public static Set<Sale> sales;
       private static String status;
public SalesManager(){}
// this is the static block which should run once
static {
    ApplicationContext serverLoader = new ClassPathXmlApplicationContext("salesLoader.xml")
    clients  = new LinkedHashSet<Client>();
    sales = (Set<Sale>) serverLoader.getBean("sales");
    serverLister = (ServerListner) serverLoader.getBean("Serverlistner");
    status = "Created";  }
//this is the webmothod which I need to run
@WebMethod (operationName = "getOpenSales")
public Set<Sale>  getOpenSales (){
return SalesManager.sales; }
4

0 回答 0