• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Issues with running the db

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not sure how to fix this. My error is

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'passengerController': Unsatisfied dependency expressed through field 'service'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'passengerService': Unsatisfied dependency expressed through field 'repo'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'passengerRepository': Cannot create inner bean '(inner bean)#7db4363b' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#7db4363b': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [ca/bechir/config/JpaConfig.class]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]

My passengerservice


My pom

 
Bartender
Posts: 2266
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Bechir,
Maybe, you need to specify what Java version is in your pom.xml:
For example, if you use Java 11.


Also, if you are using IntelliJ, select File -> Settings-> Build,Execution, Deployment -> Compiler -> Java Compiler. Make sure project bytecode version is set to your current version of Java, such as 11.
Select File-> Project Structure -> Project , select the right project SDK and right project language level, such as 11 in this case.
Under Platform Settings -> SDKs , make sure the right version of Java is selected.


If that still does not work, you can commit your code in github and show us.
 
Bechir Mihoub
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm using eclipse and I specified what version of java im using. Here is the github link to help you. https://github.com/typeveron/database-java
 
Himai Minh
Bartender
Posts: 2266
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Bechir
First of all, you need to rearrange your project structure. I am using intelliJ.
My new structure is:
src -> main -> java -> ca.bechir
resources -> META-INF ->persistence.xml
webapp-> WEB-INF ->views
You may need to mark webapp as web resource content as shown: https://www.jetbrains.com/help/idea/web-application-static-content.html
Also, right click on resources to mark the directory as root.

If you are using Eclipse, you may need to recreate the file structures as well.
You may want to use IntelliJ Ultimate free trial version.
projectStructure.JPG
[Thumbnail for projectStructure.JPG]
 
Himai Minh
Bartender
Posts: 2266
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bechir,
After you rearrange the project structure as shown in my previous post, you may need to fix WebApplicationInitializer:
 
Himai Minh
Bartender
Posts: 2266
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You may need to fix persistence.xml :
 
Himai Minh
Bartender
Posts: 2266
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Then, add this dependency in pom.xml
<dependency>
           <groupId>org.hibernate</groupId>
           <artifactId>hibernate-entitymanager</artifactId>
           <version>5.0.4.Final</version>
       </dependency>
 
Himai Minh
Bartender
Posts: 2266
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Bechir,
One more note.
Also, put a / in front of WEB-INF
 
Himai Minh
Bartender
Posts: 2266
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Bechir,
I need your help to fix the SQL statement:
Caused by: java.lang.IllegalArgumentException: The string <SELECT c FROM Passenger c WHERE c.name LIKE '%' || keyword || '%''OR c.email LIKE '%' || :keyword || '%'OR c.birthdate LIKE '%' || :keyword || '%'OR c.address LIKE '%' || :keyword || '%'OR c.family LIKE '%' || :keyword || '%'OR c.paymentCard LIKE '%' || :keyword || '%'> starts a quoted range at 268, but never ends it.
 
Himai Minh
Bartender
Posts: 2266
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Bechir,
For your reference, I attach my fixes in this post below.
Filename: database-java-master.zip
File size: 25 megabytes
 
Himai Minh
Bartender
Posts: 2266
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Bechir,
Your PassengerRepository may be like this:


Let me know how it goes.
 
Bechir Mihoub
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there any way to configure static content resources on eclipse?
 
Bechir Mihoub
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I also can't run your project on eclipse.
 
Himai Minh
Bartender
Posts: 2266
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can try to use IntelliJ Ultimate (free trial version).
In Eclipse, you may want to build a dynamic web project with the Web content.

I think for Eclipse, you need to install STS plugin to build any Spring framework project.
 
Bechir Mihoub
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not really able to rearrange the structure and have it be the same in eclipse. I did make a dynamic web project with maven in eclipse. I'm also confused as to mark web resource content I mean what do I mark with regards to the project?
 
Himai Minh
Bartender
Posts: 2266
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Bechir,
When you create a dynamic web project in Eclipse, do  you see the WebContent folder? If so, put your views folder inside that folder.
Packaging is important, otherwise the Spring framework container cannot find the components.
 
Bechir Mihoub
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah I have a web content folder with meta-inf and web-inf folders.
reply
    Bookmark Topic Watch Topic
  • New Topic