ReflectionToStringBuilder errors in Maven Project - spring

Some of my Roo generated .aj files seem to be generating errors as below. I can see commons-lang3-3.1.jar in my Maven Dependencies. I have added this to my pom.xml
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.1</version>
</dependency>
Failed to execute goal
org.codehaus.mojo:aspectj-maven-plugin:1.2:compile (default) on
project AdminDirect-Model: Compiler errors : [ERROR] error at return
ReflectionToStringBuilder.toString(this,
ToStringStyle.SHORT_PREFIX_STYLE);
I have a multi-module project, and when in STS I try to do a right click and Update Project, I get another annoying error saying "Problems Encountered while setting project description"...although this is probably a separate issue.
As an aside if anyone knows of the correct workflow to create a multi-module spring roo, JSF, JPA application (Model and Web tier under a parent module) that would be greatly appreciated.

I deleted the .m2/repository folder contents and forced a fresh download using Maven Update Project and then forced a refresh of snapshots. Seems to work, jars must have been corrupt?
tomcat server fails to start the server and application in STS

Related

How to incorporate BIRT 4.9.0 into POM?

Scenario:
I am refactoring my application to work under java 17. Birt runtime 3.7.x is embedded in my application.
In updating to point to birt 4.9.0, I have updated my pom as follows:
<dependency>
<groupId>org.eclipse.birt</groupId>
<artifactId>birt-runtime</artifactId>
<version>4.9.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.eclipse.birt/birt-runtime-osgi -->
<dependency>
<groupId>org.eclipse.birt</groupId>
<artifactId>birt-runtime-osgi</artifactId>
<version>4.9.0</version>
</dependency>
When I build, I get the exception
org.eclipse.birt:birt-runtime:jar:4.9.0 was not found in https://repo1.maven.org/maven2 during a previous attempt
I have deleted and rebuilt my local .m2 directory.
When I dig around the maven repository I find the file at https://repo1.maven.org/maven2/org/eclipse/birt/birt-runtime/4.9.0/
This link (BiRT latest Runtime as one Maven Dependency for Eclipse) was resolved by manually downloading the file and pointing to a local copy. I'd prefer to avoid that, since Maven is all about avoiding that kind of scenario.
I suspect there's something in the maven path I am missing.
Thank you in advance.

BiRT latest Runtime as one Maven Dependency for Eclipse

I have a given eclipse maven project which builds to a jar. The pom has one major dependency of BiRT 4.8.0-202010080643 Runtime.
<dependency>
<groupId>com.customer.birt.runtime</groupId>
<artifactId>org.eclipse.birt.runtime</artifactId>
<version>4.8.0-202010080643</version>
</dependency>
So they pushed the artifact into their own nexus; thats why com.customer.birt.runtime.
I really don't know how the guy did that and which tools he used. Currently I want to update to BiRT 4.9. Replacing the above with the only available:
<dependency>
<groupId>org.eclipse.birt</groupId>
<artifactId>birt-runtime</artifactId>
<version>4.9.0</version>
<type>pom</type>
</dependency
does not go well. Both are totally different constellations from the same big project. How can I make use of the above maven dependency of 4.9 in my simple birt project? I'm building only a service for a desktop application that is hosted and run within an RCP application. I started to list the individual maven deps so that the java compiles which I succeeded to but I still have few unit tests that execute and render ReportEngine and fail because of missing Deps at runtime. This is because the ReportEngine is loading APIs at runtime..
I started to post here once I noticed that I will be declaring the separate deps in pom.xml blindly which is (even if the Unittests pass) very unreliable..
Thank you so much!
M.Abdu
My solution was currently as I put in the comments or yet simpler. I just uploaded manually the birt-runtime jar into nexus using my account within the customer and then put in my pom the exact same unique coordinates groupid:artifactid:version. Plus some other dependencies depending of what my unit tests are asking at runtime, e.g. eclipse.platform, emf.core, w3c, batik.css etc.
I am talking about executing the build using mvn clean verify and resulting a jar file
The jar you get from here
https://search.maven.org/remotecontent?filepath=org/eclipse/birt/birt-runtime/4.9.0/birt-runtime-4.9.0.zip
pom in my case:
<dependency>
<groupId>org.eclipse.birt</groupId>
<artifactId>runtime</artifactId>
<version>4.9.0-20220502</version>
</dependency>

Spring boot starter web project : eclipse not able to resolve annotations #RestController and #RequestMapping

I started to build spring boot project via following one of the online courses. When completed initial configuration and code, eclipse was not able to resolve #RestController and #RequestMapping annotations even though I have following in my POM file :
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.1.RELEASE</version>
</parent>
and in dependency section, I have:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
Eclipse will only be able to resolve these annotations if appropriate jar is in your 'maven dependecies' folder under 'project manager' in eclipse.
How did I troubleshoot this :
Step 1 :
first we need to know which jar file will be containing these annotation classses. Try to look up google to get hints and still better expand those jar files under 'maven dependecies' folder under 'project manager' in eclipse to see if they have similar package structure that is leading upto specific class.
In my case this time, while I was expanding jar files, 'spring-web-4.2.4.RELEASE.jar' failed to expand. Next I went to local .m2 folder to see if this file is properly downloaded.
Surprisingly, I could open the jar file and see the classes.
Step 2 :
I deleted the files under 'm2\repository\org\springframework\spring-web\4.2.4.RELEASE'
Step 3 :
Went back to eclipse > right click project > maven > update project
Step 4 :
select project and also select 'force update snapshot/releases' option and hit 'ok'
above should download files that you deleted again and it should now successfully expand under 'maven dependencies' in project explorer.
Post this my error was resolved as eclipse was able to find the classes.

NoClassDefFoundError when running local tests with only tenant-scp-neo included in POM

Motivated by this blog entry, I tried to implement multitenancy for our existing application on the classic SAP Neo SCP.
I added the dependency
<dependency>
<groupId>com.sap.cloud.s4hana.cloudplatform</groupId>
<artifactId>tenant-scp-neo</artifactId>
<version>1.9.5</version>
</dependency>
to my POM and accessed the tenant in a test program via
String tenantId = TenantAccessor.getCurrentTenant().getTenantId();
Then, I got this error
java.lang.NoClassDefFoundError: com/google/common/collect/Multiset
at com.sap.cloud.sdk.cloudplatform.monitoring.ExceptionMonitor.<init>(ExceptionMonitor.java:30) ~[core-1.9.5.jar:na]
at com.sap.cloud.sdk.cloudplatform.monitoring.ExceptionMonitor.<clinit>(ExceptionMonitor.java:28) ~[core-1.9.5.jar:na]
at com.sap.cloud.sdk.cloudplatform.logging.CloudLoggerFactory$CloudLogger.<init>(CloudLoggerFactory.java:67) ~[core-1.9.5.jar:na]
at com.sap.cloud.sdk.cloudplatform.logging.CloudLoggerFactory$CloudLogger.<init>(CloudLoggerFactory.java:47) ~[core-1.9.5.jar:na]
at com.sap.cloud.sdk.cloudplatform.logging.CloudLoggerFactory.getLogger(CloudLoggerFactory.java:19) ~[core-1.9.5.jar:na]
at com.sap.cloud.sdk.cloudplatform.tenant.ScpNeoTenantFacade.<clinit>(ScpNeoTenantFacade.java:21) ~[tenant-scp-neo-1.9.5.jar:na]
How can I solve this issue?
After some investigation, it seems that the issue was a corrupt guava jar file in the Maven repository (within the .m2 folder). Deleting the respective folders and having Maven download them again fixed the issue.

Maven Spring project not executing due to ClassNotFoundException

I'm working on a Spring/Maven tutorial to test splitting up Spring bean definitions between multiple files. My issue is that mvn -X -e exec:java shows build failure, but running as a Java application within STS shows the proper output.
My project is set up as com.jason.basicOne, with com.jason as the groupId and basicOne as the artifactId. The only compiler warning within STS is due to an imported class not being used.
Things I've done:
Used the <import /> tags to reference the secondary files, and enabled the usage within Spring Properties.
Refreshed the project several times via mvn clean and mvn package
But the ClassNotFoundException still shows up for com.jason.App. What other things should I look for?
EDIT
I found the error. In my pom.xml, I use the exec-maven-plugin to enable execution via mvn exec:java on the command line. The plugin definition was set to a previous project, from which I cut and pasted to the new project. The updated package name was not included, which is why the project executed via STS and not command line.
Your example compiles correctly if you
1. check com.jason.App class. Should it read com.jason.basicOne.App instead?
2. see if your pom.xml has right spring jars.
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.0.3.RELEASE</version>
</dependency>
Make sure your ".m2/" does not have an old spring which is referenced by your pom.xml

Resources