facebook

Error in Hibernate Tutorial Practise [Closed]

  1. MyEclipse Archived
  2.  > 
  3. Documentation
Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
    Posts
  • #222770 Reply

    sims_vision
    Member

    Hello,

    I practised the Sample Tutorial on Hibernate using Myeclipse; after observing all the rules and ran the test applcation i got the following error in the console window:

    og4j:WARN No appenders could be found for logger (net.sf.hibernate.cfg.Environment).
    log4j:WARN Please initialize the log4j system properly.
    %%%% Error Creating SessionFactory %%%%
    net.sf.hibernate.HibernateException: JDBC Driver class not found: com.mysql.jdbc.Driver
    at net.sf.hibernate.connection.DriverManagerConnectionProvider.configure(DriverManagerConnectionProvider.java:63)
    at net.sf.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:83)
    at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:76)
    at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1160)
    at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:794)
    at com.genuitec.hibernate.SessionManager.currentSession(SessionManager.java:49)
    at com.genuitec.hibernate.HibernateTest.main(HibernateTest.java:14)
    java.lang.NullPointerException
    at com.genuitec.hibernate.SessionManager.currentSession(SessionManager.java:56)
    at com.genuitec.hibernate.HibernateTest.main(HibernateTest.java:14)

    Please can somebody explain 2 be what could have caused the problem.

    Thank you.

    Sims Vision

    #222776 Reply

    Riyad Kalla
    Member

    Sims,

    net.sf.hibernate.HibernateException: JDBC Driver class not found: com.mysql.jdbc.Driver

    The MySQL driver you are using needs to be in your /common/lib directory under Tomcat (or equivalent /lib directory for whatever app server you are using).

    #223529 Reply

    sims_vision
    Member

    Hello,

    Thanks 4 yr assistance; i implemented yr advise and it works.

    Bravo!

    Sims Vision

    #248215 Reply

    naveenkilaru
    Member

    log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
    log4j:WARN Please initialize the log4j system properly.
    java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
    at java.lang.Class.getConstructor0(Unknown Source)
    at java.lang.Class.newInstance0(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
    at org.hibernate.cfg.SettingsFactory.createCacheProvider(SettingsFactory.java:323)
    at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:219)
    at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1463)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1004)
    at com.genuitec.hibernate.SessionManager.currentSession(SessionManager.java:54)
    at com.genuitec.hibernate.bonus.HibernateTest.main(HibernateTest.java:35)
    Exception in thread “main”

    #248265 Reply

    Riyad Kalla
    Member

    Navigate to your Libraries settings for your project, click Add Library then MyEclipse Libraries and add the “Hibernate Advanced Libraries”.

    #264477 Reply

    Can you please list the required libraries. The complete list. Or where can I find it.

    #264478 Reply

    Riyad Kalla
    Member

    There are only 2 user libraries for Hibernate 3.1 in MyEclipse. The Core libraries and Advanced. Most folks only ever need the core libraries, but if you find yourself writing code that is giving you “ClassNotFoundExceptions” or autocomplete cannot provide an import for the class you need, you may need the advanced libraries as well.

    #265367 Reply

    I have similar problem. The following is the error message on the console:

    java.rmi.ServerError: Unexpected Error; nested exception is:
    java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException
    org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:434)
    org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:209)
    org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
    org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
    org.jboss.ejb.Container.invoke(Container.java:954)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:585)
    org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
    org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
    org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
    org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
    org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
    org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:206)
    org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:192)
    org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
    org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
    org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:112)
    org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
    $Proxy55.search(Unknown Source)
    com.cgi.struts.action.EmployeeSearchAction.execute(EmployeeSearchAction.java:80)
    org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.

    This is the error message after I added those 2 jar files.

    Could this has anything to do with the way I created those DAO classes?

    What is that “$proxy55”?

    I am using struts. In the action class, I used a session bean which has a method called “search”. And this “search” method will call a DAO’s method which has this code:

    public List findByProperties(String queryString) {
    try {
    Query queryObject = getSession().createQuery(queryString);
    return queryObject.list();
    } catch (RuntimeException re) {
    throw re;
    }
    }

    where queryString is something like this “from mytable where id=1” or something else clauses.

    I couldn’t figure out where it is wrong. Please help!

    Thanks a lot!

    X.Chen

    #265391 Reply

    Riyad Kalla
    Member

    X. Chen,
    You are missing the ehcache JAR from your project. Check your project’s build path, and expand the hibernate libraries in the build patha nd make sure you see ehcache somewhere in there.

    #265397 Reply

    Thanks very much for your prompt reply. I just checked the build path, and the ‘ehchache-1.1.jar’ is there.

    When I debug the code, I found that when I come to the point to get the ‘Session’ (this code was generated by IDE), I was trapped in some invokers. It seems that the ‘Session’ was not created correctly.

    Thanks.

    #265399 Reply

    I also download the ‘ehchache-1.2.4.jar’ and added into the ‘external jar’, it still does not work.

    #265406 Reply

    Riyad Kalla
    Member

    xchen,
    If you post the *entire* stack trace, is there a null pointer in there somewhere? I wonder if the problem is actually your configuration and the session is failing, which causes everything else to fail?

    #265437 Reply

    I tried something from a tutorial. The ‘hibernate.cfg.xml’ is like this:

    <?xml version=’1.0′ encoding=’UTF-8′?>
    <!DOCTYPE hibernate-configuration PUBLIC
    “-//Hibernate/Hibernate Configuration DTD 3.0//EN”
    http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd”&gt;

    <!– Generated by MyEclipse Hibernate Tools. –>
    <hibernate-configuration>

    <session-factory>
    <property name=”connection.username”>ahc</property>
    <property name=”connection.url”>
    jdbc:mysql://localhost/employees
    </property>
    <property name=”dialect”>
    org.hibernate.dialect.MySQLDialect
    </property>
    <!–
    <property name=”myeclipse.connection.profile”>
    Employees Connection
    </property>
    –>
    <property name=”connection.password”>ahc</property>
    <property name=”connection.driver_class”>
    com.mysql.jdbc.Driver
    </property>
    <property name=”transaction.factory_class”>org.hibernate.transaction.JDBCTransactionFactory</property>
    <!– thread is the short name for
    org.hibernate.context.ThreadLocalSessionContext
    and let Hibernate bind the session automatically to the thread
    –>
    <property name=”current_session_context_class”>thread</property>

    <mapping resource=”com/cgi/search/hibernate/Employee.hbm.xml” />

    </session-factory>

    </hibernate-configuration>

    The message I got still looks similar:

    ======= JBoss launching message =====

    2:43:04,796 INFO [Server] Starting JBoss (MX MicroKernel)…
    22:43:04,796 INFO [Server] Release ID: JBoss [Zion] 4.0.4.GA (build: CVSTag=JBoss_4_0_4_GA date=200605151000)
    22:43:04,796 INFO [Server] Home Dir: E:\applications\jboss
    22:43:04,796 INFO [Server] Home URL: file:/E:/applications/jboss/
    22:43:04,796 INFO [Server] Patch URL: null
    22:43:04,796 INFO [Server] Server Name: default
    22:43:04,796 INFO [Server] Server Home Dir: E:\applications\jboss\server\default
    22:43:04,796 INFO [Server] Server Home URL: file:/E:/applications/jboss/server/default/
    22:43:04,796 INFO [Server] Server Log Dir: E:\applications\jboss\server\default\log
    22:43:04,796 INFO [Server] Server Temp Dir: E:\applications\jboss\server\default\tmp
    22:43:04,796 INFO [Server] Root Deployment Filename: jboss-service.xml
    22:43:05,140 INFO [ServerInfo] Java version: 1.5.0_09,Sun Microsystems Inc.
    22:43:05,140 INFO [ServerInfo] Java VM: Java HotSpot(TM) Client VM 1.5.0_09-b03,Sun Microsystems Inc.
    22:43:05,140 INFO [ServerInfo] OS-System: Windows XP 5.1,x86
    22:43:05,953 INFO [Server] Core system initialized
    22:43:25,093 INFO [WebService] Using RMI server codebase: http://AGDC1403:8083/
    22:43:25,140 INFO [Log4jService$URLWatchTimerTask] Configuring from URL: resource:log4j.xml
    22:43:25,421 INFO [NamingService] JNDI bootstrap JNP=/0.0.0.0:1099, RMI=/0.0.0.0:1098, backlog=50, no client SocketFactory, Server SocketFactory=class org.jboss.net.sockets.DefaultSocketFactory
    22:43:46,031 INFO [Embedded] Catalina naming disabled
    22:43:46,125 INFO [ClusterRuleSetFactory] Unable to find a cluster rule set in the classpath. Will load the default rule set.
    22:43:46,125 INFO [ClusterRuleSetFactory] Unable to find a cluster rule set in the classpath. Will load the default rule set.
    22:43:46,593 INFO [Http11BaseProtocol] Initializing Coyote HTTP/1.1 on http-0.0.0.0-8080
    22:43:46,609 INFO [Catalina] Initialization processed in 484 ms
    22:43:46,609 INFO [StandardService] Starting service jboss.web
    22:43:46,609 INFO [StandardEngine] Starting Servlet Engine: Apache Tomcat/5.5.17
    22:43:46,671 INFO [StandardHost] XML validation disabled
    22:43:46,734 INFO [Catalina] Server startup in 125 ms
    22:43:46,937 INFO [TomcatDeployer] deploy, ctxPath=/invoker, warUrl=…/deploy/http-invoker.sar/invoker.war/
    22:43:47,375 INFO [WebappLoader] Dual registration of jndi stream handler: factory already defined
    22:43:48,203 INFO [TomcatDeployer] deploy, ctxPath=/, warUrl=…/deploy/jbossweb-tomcat55.sar/ROOT.war/
    22:43:52,812 INFO [TomcatDeployer] deploy, ctxPath=/jbossws, warUrl=…/tmp/deploy/tmp6003jbossws-exp.war/
    22:43:53,109 INFO [SubscriptionManager] Bound event dispatcher to java:/EventDispatcher
    22:43:53,390 INFO [TomcatDeployer] deploy, ctxPath=/jbossmq-httpil, warUrl=…/deploy/jms/jbossmq-httpil.sar/jbossmq-httpil.war/
    22:44:00,140 INFO [TomcatDeployer] deploy, ctxPath=/web-console, warUrl=…/deploy/management/console-mgr.sar/web-console.war/
    22:44:01,515 INFO [MailService] Mail Service bound to java:/Mail
    22:44:01,984 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in …/deploy/jboss-ha-local-jdbc.rar
    22:44:02,140 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in …/deploy/jboss-ha-xa-jdbc.rar
    22:44:02,265 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in …/deploy/jboss-local-jdbc.rar
    22:44:02,406 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in …/deploy/jboss-xa-jdbc.rar
    22:44:02,765 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in …/deploy/jms/jms-ra.rar
    22:44:02,906 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in …/deploy/mail-ra.rar
    22:44:04,125 INFO [ConnectionFactoryBindingService] Bound ConnectionManager ‘jboss.jca:service=DataSourceBinding,name=DefaultDS’ to JNDI name ‘java:DefaultDS’
    22:44:04,468 INFO [A] Bound to JNDI name: queue/A
    22:44:04,468 INFO Bound to JNDI name: queue/B
    22:44:04,468 INFO [C] Bound to JNDI name: queue/C
    22:44:04,468 INFO [D] Bound to JNDI name: queue/D
    22:44:04,468 INFO [ex] Bound to JNDI name: queue/ex
    22:44:04,515 INFO [testTopic] Bound to JNDI name: topic/testTopic
    22:44:04,515 INFO [securedTopic] Bound to JNDI name: topic/securedTopic
    22:44:04,515 INFO [testDurableTopic] Bound to JNDI name: topic/testDurableTopic
    22:44:04,515 INFO [testQueue] Bound to JNDI name: queue/testQueue
    22:44:04,578 INFO [UILServerILService] JBossMQ UIL service available at : /0.0.0.0:8093
    22:44:04,640 INFO [DLQ] Bound to JNDI name: queue/DLQ
    22:44:04,906 INFO [ConnectionFactoryBindingService] Bound ConnectionManager ‘jboss.jca:service=ConnectionFactoryBinding,name=JmsXA’ to JNDI name ‘java:JmsXA’
    22:44:05,046 INFO [ConnectionFactoryBindingService] Bound ConnectionManager ‘jboss.jca:service=DataSourceBinding,name=employeeDS’ to JNDI name ‘java:employeeDS’
    22:44:05,406 INFO [EjbModule] Deploying EmployeeSearchSSB
    22:44:05,640 INFO [ProxyFactory] Bound EJB Home ‘EmployeeSearchSSB’ to jndi ‘ejb/EmployeeSearchSSB’
    22:44:05,640 INFO [EJBDeployer] Deployed: file:/E:/applications/jboss/server/default/deploy/EmployeeSearchFacade.jar/
    22:44:07,843 INFO [TomcatDeployer] deploy, ctxPath=/EmployeeSearch, warUrl=…/deploy/EmployeeSearch.war/
    22:44:08,171 INFO [PropertyMessageResources] Initializing, config=’org.apache.struts.util.LocalStrings’, returnNull=true
    22:44:08,171 INFO [PropertyMessageResources] Initializing, config=’org.apache.struts.action.ActionResources’, returnNull=true
    22:44:08,500 INFO [PropertyMessageResources] Initializing, config=’com.cgi.struts.ApplicationResources’, returnNull=true
    22:44:18,953 INFO [TomcatDeployer] deploy, ctxPath=/LibraryWeb, warUrl=…/deploy/LibraryWeb.war/
    22:44:19,031 INFO [WebappClassLoader] validateJarFile(E:\applications\jboss\server\default\.\deploy\LibraryWeb.war\WEB-INF\lib\javax.servlet.jar) – jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
    22:44:19,218 INFO [PropertyMessageResources] Initializing, config=’org.apache.struts.util.LocalStrings’, returnNull=true
    22:44:19,218 INFO [PropertyMessageResources] Initializing, config=’org.apache.struts.action.ActionResources’, returnNull=true
    22:44:19,546 INFO [PropertyMessageResources] Initializing, config=’de.laliluna.tutorial.library.struts.ApplicationResources’, returnNull=true
    22:44:19,671 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=…/deploy/jmx-console.war/
    22:44:20,109 INFO [Http11BaseProtocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-8080
    22:44:20,312 INFO [ChannelSocket] JK: ajp13 listening on /0.0.0.0:8009
    22:44:20,328 INFO [JkMain] Jk running ID=0 time=0/47 config=null
    22:44:20,343 INFO [Server] JBoss (MX MicroKernel) [4.0.4.GA (build: CVSTag=JBoss_4_0_4_GA date=200605151000)] Started in 1m:15s:547ms

    ======= message when debugging my application =====

    23:06:30,171 INFO [Server] JBoss (MX MicroKernel) [4.0.4.GA (build: CVSTag=JBoss_4_0_4_GA date=200605151000)] Started in 1m:28s:250ms
    23:08:54,718 INFO [PropertyMessageResources] Initializing, config=’org.apache.struts.taglib.html.LocalStrings’, returnNull=true
    23:08:54,718 INFO [PropertyMessageResources] Initializing, config=’org.apache.struts.util.LocalStrings’, returnNull=true
    23:08:54,718 INFO [PropertyMessageResources] Initializing, config=’org.apache.struts.taglib.html.LocalStrings’, returnNull=true
    23:08:54,718 INFO [PropertyMessageResources] Initializing, config=’org.apache.struts.taglib.html.LocalStrings’, returnNull=true
    23:08:54,734 INFO [PropertyMessageResources] Initializing, config=’org.apache.struts.taglib.html.LocalStrings’, returnNull=true
    23:08:54,750 INFO [PropertyMessageResources] Initializing, config=’org.apache.struts.taglib.html.LocalStrings’, returnNull=true
    23:08:54,750 INFO [PropertyMessageResources] Initializing, config=’org.apache.struts.taglib.html.LocalStrings’, returnNull=true
    23:11:55,093 INFO [Environment] Hibernate 3.2 cr2
    23:11:55,250 INFO [Environment] hibernate.properties not found
    23:11:55,281 INFO [Environment] Bytecode provider name : cglib
    23:11:55,437 INFO [Environment] using JDK 1.4 java.sql.Timestamp handling
    23:15:13,375 WARN [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=AGDC1403/15, BranchQual=, localId=15] timed out. status=STATUS_ACTIVE
    23:18:11,640 INFO [Configuration] configuring from resource: /hibernate.cfg.xml
    23:18:11,640 INFO [Configuration] Configuration resource: /hibernate.cfg.xml
    23:18:11,687 INFO [Configuration] Reading mappings from resource: com/cgi/search/hibernate/Employee.hbm.xml
    23:18:12,093 INFO [HbmBinder] Mapping class: com.cgi.search.hibernate.Employee -> employee
    [b]23:18:12,171 INFO [Configuration] Configured SessionFactory: null

    23:21:55,812 INFO [DriverManagerConnectionProvider] Using Hibernate built-in connection pool (not for production use!)
    23:21:55,812 INFO [DriverManagerConnectionProvider] Hibernate connection pool size: 20
    23:21:55,812 INFO [DriverManagerConnectionProvider] autocommit mode: false
    23:21:55,828 INFO [DriverManagerConnectionProvider] using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost/employees
    23:21:55,828 INFO [DriverManagerConnectionProvider] connection properties: {user=ahc, password=ahc}
    23:21:56,281 INFO [SettingsFactory] RDBMS: MySQL, version: 5.0.27-community-nt
    23:21:56,281 INFO [SettingsFactory] JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.0.3 ( $Date: 2006-07-26 17:26:47 +0200 (Wed, 26 Jul 2006) $, $Revision: 5553 $ )
    23:21:56,390 INFO [Dialect] Using dialect: org.hibernate.dialect.MySQLDialect
    23:21:56,406 INFO [TransactionFactoryFactory] Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory
    23:21:56,421 INFO [TransactionManagerLookupFactory] No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
    23:21:56,421 INFO [SettingsFactory] Automatic flush during beforeCompletion(): disabled
    23:21:56,421 INFO [SettingsFactory] Automatic session close at end of transaction: disabled
    23:21:56,421 INFO [SettingsFactory] JDBC batch size: 15
    23:21:56,421 INFO [SettingsFactory] JDBC batch updates for versioned data: disabled
    23:21:56,437 INFO [SettingsFactory] Scrollable result sets: enabled
    23:21:56,437 INFO [SettingsFactory] JDBC3 getGeneratedKeys(): enabled
    23:21:56,437 INFO [SettingsFactory] Connection release mode: auto
    23:21:56,437 INFO [SettingsFactory] Maximum outer join fetch depth: 2
    23:21:56,437 INFO [SettingsFactory] Default batch fetch size: 1
    23:21:56,437 INFO [SettingsFactory] Generate SQL with comments: disabled
    23:21:56,437 INFO [SettingsFactory] Order SQL updates by primary key: disabled
    23:21:56,437 INFO [SettingsFactory] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
    23:21:56,453 INFO [ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory
    23:21:56,453 INFO [SettingsFactory] Query language substitutions: {}
    23:21:56,453 INFO [SettingsFactory] Second-level cache: enabled
    23:21:56,453 INFO [SettingsFactory] Query cache: disabled
    23:21:56,453 INFO [SettingsFactory] Cache provider: org.hibernate.cache.EhCacheProvider
    23:22:11,937 INFO [DriverManagerConnectionProvider] cleaning up connection pool: jdbc:mysql://localhost/employees
    23:25:41,562 ERROR [LogInterceptor] Unexpected Error in method: public abstract java.util.List com.cgi.search.interfaces.EmployeeSearchSSB.searchEmployees(com.cgi.search.dto.EmployeeDTO) throws java.rmi.RemoteException
    java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
    at java.lang.Class.getConstructor0(Class.java:2671)
    at java.lang.Class.newInstance0(Class.java:321)
    at java.lang.Class.newInstance(Class.java:303)
    at org.hibernate.cfg.SettingsFactory.createCacheProvider(SettingsFactory.java:346)
    at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:220)
    at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1928)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1211)
    at com.cgi.search.hibernate.InitSessionFactory.initSessionFactory(InitSessionFactory.java:114)
    at com.cgi.search.hibernate.InitSessionFactory.getInstance(InitSessionFactory.java:60)
    at com.cgi.search.dao.EmployeeDAO.findByProperties(EmployeeDAO.java:26)
    at com.cgi.search.ejb.EmployeeSearchSSB.searchEmployees(EmployeeSearchSSB.java:166)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
    at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:237)
    at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)
    at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:169)
    at org.jboss.ws.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:64)
    at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
    at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
    at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
    at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
    at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
    at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
    at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
    at org.jboss.ejb.Container.invoke(Container.java:954)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
    at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
    at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:206)
    at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:192)
    at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
    at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
    at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:112)
    at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
    at $Proxy55.searchEmployees(Unknown Source)
    at com.cgi.struts.action.EmployeeSearchAction.execute(EmployeeSearchAction.java:78)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
    at java.lang.Thread.run(Thread.java:595)
    23:26:58,906 WARN [RequestProcessor] Unhandled Exception thrown: class java.rmi.ServerError
    23:27:03,312 WARN [[action]] Servlet.service() for servlet action threw exception
    java.rmi.ServerError: Unexpected Error; nested exception is:
    java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException
    at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:434)
    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:209)
    at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
    at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
    at org.jboss.ejb.Container.invoke(Container.java:954)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
    at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
    at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:206)
    at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:192)
    at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
    at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
    at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:112)
    at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
    at $Proxy55.searchEmployees(Unknown Source)
    at com.cgi.struts.action.EmployeeSearchAction.execute(EmployeeSearchAction.java:78)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
    at java.lang.Thread.run(Thread.java:595)
    Caused by: java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
    at java.lang.Class.getConstructor0(Class.java:2671)
    at java.lang.Class.newInstance0(Class.java:321)
    at java.lang.Class.newInstance(Class.java:303)
    at org.hibernate.cfg.SettingsFactory.createCacheProvider(SettingsFactory.java:346)
    at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:220)
    at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1928)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1211)
    at com.cgi.search.hibernate.InitSessionFactory.initSessionFactory(InitSessionFactory.java:114)
    at com.cgi.search.hibernate.InitSessionFactory.getInstance(InitSessionFactory.java:60)
    at com.cgi.search.dao.EmployeeDAO.findByProperties(EmployeeDAO.java:26)
    at com.cgi.search.ejb.EmployeeSearchSSB.searchEmployees(EmployeeSearchSSB.java:166)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
    at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:237)
    at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)
    at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:169)
    at org.jboss.ws.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:64)
    at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
    at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
    at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
    at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
    at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
    … 46 more

    It seems that the ‘Configured SessionFactory’ didn’t get built up???

    Also I am wondering if I have to enable the ‘Cache’? If so, how?

    Thanks!!!!

    #265460 Reply

    Riyad Kalla
    Member

    22:44:19,031 INFO [WebappClassLoader] validateJarFile(E:\applications\jboss\server\default\.\deploy\LibraryWeb.war\WEB-INF\lib\javax.servlet.jar) – jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class

    Well this is the first problem, you have your deployment setup to deploy your compile-time dependnecies that your app server provides. It looks like JBoss is pretty smart though and doesn’t load them up.

    The second part to fix is this:

    Caused by: java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException

    Check your deployed project. Drill down into your WEB-INF/lib directory and look to see if the ehcache JAR is getting deployed. If it is, open the JAR and drill down and find that class. This could be caused by 2 things. 1: The JAR is not getting deployed or 2: The JAR is corrupt.

    #265499 Reply

    Thank you very much! I think the solution is the second. I just found that after I put the ‘ehcache-1.2.4.jar’ in the JBoss deploy lib directory. My application seems ok. This is the same idea as the second solution you give here.

    Again, thank you for all efforts and time spent for my own issue. I do appreciate it!

    X.Chen

Viewing 15 posts - 1 through 15 (of 18 total)
Reply To: Error in Hibernate Tutorial Practise [Closed]

You must be logged in to post in the forum log in