我必须为一个项目使用 JAX-RPC 制作一个 Web 服务,并且error: invalid type for JAX-RPC structure: jspf.common.ForumPost
在尝试编译它时得到了。我们必须使用 JDK 5 和 J2EE 1.4。我正在使用带有 JAX-RPC 插件和 Glassfish v1 支持插件的 Netbeans 7.0 来使用 Application Server PE 9 作为我的容器。
这是我的课:
package jspf.common;
import java.sql.Date;
public class ForumPost extends java.lang.Object implements java.io.Serializable {
private String poster;
private String content;
private int topic_id;
private int post_id;
private Date time;
/**
* Creates a new ForumPost object.
* @param poster The username of the user that posted the post.
* @param content The body/content of the post.
* @param topic_id The topic ID that this post replies to.
* @param post_id This post's ID.
*/
public ForumPost() {
}
public ForumPost(int post_id, int topic_id, String poster, String content, Date time) {
this.poster = poster;
this.content = content;
this.topic_id = topic_id;
this.post_id = post_id;
this.time = time;
}
public Date getTime() {
return time;
}
public String getContent() {
return content;
}
public int getPost_id() {
return post_id;
}
public String getPoster() {
return poster;
}
public int getTopic_id() {
return topic_id;
}
}
是的,不幸的是,我不得不使用这种旧技术。
我在另一个课程中遇到了类似的问题,但这似乎可以通过删除其中的ArrayList
内容来解决,但我实际上需要那个ArrayList
.
为什么我会收到此错误?
编辑:我摆脱了对 java.sql.Date 的所有引用,如下所示:
package jspf.common;
public class ForumPost extends java.lang.Object implements java.io.Serializable {
private String poster;
private String content;
private int topic_id;
private int post_id;
private long time;
/**
* Creates a new ForumPost object.
* @param poster The username of the user that posted the post.
* @param content The body/content of the post.
* @param topic_id The topic ID that this post replies to.
* @param post_id This post's ID.
*/
public ForumPost() {
}
public ForumPost(int post_id, int topic_id, String poster, String content, long time) {
this.poster = poster;
this.content = content;
this.topic_id = topic_id;
this.post_id = post_id;
this.time = time;
}
public long getTime() {
return time;
}
public String getContent() {
return content;
}
public int getPost_id() {
return post_id;
}
public String getPoster() {
return poster;
}
public int getTopic_id() {
return topic_id;
}
}
我仍然得到同样的错误。我不明白问题是什么。