-->
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.  [ 24 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Resource not found...
PostPosted: Sun Apr 23, 2006 8:02 am 
Beginner
Beginner

Joined: Thu Apr 20, 2006 11:51 am
Posts: 44
Hibernate version: last

Hy
I've follow the hib. tools tutorial but I recive this error when I try to create a Sessionfactory with the hibernate console
http://i3.tinypic.com/w8vxhh.gif (screenshot link)
the console can't find the xml for mapping but I don't know why..
thanks for your response.
;)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 23, 2006 12:05 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
there seem to be issues with having src and classes in the root of the project.

use a seperate src and classes dir and it will/should work.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 23, 2006 12:44 pm 
Beginner
Beginner

Joined: Thu Apr 20, 2006 11:51 am
Posts: 44
what do you mean?
I don't understand..
I try to change something
http://i3.tinypic.com/w9cygy.gif
nothing goes well :(


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 23, 2006 2:25 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
is hibernate_xml in the classpath of the console configuraiton ?

if not, we can't find the resources that is within.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 23, 2006 2:57 pm 
Beginner
Beginner

Joined: Thu Apr 20, 2006 11:51 am
Posts: 44
thx max
I've added the hibernate_xml to the console classpath.
Now it can see the DB tables but still gives me a
<Sessionfactory error> http://i3.tinypic.com/w9jww1.gif
when I try to create a SessionFactory.
I try to do the same (add to the console classpath the src path) but I don't resolve the problem.
Do you know what's I do wrong.
thx for your response and your patient ;)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 23, 2006 3:03 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
...and now you need to add the directory where your build output is (which contains the classes)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 23, 2006 4:38 pm 
Beginner
Beginner

Joined: Thu Apr 20, 2006 11:51 am
Posts: 44
you say
/Hibernate_test/build/classes/com/example/persistence ?
I've already added it but the the tools can't still find the class..


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 24, 2006 1:21 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
that is not the root of the path (you should go read about how java classpath (or any path) works)

The root is /Hibernate_test/build/classes

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 25, 2006 12:03 pm 
Beginner
Beginner

Joined: Thu Apr 20, 2006 11:51 am
Posts: 44
Hello
thx so I've resolved with this classpath.
Now I try to do a HQL query like "from Studenti where matricola='100'"
The 'Hibernate Query Result' response me like
com.example.persistence.Studenti@10ef227
there's a method to view the data inside this results? where's it stored?
thx


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 25, 2006 3:46 pm 
Beginner
Beginner

Joined: Thu Apr 20, 2006 11:51 am
Posts: 44
Now I get a new exception " No CurrentSessionContext configured!"
I've these classes
---HIBERNATESERVLET--
public class HibernateServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {

public HibernateServlet() {
super();
}


protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("CIAO");

ToolStudente ts = new ToolStudente();

List studenti = ts.listaStudenti();


for (int i=0; i < studenti.size(); i++){
Studenti thestudent = (Studenti) studenti.get(i);
System.out.println("Studente: " + thestudent.getCognome() + thestudent.getNome()
+ " matricola: "+ thestudent.getMatricola());
}
}

---TOOL STUDENTE--
public class ToolStudente {

public List listaStudenti () {

Session session = HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
List result = session.createQuery("from Studenti").list();
session.getTransaction().commit();

return result;

}

}

--HIBERNATE UTIL--
public class HibernateUtil {

private static final SessionFactory sessionFactory;
static {
try {
// Create the SessionFactory from hibernate.cfg.xml
sessionFactory = new Configuration().configure().buildSessionFactory();
} catch (Throwable ex) {
// Make sure you log the exception, as it might be swallowed
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
}

public static SessionFactory getSessionFactory() {
return sessionFactory;
}

}


The tool works well.
When I try to do a List of Student from my servlet (List studenti = ts.listaStudenti()Wink
JBOSS gives me this error (I try wiith tomcat5.5 is the same)
---
21:31:23,390 ERROR [[HibernateServlet]] Servlet.service() for servlet HibernateServlet threw exception
org.hibernate.HibernateException: No CurrentSessionContext configured!
at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:506)
at com.hibernate.servlet.ToolStudente.listaStudenti(ToolStudente.java:26)
at com.hibernate.servlet.HibernateServlet.service(HibernateServlet.java:29)
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:81)
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.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
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:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
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)
---

Someone can help me?
thx alain


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 25, 2006 3:55 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
the properties view ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 25, 2006 3:56 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
your last question is a hibernate usage quesiton - best asked in the user forum.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 25, 2006 5:38 pm 
Beginner
Beginner

Joined: Thu Apr 20, 2006 11:51 am
Posts: 44
Hy max
I've posted the last question on the other forum section
For the first question I mean the properties of the resultset
as you can see in the screenshot
http://i3.tinypic.com/whgmj6.gif
I can see only the object resultset but not the data inside.
In netbeans I've seen the same data but near there's another window to see the data for each student (in this case)
I can't find the specific window in eclipse!? I try with the Basic->properties window but this isn't the correct window.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 25, 2006 6:03 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
what netbeans plugin are you using for executing hql queries ?

anyway - if the properties view is open it should show the structure of any selected object in the table.

the docs has screenshots of it works.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 25, 2006 6:04 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
what netbeans plugin are you using for executing hql queries ?

anyway - if the properties view is open it should show the structure of any selected object in the table.

the docs has screenshots of it.

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 24 posts ]  Go to page 1, 2  Next

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.