Hello.
Can someone explain what this InitialContext(): is looking for?
public JDBCSchoolofdbDAO() {
try {
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup(
ModelUtils.getResource("JavaCompEnv"));
dataSource = (DataSource) envCtx.lookup(
ModelUtils.getResource("DataSource"));
} catch (NamingException x) {
ModelUtils.log(x);
throw new InternalError(x.getMessage());
}
}
DAO=schoolAppModel.dao.JDBCSchoolofdbDAO
#/////////////////////////////////////////////////
# DAO=jsfdb.model.dao.JDBCSubscriberDAO
#/////////////////////////////////////////////////
JavaCompEnv=java:comp/env
DataSource=jdbc:mysql://localhost:3306/schoolofdb
user=root
password=xxxxxxxx
pr 16, 2010 8:12:31 AM model.ModelUtils log
SEVERE: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at model.dao.JDBCSchoolofdbDAO.<init>(JDBCSchoolofdbDAO.java:35)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at model.ModelUtils.getNewUserDAO(ModelUtils.java:49)
at view.LoginInfoBean.loginAction(LoginInfoBean.java:50)
at view.SchoolJDesktopPane.login(SchoolJDesktopPane.java:157)
at view.SchoolJDesktopPane.<init>(SchoolJDesktopPane.java:106)
at view.Main.createJDesktopPane(Main.java:35)
at view.Main.main(Main.java:30)
Exception in thread "main" java.lang.InternalError: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at model.dao.JDBCSchoolofdbDAO.<init>(JDBCSchoolofdbDAO.java:41)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)