JBoss中的Bank例子运行出错了?
abue 2004-10-28 11:31:23 AccountBean部分源码:
private void makeConnection() {
Debug.print("AccountBean makeConnection");
try {
InitialContext ic = new InitialContext();
System.out.println("Before calling lookup()");
DataSource ds = (DataSource) ic.lookup(CodedNames.BANK_DATABASE);
//BANK_DATABASE = "java:comp/env/jdbc/BankDB"
System.out.println("Before connecting");
con = ds.getConnection();
} catch(NamingException nex)
{
Debug.print("NamingException "+nex.getMessage());
} catch (Exception ex) {
throw new EJBException("Unable to connect to database. " +
ex.getMessage());
}
}
ejb-jar.xml部分内容:
<session>
<ejb-name>AccountControllerBean</ejb-name>
<home>com.sun.ebank.ejb.account.AccountControllerHome</home>
<remote>com.sun.ebank.ejb.account.AccountController</remote>
<ejb-class>com.sun.ebank.ejb.account.AccountControllerBean</ejb-class>
<session-type>Stateful</session-type>
<transaction-type>Bean</transaction-type>
<ejb-local-ref>
<ejb-ref-name>ejb/customer</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>com.sun.ebank.ejb.customer.CustomerHome</local-home>
<local>com.sun.ebank.ejb.customer.Customer</local>
<ejb-link>CustomerBean</ejb-link>
</ejb-local-ref>
<ejb-local-ref>
<ejb-ref-name>ejb/account</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>com.sun.ebank.ejb.account.AccountHome</local-home>
<local>com.sun.ebank.ejb.account.Account</local>
<ejb-link>AccountBean</ejb-link>
</ejb-local-ref>
<resource-ref>
<res-ref-name>jdbc/BankDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
<security-identity>
<use-caller-identity/>
</security-identity>
</session>
当输入用户名200密码j2ee时
异常发生
2004-10-28 10:36:04,500 INFO [STDOUT] Before calling lookup()
2004-10-28 10:36:04,500 INFO [STDOUT] Debug: NamingException Could not dereference object
2004-10-28 10:36:04,531 ERROR [org.jboss.ejb.plugins.LogInterceptor] EJBException in method: public abstract java.util.Collection com.sun.ebank.ejb.account.AccountHome.findByCustomerId(java.lang.String) throws javax.ejb.FinderException:
根据日志问题应该是出现在lookup上了,看了一下tomcat启动日志发现
2004-10-28 10:33:07,843 INFO [org.apache.catalina.startup.Embedded] Catalina naming disabled
2004-10-28 10:33:09,640 INFO [org.apache.catalina.core.StandardHost] XML validation disabled
和这有关系吗
有经验的朋友帮我看看 3u