-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: ClassNotFoundException why?
PostPosted: Mon May 02, 2005 2:54 am 
Newbie

Joined: Mon May 02, 2005 2:48 am
Posts: 3
package net.sf.hibernate.examples.quickstart;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import org.hibernate.hql.ast.HqlToken;
import org.hibernate.*;


public class Servlet1 extends HttpServlet {
private static final String CONTENT_TYPE = "text/html; charset=GBK";

//Initialize global variables
public void init() throws ServletException {
}
//Process the HTTP Get request
public void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {

Session session = HibernateUtil.currentSession();

Transaction tx = session.beginTransaction();
/**
Cat princess = new Cat();
princess.setName("Princess");
princess.setSex('F');
princess.setWeight(7.4f);

session.save(princess);
tx.commit();
*/

response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head><title>Servlet1</title></head>");
out.println("<body bgcolor=\"#ffffff\">");
out.println("<p>The servlet has received a GET. This is the reply.</p>");

Query query = session.createQuery(
"select c from Cat as c where c.sex = :sex ");
query.setCharacter("sex", 'F');
for (Iterator it = query.iterate(); it.hasNext(); ) {
Cat cat = (Cat) it.next();
out.println("Female Cat: " + cat.getName());
}
tx.commit();

HibernateUtil.closeSession();

out.println("</body>");
out.println("</html>");
out.close();
}

//Clean up resources
public void destroy() {
}
}
-----------------------------------------------------------
[DEBUG] 2005-05-02 14:27:07 org.hibernate.impl.SessionImpl[ExecuteThread: '12' for queue: 'default'] - iterate: select c from Cat as c where c.sex = :sex
[DEBUG] 2005-05-02 14:27:07 org.hibernate.engine.QueryParameters[ExecuteThread: '12' for queue: 'default'] - named parameters: {sex=F}
CharScanner; panic: ClassNotFoundException: org.hibernate.hql.ast.HqlToken


Top
 Profile  
 
 Post subject: There was not such problem in hibnate2.1.8!
PostPosted: Mon May 02, 2005 3:54 am 
Newbie

Joined: Mon May 02, 2005 2:48 am
Posts: 3
There was not such problem in hibnate2.1.8!


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 02, 2005 4:52 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
FAQ!


Top
 Profile  
 
 Post subject: i have resolved this problem by:
PostPosted: Mon May 02, 2005 5:51 am 
Newbie

Joined: Mon May 02, 2005 2:48 am
Posts: 3
uncomment
"hibernate.query.factory_class=org.hibernate.hql.classic.ClassicQueryTranslatorFactory" in my hibernate property file!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.