• Post Reply Bookmark Topic Watch Topic
  • New Topic

JPA seems to crash  RSS feed

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi, I wasn't sure which forum to select, I hope this one fits?

I try to establish a database connection using JPA. My Bean's method looks like this:



Unfortunately it crashes somewhere in the code. I wasn't able to start TomEE in debug mode yet, so I can't step through it. Also I have no real logging yet, still trying to get all the foundation together. Anyone an idea what it could be? If I use only "Contact" instead of "sa.Contact" it doesn't make a difference...

My entity manager is injected:



And the persistence.xml looks like this:



Any ideas for me?

Thanks a lot,
Stephan
 
Rancher
Posts: 3456
39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If it crashes is there a stack trace?
 
Stephan Wöbbeking
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Dave Tolls wrote:If it crashes is there a stack trace?



Couldn't find one yet... As far as I know there is none in the server log. So I have to establish log4j first, than maybe I can see some exception logging...

Next thing is, that I wanted to debug using Eclipse, but I get a weird error message from the log / exception. I can post tomorrow, but google didn't help me yet...

Is there anyone who could imagine giving a hand in installation and configuration? I mean, I can't hire someone formally for a job as this is just hobby - ashame I am computer scientist myself, but the configuration really drives me nuts. So for a pocket money, some student who is deep in the topic anyway and could be happy to get some bucks this way...?

Stephan
 
Stephan Wöbbeking
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, just one step down the line... Yes, I found an exception in the "localhost" log...



There is more, but I think that's clear... But therer IS a contact table...



Ok, german doesn't matter, I think anyone can see there is some sample data... Alright, this is my dependency injection for the entity manager:



This is the persistence.xml:



And then there is the tomee.xml which I think relates to the "samples" data source. But that's something I am really unsure about if my expectations are correct?



Why is JPA not finding the table???

Stephan
 
Sheriff
Posts: 21313
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It could be missing rights (grants) to the table, or a schema mismatch. The table's schema is app, but the user is sa. Can you try explicitly setting the schema using @Table(name = "Contact", schema = "app") on the entity class?
 
Dave Tolls
Rancher
Posts: 3456
39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That would be my initial guess as well.
The query that works is using app, but your query is using sa.
 
Stephan Wöbbeking
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Well spotted! Even it didn't help. Haven't mentioned it, but I have changed the query in the program a lot. Tried "Contact", "sa.Contact" and "app.Contact" over and over again...

Have added the Table annotation now. The exception stays:



So at least it proves that the Table annotation is applied, but still the table isn't found.

By the way: To make it work I have created sample tables for all users/schemas. So "Contact", "sa.Contact" and "app.Contact" works in ij all the same without problem...



More ideas?
 
Stephan Wöbbeking
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

In the meanwhile there is an exception that shows up in the catalina log. I think it wasn't there before, hmmmm:



What puzzles me, is the second line, null.openJPA.Runtime seems odd, even there is no grumbling about...?
 
Stephan Wöbbeking
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Following the hint from another thread, I added this to the constructor of the class, where the EntityManager is injected:



The result is an exception while starting TomEE:



Will keep you updated, but when someone still has a hint?

Stephan
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!