用户信息注册bean中调用另一数据库连接bean的问题,没有error却出现莫名异常,谢谢大侠的帮助了:)

LizzieD LizzieD 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我已编译好了,DataBaseConnection.java 生成的class文件放在了相应的包里。
我用UserRegist.java调用它时就出现了问题。
代码如下:
package com.jspshop.jspmarket;//这里有我要用的UserInfo.class
import com.jspshop.api.*;DataBaseConncetion.class放在这里
import java.util.*;
import java.io.*;
import java.sql.*;

public class UserRegist
{
    private UserInfo userInfo;
private Connection con;
private DataBaseConnection DBcon;

public UserRegist()
{
this.con=DBcon.getConnection();
}

//设置待注册的用户信息。
public void setUserInfo(UserInfo userInfo)
{
this.userInfo=userInfo;
}

//进行注册
public void regist()throws Exception
{
String reg="insert into user_Info values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";

try
{
PreparedStatement pstmt=con.prepareStatement(reg);
pstmt.setString(1,userInfo.getUserid());
pstmt.setString(2,userInfo.getName());
pstmt.setString(3,userInfo.getPhone());
pstmt.setString(4,userInfo.getStreet());
pstmt.setString(5,userInfo.getState());
pstmt.setString(7,userInfo.getCity());
pstmt.setString(6,userInfo.getZipCode());
pstmt.setString(8,userInfo.getEmail());
pstmt.setString(9,userInfo.getCardNumber());
pstmt.setInt(10,userInfo.getCardType());
pstmt.setInt(11,0);
pstmt.setDate(12,new java.sql.Date(new java.util.Date().getTime()));
pstmt.setInt(13,1);
pstmt.setInt(14,0);
pstmt.setString(15,userInfo.getFanvcategory());
pstmt.setString(16,userInfo.getPassword());
pstmt.executeUpdate();
}
catch(Exception e)
{
e.printStackTrace();
throw e;
}
}
}
运行后去出现这样的异常:
Exprexion in thread "main" java.lang.NoClassDfFoundError:UserRegist/java
...全文

相关推荐

PHP 连接mysql数据库做简单的登录页面,实现用户的登录注册功能

php 连接mysql数据库做简单的登录页面,实现用户的登录注册功能,连接数据库需改动一下conn.php里面的链接参数

Dyeing。

Error creating bean with name 'eurekaAutoServiceRegistration': Singleton bean creation not 的解决办法

问题概述 在项目中使用 Spring Boot + Spring Cloud 进行开发的,在集成Eureka注册中心时报错,项目启动不起来,“Error creating bean with name 'eurekaAutoServiceRegistration': Singleton bean creation not allowed while singletons of this f...

TechBro华仔

mysql ERROR 1044 (42000): Access denied for user ''@'localhost' to database

主要介绍了mysql下提示ERROR 1044 (42000): Access denied for user ''@'localhost' to database,需要的朋友可以参考下

weixin_38719540

IDEA使用学生邮箱无法注册问题:JetBrains Account connection error: 拒绝连接

主要介绍了IDEA使用学生邮箱无法注册问题:JetBrains Account connection error: 拒绝连接,文中通过图文及示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧

weixin_38695471

解决mysql创建数据库后出现:Access denied for user 'root'@'%' to database 'xxx'的问题

主要给大家介绍了如何解决mysql在创建数据库后出现:Access denied for user 'root'@'%' to database 'xxx'的错误提示,文中介绍的非常详细,需要的朋友可以参考借鉴,下面来一起看看吧。

weixin_38654220
评论 6
收藏 已收藏
分享
返回顶部
LizzieD
Web 开发 81,108 成员 341,720 内容