Problem :
1. JPA Classes/entities are in Bundle 1 and Bundle 2 using same persistence unit
2. Bundle 3 is trying to access(wrapper APIs for DB API abstraction) the classes in Bundle 1 and Bundle 2.
3. Runtime enhancement is not working.
So what I am planning to do is to enhance the JPA entities using Code, where in just before the bundle 3 comes up, these entities in Bundle 1 could be enhanced.
I am planning doing this as the runtime enhancement does not complete and the bundle 3 comes up . This leads to DB APIs(Bundle 3 APIs) failure as tables are not created.
We had the same problem in a former project with openjpa and OSGi. Luckily, OpenJPA supports compile time enhancement which could be done via the openjpa maven plugin as described here: http://openjpa.apache.org/enhancement-with-maven.html
And there is also an eclipse maven connector which supports runtime-enhancement inside the IDE, which is really comfortable if you want to use remote deployment. http://openjpa-maven-connector.googlecode.com/svn/trunk/
Related
I encountered big trouble when trying to migration a web application from Java 8 to Java 11.
The web application:
The web application provides SOAP web services (using Spring WS), is written in Java 8 and runs on Tomcat 9. Spring 4.3 is used for database access, OXM, MVC and dependency injection.
To build the web services, multiple XSD files are used to auto-generate the class files and WSDL document for the web service interface using the xjc tool from the JDK.
My goal:
Migrate the application to Java 11, Tomcat 10 and JakartaEE.
What I have done so far:
In the first step, the compiled web application is migrated using Apache migration tool (version 1.0.0) to get it running on Tomcat 10. There is no problem.
Java migration:
The next step is, to migrate the source code from Java 8 to 11.
Java 11 does not longer include the tools and libraries for XML binding, which makes it necessary to include the XML bind library from JakartaEE.
Rebuilding the auto-generated class files from the XSD files with xjc, that comes with the library, creates source code, which imports from jakarta.xml.bind instead of javax.xml.bind. (Which should be the correct package).
Using JakartaEEs library also requires some minor changes in the code (changing imports to use jakarta.xml.bind instead of javax.xml.bind)
That's the point, where the trouble begins...
The IDE shows no errors and the code is compiled with no errors. Running the web application shows me the error, that javax.xml.bind.JAXBException was not found.
Since there is no source file, that refers to javax.xml.bind I assume, that a library is the cause. I found many references to that package in the Spring OXM library. But: In the master branch of that library, that these references are still there.
I tries to run JEE XML bind and JakartaEE XML bind at same time, but then Spring WS complains about multiple object factories of same type in same name space (which is not true by the way. Both object factories are generated by xjc for different name spaces and reside in different packages...)
My questions:
How can one use JakartaEE, when it is not supported by libraries like Spring?
Did I miss something?
Can someone give me some hints how to migrate the code?
Best regards,
Markus
I'm in the process of switching my Spring Boot + Vaadin application from Vaadin 14 in "Vaadin 13 compatibility mode" to "native Vaadin 14 mode". This is primarily because I want to use the Vaadin Gradle Plugin in order to be able to enable production mode. This also requires upgrading from Full Calendar web component to Full Calendar 4 web component, which now supports Vaadin 14+ and also wraps a newer version of FullCalendar. So lots of things needing to happen at the same time unfortunately.
The issue I'm now having, is that when the FullCalendar component is shown, I get this client-side error:
(ReferenceError) : moment is not defined
I see that the FullCalendar web component jar has these annotations on the FullCalendar class in the org.vaadin.stefan.fullcalendar package:
#NpmPackage(value = "moment", version = "2.24.0")
#NpmPackage(value = "moment-timezone", version = "0.5.28")
#NpmPackage(value = "#fullcalendar/moment", version = "4.4.0")
#NpmPackage(value = "#fullcalendar/moment-timezone", version = "4.4.0")
The reason that the first two are listed here is probably because they are defined as peer dependencies of the last two, so they are not installed automatically.
I also noticed that the FullCalendar 4 web component page mentions the following known issue:
Build problems / JS (client side) errors (V14+)
It might be, that the transitive dependencies are not resolved correctly.
If you are using Spring Boot please add the #EnableVaadin annotation to your application class. Add the package org.vaadin.stefan plus your root package as parameters. This should enable Spring to analyze all npm dependencies at runtime. Other CDI version should work the same.
So I've added this annotation to my application class:
#SpringBootApplication
#EnableVaadin({"org.vaadin.stefan", "com.mypackage"})
public class MyApplication {
But this doesn't seem to work.
I've also tried running the gradle task vaadinBuildFrontend instead of just vaadinPrepareFrontend, but that didn't make a difference.
What else should I do to make sure moment is loaded and initialized properly?
UPDATE: if I explicitly enable vaadin.productionMode in build.gradle, then the error is gone. Of course, I want to be able to run the application in development mode as well.
UPDATE 2: I've experimented with creating a clean Vaadin + Spring Boot + Gradle project from the provided base project. I noticed one difference: in my own application I get a warning logged:
dev-updater : Couldn't find dev dependencies file. Dev dependencies won't be locked
... which I don't get in the clean project. I get the following logging lines there which I don't get in my own project:
dev-updater : Visited 88 classes. Took 16 ms.
dev-updater : Skipping `pnpm install` because the frontend packages are already installed...
dev-updater : Copying frontend resources from jar files ...
dev-updater : Visited 13 resources. Took 84 ms.```
UDPATE 3: I found out that the moment() function is actually called from code that is executed using calendar.getElement().executeJs(...). Apparently the function is not known in that scope. Maybe due to strict mode? Not sure if that explains why it works in production mode.
I haven't used gradle with V14, so I cannot tell for sure, if it is maybe a gradle related reason or a Vaadin / addon issue. I just can tell, that I at least tried to setup a new project last week with the addon and it worked out of the box, so I assume, there are some tricky details burried somewhere.
Let's start with some usual question:
I assume, you use V14.3.x?
Has the moments library been downloaded (see project root > node_modules/moment and ./moment-timezone)? If not, is it listed in the package.json file?
Have you encountered this problem also with the clean Vaadin project?
And, not that I ask you to use it instead, but just for test purposes - have you tried the same setup with maven instead of gradle?
How are you using the calendar in Java. Can you show some example code of the implementation?
I was able to work around the issue because moment was used to create a parseable date string, but (at least the current version of) the library supports the ISO format returned by LocalDate#toString.
As I suspected, due to strict mode, the variable is not declared in global scope and therefore can't be used in executeJs. If it is necessary to do so, one needs to create a javascript file that adds the variable to window, and import that file using #JsModule. Then the variable in the window object can be used from executeJs.
See https://vaadin.com/forum/thread/17832455/how-to-use-external-javascript-libraries-correct-in-vaadin-14-npm and https://vaadin.com/forum/thread/17753553/can-t-use-frontend-js-with-vaadin-14.
I have a clustered application architecture, where 3 of my primary services make use of a dependency artifact (lets call it commons) that contains the modal files and other utils used by other 3 services.
Presently, I have all the 3 spring boot applications deployed on k8s through Gitlab CI via artifactory for image management.
Now, each time I make changes to my commons service, I have to change the version of the commons in pom.xml(so that it doesn't conflict with the previous artifactory image) and also change the pom versions of my other 3 services that depend on this new version and push all the 4 (first push commons so that the new build image is available in artifactory, and then the other 3) services.
Is there a better way to manage this. I would have preferred if, my 3 services where able to fetch the latest common version and add it to my pom version
This is currently supported in Reliza Hub (disclaimer: I'm developing the project).
The workflow to get latest release is documented here (see workflow 2.Get Latest Release Of A Project Or Product).
Idea is the following:
you define project for your Shared Library and configure from GitLab CI to automatically stream build metadata to Reliza Hub on every build using Reliza Client.
Automatic versioning can also be maintained via Reliza Hub (meaning that Hub would increment versions for you on every build based on your chosen versioning schema) - you need to use getversion command of Reliza Client for that.
You can then use this automatic version increments to update version in your pom.xml at build time. So this process will be fully automated.
Once that is done, in your CI pipelines for each of the 3 dependent services, you include call to Reliza Hub using getlatestrelease command of Reliza Client for your shared library. This call will return you back all metadata for the latest release of shared library, including its version.
You can then plug this version into pom files of your dependent services.
Hope this helps.
I am quite new to Spring, now trying out Roo. I am following documentation from http://docs.spring.io/spring-roo/docs/2.0.0.M1/reference/html/
I was able to create the entity classes and fields, perform tests as well. Now when I run
roo> web mvc setup
it creates a few files in \config, \validatin, \html\converter but then produces undo create ... for the same files & folders. At the end it says
ERROR: GlobalSearch.java class doesn't exists or has been deleted.
I am running Windows 10 64 bit, STS 3.8 Release, Roo 2.0.0.M2, Maven 3.3.9, Jdk 1.8
Googling this as well as searching in StackOverflow gave just one slightly relevant result without resolution Spring Roo: 'web mvc setup' fails with 'display name required'.
In fact I have been facing many issues, each step of the way and googling my way through, so it has been a very painful experience so far, so any help is greatly appreciated.
I was using a separately downloaded roo (v 2)for this.
Alternatively I used STS and added roo (v 1.3.1RC1) extension thru Help>Dashboard and opened roo console in STS (Window>Show view>Roo shell), was able to run the commands for mvc web setup and mvc web all --package ~.web and generate required files!
But don't know why the separate roo console wouldn't work.
Thanks for all who viewed and tried to help.
First you need to create DAO layer:
repository jpa --all --package ~.repository
This will generate GlobalSearch.java in repository package.
How to combine 3 standalone applications on java and run parallely with maven in spring.
The three othe standalone applications run on different Db's and I want to make use of these three in my main Standalone app.
What are the required maven settings i need to follow and what are the best spring components i used.
Any kind of answer is appresiable.
Thanks in Advance.
About Maven.
I recomend you to use a Repository Manager (Nexus, Artifactory...). In that repository, you can upload manually your aplications as a jar (I assumed that these three app are not build with Maven, but it could be interesant to migrate them, you should evaluate that).
You have to configure your new app pom.xml and settings.xml to get access to this repository. And then, you can add these dependencies in your new app pom.xml. After that, you can use your applications classes in your new app.
About Spring
Spring Framework, has a lot of things that could help you in your development (like dependency injection, jdbcTemplate and a large etc)
I really recommend you to read the documentation (with the index you can get an idea), and evaluate what things could help you.