Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

JSF page is not displaying the mysql records in primefaces datatable.

 
Ranch Hand
Posts: 453
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I am trying to display a primefaces datatable in the jsf page but nothing is displayed and no errors is displayed.
I don't have any idea how to resolve, appreciate any help.
My pom:

My bean class:

Class controller:

Class DAO:

xhtml file:

Thanks and best regards.
 
Saloon Keeper
Posts: 25455
178
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And you still have not included annotations.jar in your POM like I told you last time.
 
Cezar Apulchro
Ranch Hand
Posts: 453
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm receiving this error for all annotations that I get in mvnrepository.

Thnaks.
 
Tim Holloway
Saloon Keeper
Posts: 25455
178
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Cezar Apulchro
Ranch Hand
Posts: 453
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After include this dependency problem still the same.
 
Tim Holloway
Saloon Keeper
Posts: 25455
178
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Once again you complain that data is not displayed, but you do not show the template of the page that would display the data.

No one can help you without that.
 
Cezar Apulchro
Ranch Hand
Posts: 453
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't understand I sended in this contact my xhtml to show data is not this?
 
Tim Holloway
Saloon Keeper
Posts: 25455
178
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, the POM made it hard to see.

I don't see anything obvious, so I recommend that you set a breakpoint on the code and see what esp is getting set to.

Also this:


You should NEVER do this. If an Exception occurs, no one will be able to tell what it was. I get very angry with people who throw away exceptions without reporting them. Plus you're returning a null when JSF is expecting a List - even an empty List.

Something like this is better:


Finally, your previous attempt where you used @PostConstruct and an init() method works better. Reading the database in the "get" method is not only inefficient (JSF may call that method up to 6 times for a single page display). It also is unreliable if anyone changes the database between the get calls.
 
Cezar Apulchro
Ranch Hand
Posts: 453
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, the result of execution of my xhtml is "no record found". I have records in my mysql table and my dao to access the table work fine, I really can't see where is the error.
 
Cezar Apulchro
Ranch Hand
Posts: 453
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Happy new year for all.
 
Tim Holloway
Saloon Keeper
Posts: 25455
178
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Cezar Apulchro wrote:Hi, the result of execution of my xhtml is "no record found". I have records in my mysql table and my dao to access the table work fine, I really can't see where is the error.



All I can recommend is that you use a debugger and set a breakpoint in the code right after you read the data and see what it shows.

I'm working on a Primefaces project myself at the moment and all my table displays work fine. Unlike File Upload that has apparently a thousand ways to break and not error messages to say why.
 
Cezar Apulchro
Ranch Hand
Posts: 453
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, trying to solve this problem I created a new project to use hibernate, then I created HibernateUtil, hibernate.cfg.xml and Especialidades.hbm.xml this both in Source Packages and in src/main/resources/ META-INF/ persistence.xml. When executing the project the Tomcat open the browser whith my project and my welcome page, "http://localhost:8080/ClientsW2/" but when I initiate the phrase to inform the page that I need I am receiving "HTTP Status 500 -  internalserver error" this msg occurs i the first letter of address of page that you can see in the picture.

HibernateUtil:

hibernate.cfg.xml

persistence.xml

Hibernate mapping:

Hibernate DAO:

Controller:

Image:
Especialidades.jpg
[Thumbnail for Especialidades.jpg]
 
Tim Holloway
Saloon Keeper
Posts: 25455
178
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A "500" error means that there was an error in your application.

All those files you posted mean nothing to me, because the one thing you didn't post was the stack trace that explains what the error was and where it happened.

The only things I really need are the stack trace from the server log and the segment of code that the stack trace is referring to. Everything else is just a distraction.
 
Cezar Apulchro
Ranch Hand
Posts: 453
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This?
 
Cezar Apulchro
Ranch Hand
Posts: 453
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't have other information of the error only this.
 
Tim Holloway
Saloon Keeper
Posts: 25455
178
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's all I needed.


That tells me that you did not build a valid WAR in that directory.
 
