package myJsp;
import java.sql.*;
import javax.sql.*;
import javax.ejb.*;
import javax.naming.*;
public class A implements SessionBean {
private static final long serialVersionUID = 1L;
public void ejbCreate() throws CreateException {
ctx = new InitialContext();
ds = (DataSource)ctx.lookup("jdbc/fastCoffeeDB");
}
public void ejbActivate() {
}
public void ejbPassivate() {
}
public void ejbRemove() {
}
public void setSessionContext(SessionContext ctx) {
}
public void updatePrice(float price, String cofName,
String username, String password) throws SQLException {
Connection con;
PreparedStatement pstmt;
try {
con = ds.getConnection(username, password);
con.setAutoCommit(false);
System.out.println("connection successful");
con.commit();
} finally {
if (con != null) con.close();
}
}
private DataSource ds = null;
private Context ctx = null;
}
我添加了javaee.jar文件并尝试为我的项目创建jndi接口。
ds = (DataSource)ctx.lookup("jdbc/fastCoffeeDB");
------The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files.
这是什么意思?