Currently, we are using Hibernate 2.0.1.
I have the following code:
Code:
import net.sf.hibernate.Criteria;
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.Session;
import net.sf.hibernate.SessionFactory;
import net.sf.hibernate.cfg.Configuration;
import net.sf.hibernate.expression.Expression;
import org.apache.log4j.Logger;
public class AirWaybillHib implements AirWaybillDao {
private static Logger logger = Logger.getLogger(AirWaybillHib.class);
private static Configuration cfg = null;
private static SessionFactory sessionFactory = null;
public AirWaybillHib() {
try {
if (cfg == null) {
cfg = new Configuration().addFile(new File("c:/APJava/AirWaybill.hbm.xml"));
sessionFactory = cfg.buildSessionFactory();
}
} catch (Exception e) {
logger.error("", e);
}
}
...
The problem is that I get the following exception when trying to instantiate the Configuration object. It has something to do with versions, I can not figure out what the problem is exactly.
Any help would be appreciated.
[28/05/04 11:24:57:431 CEST] 49fcf24e Environment I net.sf.hibernate.cfg.Environment Hibernate 2.0.1
[28/05/04 11:24:57:451 CEST] 49fcf24e Environment I net.sf.hibernate.cfg.Environment loaded properties from resource hibernate.properties: {hibernate.c3p0.timeout=0, hibernate.connection.driver_class=com.ibm.as400.access.AS400JDBCDriver, hibernate.cglib.use_reflection_optimizer=true, hibernate.c3p0.max_size=10, hibernate.dialect=net.sf.hibernate.dialect.DB2Dialect, hibernate.c3p0.validate=true, hibernate.c3p0.min_size=2, hibernate.connection.username=TESTAID, hibernate.connection.url=jdbc:as400://172.25.1.11;transaction isolation=none;naming=system;package=adr;extended dynamic=false;libraries=objasd;block size=32;block criteria=2;data compression=true;lazy close=true;date format=jis;, hibernate.connection.password=TESTAID, hibernate.connection.pool_size=5}
[28/05/04 11:24:57:461 CEST] 49fcf24e Environment I net.sf.hibernate.cfg.Environment using CGLIB reflection optimizer
[28/05/04 11:24:57:461 CEST] 49fcf24e Environment I net.sf.hibernate.cfg.Environment JVM proxy support: true
[28/05/04 11:24:59:414 CEST] 49fcf24e WebGroup E SRVE0026E: [Servlet Error]-[]:
java.lang.ExceptionInInitializerError: java.lang.SecurityException: Prohibited package name: java.util at java.lang.ClassLoader.defineClass(ClassLoader.java(Compiled Code))
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java(Compiled Code))
at java.net.URLClassLoader.defineClass(URLClassLoader.java(Compiled Code))
at java.net.URLClassLoader.access$400(URLClassLoader.java(Inlined Compiled Code))
at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java(Compiled Code))
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java(Inlined Compiled Code))
at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java(Compiled Code))
at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:43)
at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:39)
at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:255)
at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:255)
at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
at com.ibm.ws.classloader.ReloadableClassLoader.loadClass(ReloadableClassLoader.java:83)
at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:255)
at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
at java.lang.Class.forName1(Native Method)
at java.lang.Class.forName(Class.java(Compiled Code))
at net.sf.hibernate.cfg.Environment.<clinit>(Environment.java:465)
at net.sf.hibernate.cfg.Configuration.<init>(Configuration.java:84)
at aero.aviapartner.sla.AirWaybillHib.<init>(AirWaybillHib.java:31)
at aero.aviapartner.sla.AirWaybillFactory.getAirWaybillDao(AirWaybillFactory.java:27)
at aero.aviapartner.sla.CheckInputAction.execute(CheckInputAction.java:90)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:446)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:266)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:948)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:530)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:176)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:201)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:610)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:435)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)
Code: