继续获取错误[org.jboss.ws.common.invocation.InvocationHandlerJAXWS]

时间:2014-05-16 02:11:30

标签: java eclipse web-services soap ejb

目前我正在尝试使用我的网络服务生成tac号码。

这是ejb TacGenerator.java

import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Date;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import com.TacEntity.Tac;
public class TacGenerator1{

@PersistenceContext(unitName = "TacDB")
private EntityManager em4;

    public String generate(String tacId, String data){


        //Creating Date
        Date date = new Date();

        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        cal.add(Calendar.HOUR, 1);



        //Generating TacNumber      
        int num;
        String tacNum;
        num = 1 + (int) (Math.random() * (999999 + 1));
        tacNum = String.format("%06d", num);

        //Placing in database
        Tac tac = new Tac();
        tac.setTacId(tacId.replace(' ', '+'));
        tac.setTacData(data.replace(' ', '+'));
        tac.setTacNum(tacNum);
        tac.setTacCrdate(new Timestamp(date.getTime()));
        tac.setTacExdate(new Timestamp(cal.getTime().getTime()));
        em4.persist(tac);

        return tac.getTacNum();
    }


       }

这是我对TacGenerator.java的网络服务

import javax.jws.WebMethod;
import javax.jws.WebService;

import org.nisa.javabrains.business.TacGenerator1;


@WebService
public class TacGeneratorWebServices {

TacGenerator1 tacNumber = new TacGenerator1();

@WebMethod  
public String generate(String tacId, String data){
    return tacNumber.generate(tacId, data);
}

  }

如果我只输入生成的tac编号代码,代码会很好地返回tac编号,但是当我添加创建日期并放入数据库代码时,Web服务无法正常工作,并返回此错误{{1} }

这是Tac.java(我的数据库类,com / TacEntity / Tac)

javax.xml.ws.soap.SOAPFaultException: com/TacEntity/Tac

好的,堆栈跟踪就在这里..

package com.TacEntity;

import java.io.Serializable;
import javax.persistence.*;
import java.sql.Timestamp;
//import javax.xml.ws.soap.*;


/**
 * The persistent class for the tacs database table.
 * 
 */
@Entity
@Table(name="tacs")
@NamedQuery(name="Tac.findAll", query="SELECT t FROM Tac t")
public class Tac implements Serializable {
private static final long serialVersionUID = 1L;

@Id
@Column(name="tac_id")
private String tacId;

@Column(name="tac_crdate")
private Timestamp tacCrdate;

@Column(name="tac_data")
private String tacData;

@Column(name="tac_exdate")
private Timestamp tacExdate;

@Column(name="tac_num")
private String tacNum;

public Tac() {
}

public String getTacId() {
    return this.tacId;
}

public void setTacId(String tacId) {
    this.tacId = tacId;
}

public Timestamp getTacCrdate() {
    return this.tacCrdate;
}

public void setTacCrdate(Timestamp tacCrdate) {
    this.tacCrdate = tacCrdate;
}

public String getTacData() {
    return this.tacData;
}

public void setTacData(String tacData) {
    this.tacData = tacData;
}

public Timestamp getTacExdate() {
    return this.tacExdate;
}

public void setTacExdate(Timestamp tacExdate) {
    this.tacExdate = tacExdate;
}

public String getTacNum() {
    return this.tacNum;
}

public void setTacNum(String tacNum) {
    this.tacNum = tacNum;
}

    }

所以我需要在我的数据库类中做一些事情,Tac?应该在文件中有任何Web服务注释吗?现在真的需要帮助。我试着寻找解决方案,但真的无法抓住它。

谢谢:D

0 个答案:

没有答案