java(Webservices)模块尚未部署。有关详细信息,请参阅服务器日志。构建失败
我对web服务还是个新手,在将数据插入MySQL时遇到了一个问题。我真的不知道为什么构建失败,当我添加insert users函数时会发生这种情况。我试着在任务管理器中结束任务,然后重新构建它,但仍然没有成功。我甚至部署了好几次,但都是一样的
我的网络服务:
@WebService(serviceName = "LoginWebServices")
public class LoginWebServices {
User modelUser;
Booking modelBooking;
rentalHouse modelRentalHouse;
ArrayList<String> listOfUser;
ArrayList<String> listOfBooking;
public LoginWebServices(){
modelUser = new User();
listOfUser = modelUser.displayToString();
listOfBooking = modelUser.displayToString();
}
@WebMethod(operationName = "hello")
public String hello(@WebParam(name = "name") String txt) {
return "Hello " + txt + " !";
}
/**
* Web service operation
*/
Connection connect;
private Statement stat;
public Connection getConnection(){
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
connect = (Connection) DriverManager.getConnection("jdbc:mysql://localhost/rentalhouseslukitaedward", "root", "");
} catch (Exception ex) {
Logger.getLogger(User.class.getName()).log(Level.SEVERE, null, ex);
}
return connect;
}
public void insertUsers(String username, String address, int telephone, String email, String password){
try {
getConnection();
System.out.println("Test insert");
stat = (Statement) connect.createStatement();
if (!connect.isClosed()) {
PreparedStatement sql = (PreparedStatement) connect.prepareStatement("insert into users (`user_id`,`user_name`,`address`,`telephone`,`email`,`password`) values(?,?,?,?,?,?)");
sql.setInt(1, 0);
sql.setString(2, username);
sql.setString(3, address);
sql.setInt(4, telephone);
sql.setString(5, email);
sql.setString(6, password);
sql.executeUpdate();
}
} catch (SQLException ex) {
Logger.getLogger(User.class.getName()).log(Level.SEVERE, null, ex);
}
}
/**
* Web service operation
*/
@WebMethod(operationName = "checkLogin")
public String checkLogin(@WebParam(name = "username") String username, @WebParam(name = "password") String password) {
modelUser = new User(username,password);
return modelUser.checkValid();
}
/**
* Web service operation
*/
@WebMethod(operationName = "registrationUser")
public String registrationUser(
@WebParam(name = "userName") String userName,
@WebParam(name = "address") String address,
@WebParam(name = "telephone") int telephone,
@WebParam(name = "email") String email,
@WebParam(name = "password") String password) {
String status = "";
for(int i = 0; i< listOfUser.size();i++){
String[] user = listOfUser.get(i).split("-");
if(userName.equals(user[1])){
status = "failled";
break;
}
else status = "success";
}
if(status.equals("success")){
insertUsers(userName,address,telephone,email,password);
//modelUser = new User(0, userName,address,telephone,email,password);
//modelUser.insert();
}
JOptionPane.showMessageDialog(null, status);
System.out.println("Status2 : "+status);
return status;
}
}
错误:
Starting GlassFish Server (1)
GlassFish Server (1) is running.
In-place deployment at C:\Users\1luki\OneDrive\Documents\NetBeansProjects\GlobalImplementationSystem_160919005\build\web
GlassFish Server (1), deploy, null, false
C:\Users\1luki\OneDrive\Documents\NetBeansProjects\GlobalImplementationSystem_160919005\nbproject\build-impl.xml:1049: The module has not been deployed.
See the server log for details.
BUILD FAILED (total time: 24 seconds)
C:\Users\1luki\OneDrive\Documents\NetBeansProjects\GlobalImplementationSystem\U 160919005\nbproject\build impl。xml:1049:
</target>
<target name="-run-deploy-am">
<!-- Task to deploy to the Access Manager runtime. -->
</target>
<target depends="init,-init-cos,compile,compile-jsps,-do-compile-single-jsp,-pre-dist,-do-tmp-dist-with-manifest,-do-tmp-dist-without-manifest,-pre-run-deploy,-pre-nbmodule-run-deploy,-run-deploy-nb,-init-deploy-ant,-deploy-ant,-run-deploy-am,-post-nbmodule-run-deploy,-post-run-deploy,-do-update-breakpoints" name="run-deploy"/>
<target if="netbeans.home" name="-run-deploy-nb">
<nbdeploy clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/>
</target>
<target name="-init-deploy-ant" unless="netbeans.home">
<property name="deploy.ant.archive" value="${dist.war}"/>
<property name="deploy.ant.docbase.dir" value="${web.docbase.dir}"/>
<property name="deploy.ant.resource.dir" value="${resource.dir}"/>
<property name="deploy.ant.enabled" value="true"/>
</target>
<target depends="dist,-run-undeploy-nb,-init-deploy-ant,-undeploy-ant" name="run-undeploy"/>
<target if="netbeans.home" name="-run-undeploy-nb">
<fail message="Undeploy is not supported from within the IDE"/>
</target>
<target depends="init,-pre-dist,dist,-post-dist" name="verify">
<nbverify file="${dist.war}"/>
</target>
共 (0) 个答案