Cezar Apulchro
Ranch Hand
Posts: 453
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had deleted this project many time ago and I don't know why he appear now in deploy of another project. Then I uninstall netbeans, do deleting all references of netbeans and install Apache Netbeans again but to solve this I had to search my pc with explorer to find the project deleted and delete your shortcut. Now half of problem is solved.
Log of execution:

But my problem of "no records found" still the same.
 
Tim Holloway
Saloon Keeper
Posts: 25455
178
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That brings us back to the original situation. You'll need to set a debugger breakpoint where you read the list (line 29 in the EspecialidadesHbDAO that you posted here) and see what Hibernate returns to you.
 
Cezar Apulchro
Ranch Hand
Posts: 453
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nothing is shown in breackpoints .
Breackpoints.jpg
Result of debug project.
Result of debug project.
 
Tim Holloway
Saloon Keeper
Posts: 25455
178
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you expect it to volunteer something? Use the debugger's variable Inspection function to see what the result was set to. Be sure to step ahead to the next instruction first, so that the query executes before you inspect.
 
Cezar Apulchro
Ranch Hand
Posts: 453
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, sorry by delay(internet provider problem "rain"), I don't know where I am wronging but all that I do in debug the result is the same i.e. no results is shown.
Debugger Console:

Tomcat log:

Debug set:
Debug1.jpg
[Thumbnail for Debug1.jpg]
 
Cezar Apulchro
Ranch Hand
Posts: 453
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Trying to solve my problem I created a simple class to test my persistence.xml and I am receiving error it means that EspecialidadesHbDAO is not accessing my db. Why I don't receiving this error when I execute my project in Netbeans?

Class to test:

Result of test:

 
Cezar Apulchro
Ranch Hand
Posts: 453
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Persistence file:
 
Tim Holloway
Saloon Keeper
Posts: 25455
178
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. You are using an Alpha release of Hibernate. Alpha-level code is not trustworthy and may not have all of its features working. Unless you are actually helping the Hibernate team to debug a new release of Hibernate, you should stick to Final releases. You have enough bugs of your own without trying to deal with their bugs as well.

2. The error message says that it doesn't like a <persistence> element on line 11 column 27 of the XML file. Your sample persistence.xml file does not have any such element. It has a <persistence> in line 2, column 1. Thus I must conclude that that is not the file that Hibernate is trying to process.
 
Cezar Apulchro
Ranch Hand
Posts: 453
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After change to hibernate-core 5.6.3.Final I receiving the error:

My hibernate.cfg.xml are located in src/main/resources
 
Tim Holloway
Saloon Keeper
Posts: 25455
178
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It said it could not find the persistence.xml file.
 
Cezar Apulchro
Ranch Hand
Posts: 453
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok i understand, my persistence.xml is located in src/main/resources/META-INF
 
Cezar Apulchro
Ranch Hand
Posts: 453
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Condition 1:
src/META-INF/persistence.xml

Condition2:
src/main/resources/META-INF/persistence.xml

For condition 1 and 2 result is:

Condition 3:
src/main/resources/persistence.xml
Result:

Now hibernate core is:
 
Tim Holloway
Saloon Keeper
Posts: 25455
178
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stack Trace wrote:
Caused by: org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 96; cvc-elt.1.a: Cannot find the declaration of element 'persistence'.



Here again it appears that you have an invalid persistence.xml file.
 
Cezar Apulchro
Ranch Hand
Posts: 453
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry.
persistence.xml:


Result of test:
 
Tim Holloway
Saloon Keeper
Posts: 25455
178
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is now purely a Hibernate problem, so I'm cross-linking to the ORM forum.
 
Cezar Apulchro
Ranch Hand
Posts: 453
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hy, any news?
 
Tim Holloway
Saloon Keeper
Posts: 25455
178
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


INFO: HHH000318: Could not find any META-INF/persistence.xml file in the classpath

 
Cezar Apulchro
Ranch Hand
Posts: 453
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
no news?
 
Hold that thought. Tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic