当我从另一个调用接口方法时,Spring Boot(Java)中出现以下错误

问题描述 投票:0回答:1

嗨,我想为我的项目编写一个soap web服务。所以我创建了一个模型,接口和接口实现类......但是当我从接口调用对象时,项目解复失败了......

我使用WebServicePermitRepository obj = new WebServiceImpl();从实现类创建一个对象...但是在编译时它会产生很大的错误...

错误

21-Feb-2018 10:37:09.210 SEVERE [http-nio-8443-exec-25] com.sun.xml.ws.transport.http.servlet.WSServletContextListener.parseAdaptersAndCreateDelegate WSSERVLET11: failed to parse runtime descriptor: java.lang.StackOverflowError
 java.lang.StackOverflowError
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:20)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
    at lk.slsi.webService.WebServiceImpl.<init>(WebServiceImpl.java:22)
...

这是我的模特课

package lk.slsi.domain;

import javax.persistence.*;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

@Entity
@Table(name = "CustomsPermit")
@XmlRootElement(name = "Permits")
public class CustomsPermit {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "permit_id")
    private Long id;

    @Column(nullable = false, unique = true, name = "EntryNumber")
    private String SNumber;

    @Column(nullable = false, unique = true, name = "Application_ID")
    private String applicationID;

    @Column(nullable = false, name = "PermitReleaseDate")
    private String appPostdate;

    @Column(nullable = false, length = 255)
    private String dtIssue;

    @Column(nullable = false, name = "PostedUserId")
    private String userID;

    @Column(length = 255)
    private String cusdecNo;

    @Column(nullable = false, length = 255)
    private String importerVAT;

    @Column(nullable = false, length = 255)
    private String importerDetails;

    @Column(nullable = false, length = 255)
    private String invoiceNo;

    @Column(nullable = false, length = 255)
    private String invoiceValue;

    @Column(nullable = false, length = 255)
    private String totQty;

    @Column(nullable = false, length = 255)
    private String UoM;

    @Column(nullable = false, length = 255)
    private String hsCod;

    @Column(nullable = false, length = 255)
    private String productDesc;

    @Column(nullable = false, length = 255)
    private String blNo;

    @Column(length = 255)
    private String cond1;

    @Column(length = 255)
    private String cond2;

    @Column(length = 255)
    private String cond3;

    @Column(length = 255)
    private String cond4;

    @Column(length = 255)
    private String cond5;

    @Column(length = 255)
    private String cond6;

    @XmlTransient
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getSNumber() {
        return SNumber;
    }

    public void setSNumber(String SNumber) {
        this.SNumber = SNumber;
    }

    @XmlTransient
    public String getApplicationID() {
        return applicationID;
    }

    public void setApplicationID(String applicationID) {
        this.applicationID = applicationID;
    }

    @XmlTransient
    public String getAppPostdate() {
        return appPostdate;
    }

    public void setAppPostdate(String appPostdate) {
        this.appPostdate = appPostdate;
    }

    public String getDtIssue() {
        return dtIssue;
    }

    public void setDtIssue(String dtIssue) {
        this.dtIssue = dtIssue;
    }

    @XmlTransient
    public String getUserID() {
        return userID;
    }

    public void setUserID(String userID) {
        this.userID = userID;
    }

    public String getCusdecNo() {
        return cusdecNo;
    }

    public void setCusdecNo(String cusdecNo) {
        this.cusdecNo = cusdecNo;
    }

    public String getImporterVAT() {
        return importerVAT;
    }

    public void setImporterVAT(String importerVAT) {
        this.importerVAT = importerVAT;
    }

    public String getImporterDetails() {
        return importerDetails;
    }

    public void setImporterDetails(String importerDetails) {
        this.importerDetails = importerDetails;
    }

    public String getInvoiceNo() {
        return invoiceNo;
    }

    public void setInvoiceNo(String invoiceNo) {
        this.invoiceNo = invoiceNo;
    }

    public String getInvoiceValue() {
        return invoiceValue;
    }

    public void setInvoiceValue(String invoiceValue) {
        this.invoiceValue = invoiceValue;
    }

    public String getTotQty() {
        return totQty;
    }

    public void setTotQty(String totQty) {
        this.totQty = totQty;
    }

    public String getUoM() {
        return UoM;
    }

    public void setUoM(String UoM) {
        this.UoM = UoM;
    }

    public String getHsCod() {
        return hsCod;
    }

    public void setHsCod(String hsCod) {
        this.hsCod = hsCod;
    }

    public String getProductDesc() {
        return productDesc;
    }

    public void setProductDesc(String productDesc) {
        this.productDesc = productDesc;
    }

    public String getBlNo() {
        return blNo;
    }

    public void setBlNo(String blNo) {
        this.blNo = blNo;
    }

    public String getCond1() {
        return cond1;
    }

    public void setCond1(String cond1) {
        this.cond1 = cond1;
    }

    public String getCond2() {
        return cond2;
    }

    public void setCond2(String cond2) {
        this.cond2 = cond2;
    }

    public String getCond3() {
        return cond3;
    }

    public void setCond3(String cond3) {
        this.cond3 = cond3;
    }

    public String getCond4() {
        return cond4;
    }

    public void setCond4(String cond4) {
        this.cond4 = cond4;
    }

    public String getCond5() {
        return cond5;
    }

    public void setCond5(String cond5) {
        this.cond5 = cond5;
    }

    public String getCond6() {
        return cond6;
    }

    public void setCond6(String cond6) {
        this.cond6 = cond6;
    }
}

这是我的界面

package lk.slsi.repository;

import lk.slsi.domain.Agent;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;

import java.util.List;
import javax.jws.WebService;
import lk.slsi.domain.CustomsPermit;
import org.springframework.stereotype.Component;

@WebService
public interface WebServicePermitRepository {

    @Query("select a from CustomsPermit a where a.dtIssue = :dtIssue")
    List<CustomsPermit> getPermitByDate(String dtIssue);
}

这是我的实现类

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package lk.slsi.webService;

import java.util.List;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import lk.slsi.domain.CustomsPermit;
import lk.slsi.repository.WebServicePermitRepository;

/**
 *
 * @author lankadeva.ghg
 */
@WebService(serviceName = "customsPermit", endpointInterface = "lk.slsi.repository.WebServicePermitRepository")
public class WebServiceImpl implements WebServicePermitRepository {

    WebServicePermitRepository obj = new WebServiceImpl();

    @Override
    public List<CustomsPermit> getPermitByDate(String dtIssue) {
        return obj.getPermitByDate(dtIssue);
    }
}

谁能帮我

java spring-mvc spring-boot soap jax-ws
1个回答
0
投票

请在下面找到代码段。另外,阅读有关工厂设计模式以了解相同的内容。

@WebService(serviceName = "customsPermit", endpointInterface = "lk.slsi.repository.WebServicePermitRepository")
public class WebServiceImpl implements WebServicePermitRepository {

    private static WebServicePermitRepository obj ;

public static WebServicePermitRepository getWebServiceRepository(){
if (obj==null){
    obj = new WebServiceImpl();
}
return obj;
}
    @Override
    public List<CustomsPermit> getPermitByDate(String dtIssue) {
        return obj.getPermitByDate(dtIssue);
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.