Hi ,
I am new to Spring boot gradle Project .I am trying to run flyway migration with spring boot application. This is how I set dependencies in gradle,
First , I added the dependency as ,
org.springframework.boot:spring-boot-starter-web . this was sufficient to expose an end point .
Then I tried to add flyway dependency in gradle as , org.flywaydb:flyway-core:4.0 , it was neither throwing error nor running the migration scripts , until I have added the dependency org.springframework.boot:spring-boot-starter-data-jpa:1.3.5.RELEASE . After seeing to the pom.xml of data-jpa jar, I identified the dependencies for this jar has hibernate packages as well org.springframework.boot:spring-boot-starter-web. So I removed the first dependency jar added . But the service start up failed . My doubt is :
1) What is the necessity that JPA library should be added to run flyway scripts
2) If that org.springframework.boot:spring-boot-starter-web is a dependency for the jar org.springframework.boot:spring-boot-starter-data-jpa:1.3.5.RELEASE , why should I add that once more
Using Flyway naturally means dealing with a data source of some kind, otherwise what would be the point of adding a database migration library to your project?
When you add the Flyway dependency, by default Spring Boot will automatically autowire Flyway with its data source and invoke it on startup as per the documentation.
Thus the need for a JPA library.
Related
I'm trying to use JPA Buddy to generate changelogs from my entities.
In this answer I can see the Liquibase option:
https://stackoverflow.com/a/66516541/6047129
But in my IDE thats all I got:
I'm missing some gradle or liquibse configuration?
Ok, I had liquibase dependency declared as:
liquibaseRuntime 'org.liquibase:liquibase-core:4.11.0'
As JPA Buddy scans the project dependencies for possible integrations, I needed to change the liquibase dependency to:
implementation 'org.liquibase:liquibase-core:4.11.0'
I am trying to implement JPA using DataNucleus in an OSGI Environment (Apache ServiceMix). I am following the guide mentioned here - http://www.datanucleus.org/products/datanucleus/jpa/osgi.html (Section under Name "JPA and OSGi")
As per the documentation here I am using the DataNucleus JPA jar. So I have Deployed this Jar on ServiceMix as follows -
osgi:install mvn:org.datanucleus/datanucleus-jpa/2.1.7
osgi:start bundleId
As this jar export the persistence provider,I have correctly changed the provider in my persistence.xml file to be org.datanucleus.jpa.PersistenceProviderImpl (which is exported by the above bundle) rather than usual org.datanucleus.api.jpa.PersistenceProviderImpl which is in a normal J2EE JPA APP.
I also have the DataNucleus Core Bundle running on my ServiceMix, which was installed on my ServiceMix using the following -
osgi:install mvn:org.datanucleus/datanucleus-core/4.0.0-release
osgi:start bundleId
Please Note: I donot have the datanucleus-api-jpa bundle running on my ServiceMix, as per the documentation, the datanucleus-jpa bundle would export the necessary classes and hence datanucleus-api-jpa bundle would not be required.
At runtime, I am getting the following error Caused by: java.lang.ClassNotFoundException: org.datanucleus.PersistenceConfiguration not found by org.datanucleus.jpa [261]
What I have noticed is that the DataNucleus Core version 4.0.0-release does not have this class, but this class exists in all previous releases (3.2.15).
I cannot deploy DataNucleus Core Version 3.2.XX onto my ServiceMix, because I have other bundles using DataNucleus Core 4.0.0-release and having both is not an option because of Singleton Creation problems.
Please let me know, if you need me to post my code, I will do so.
Please help
Cheers,
Abhijit
In conclusion, you are using incorrect/invalid jars. "datanucleus-jpa" was removed back in v2 of DataNucleus. All recent versions using "datanucleus-api-jpa" (or "datanucleus-api-jdo" if using JDO). A simple download of the DataNucleus zip file for 4.0.x would show this very clearly.
I am trying to upgrade an old project from Spring 2.5.6 to Spring 3.1.0. The project is not built with Maven so I had to add the jars manually to the build path.
The application uses Eclipse RAP as well as Spring.
I added all the Spring 3.1 jars in my build path:
lib/org.springframework.aop-3.1.0.RELEASE.jar
lib/org.springframework.asm-3.1.0.RELEASE.jar
lib/org.springframework.aspects-3.1.0.RELEASE.jar
lib/org.springframework.beans-3.1.0.RELEASE.jar
lib/org.springframework.context-3.1.0.RELEASE.jar
lib/org.springframework.context.support-3.1.0.RELEASE.jar
lib/org.springframework.core-3.1.0.RELEASE.jar
lib/org.springframework.expression-3.1.0.RELEASE.jar
lib/org.springframework.instrument-3.1.0.RELEASE.jar
lib/org.springframework.instrument.tomcat-3.1.0.RELEASE.jar
lib/org.springframework.jdbc-3.1.0.RELEASE.jar
lib/org.springframework.jms-3.1.0.RELEASE.jar
lib/org.springframework.orm-3.1.0.RELEASE.jar
lib/org.springframework.oxm-3.1.0.RELEASE.jar
lib/org.springframework.test-3.1.0.RELEASE.jar
lib/org.springframework.transaction-3.1.0.RELEASE.jar
lib/org.springframework.web-3.1.0.RELEASE.jar
lib/org.springframework.web.portlet-3.1.0.RELEASE.jar
lib/org.springframework.web.servlet-3.1.0.RELEASE.jar
lib/org.springframework.web.struts-3.1.0.RELEASE.jar
and I also listed them in the MANIFEST.MF.
The project builds fine, but at runtime when trying to login it gives me the following error:
java.lang.NoClassDefFoundError: org/springframework/beans/factory/ListableBeanFactory
I looked in the beans jar and the class is definitely there. I also searched through the project and the class is not used explicitly anywhere.
What could cause this? Thank you in advance.
This class does not exist in Spring 3.1.0. See http://www.jarfinder.com/index.php/java/info/org.springframework.beans.factory.ListableBeanFactory
I'm trying to generate the metamodel definitions in Eclipse as documented on:
http://www.datanucleus.org/products/accessplatform/jpa/jpql_criteria.html
My project compiler level is set to 1.6 and the mentioned datanucleus jars are added to the factory path.
When the project builds I get the following error:
Errors occurred during the build.
Errors running builder 'Java Builder' on project 'X'.
Could not initialize class org.datanucleus.jpa.query.JPACriteriaProcessor
When using mvn compile the metamodel definitions are generated successfully, so it's probably related to Eclipse annnotation processing.
I'm using latest Spring Tool Suite 3.1.0.RELEASE based on Eclipse 4.2.1
Not put persistence-api.jar (or equivalent, such as Geronimo specs JPA2) in the Factory Path? Either way one of the deps is missing
While testing the application created in Getting Started With JPA in Spring 2.0 tutorial I am getting following error. I have created Maven Project in eclipse. Here is the part of the structure of the project
ecotraveler
src
main
java
com
enam
resources
config
applicationContext.xml
WebContent
META-INF
persistance.xml
While running test class I am getting No persistence units parsed from {classpath*:META-INF/persistence.xml}
Can anyone tell what could be the problem? It seems application is unable to find specified path. I double check that WebContet/META-INF is in eclipse build path.
You need to put the META-INF directory in you resources directory, not in the WebContent
You spelt "persistence.xml" wrong; it has no "a"