Spark microframework 2.1 deploys well in Tomcat but not version 2.5 - gradle

I am not good at all this web stuff, but I have managed to port a small Spark-tinyweb application to serve REST services from jetty to Tomcat, following the project from Leonan Luppi in
https://github.com/leonanluppi/SparkTomcat
But in the folder WebContent/WEB-INF/lib, if I replace the file
spark-core-2.1.jar
to a newer version:
spark-core-2.5.jar
The application does not work.
Any suggestions?

Your build.gradle file specifies the dependency on com.sparkjava:spark-core:2.1. You have to upgrade the version in the file too so that Gradle can resolve the dependencies and compile your app.

Related

Gradle in Spring Boot project not recognizing Java jdk in Path

I have a spring boot application where the gradle version is 7.0.
I had to change my openjdk 16 to openjdk 11 because I want to use keycloak with the project.
After I updated the Path, my java 11 gets recognized:
But my gradle is still stuck on the other version:
Edit: I have noticed that the error is in my build.gradle file:
Things I have tried:
restarting my pc
deleting cache folders for vscode
putting a JAVA_HOME into my path and link it and reverted it(I checked everytime with a new powershell window to make sure that it has updated and it always worked)
test another spring project (The other spring boot app does not have this gradle issue)
Anything else I can try?
I would look closely at the other spring boot app that does not have this gradle issue. VSCode has a habit of keeping cached versions of files around, but really you want the gradle files to be interrupted so it downloads new dependencies. I would look into that next, if you can't figure out what makes your other project work and this one not.

deployment error through maven using ----java jar <jarfile>.jar

I have created a Spring Starter data jpa project and its connecting with mysql. through STS its running fine.
i wanted to deploy it individually so i clean install the application using maven and used java jar <jarfile.jar> in command prompt.
I followed the video of java brains.
Below is the error which get
JAXB is not found.
It seems that you set the scope of the JAXB dependency to provided or built the project for an old Java Version (like Java 8) that comes with JAXB and run it with a newer Java version (like Java 10) that does not come with JAXB.
You can fix this by adding the JAXB dependency to the classpath when running the JAR or by adding the dependency to your project manually(or set the scope to compile)

UnsupportedClassVersion - JacksonAutoDiscoverable

I'm trying to use IBM Rational Application Developer version 9.0 with WebSphere Application Server v7.0 running Java 1.6 and use JAX-RS with org.glassfish.jersey version 2.6. This is not a maven project, so I created another maven project, added the root dependencies there and built it so it pulled down all of the jars. I moved them over into my non-maven project.
When I run the project, I start the server (or try to hit a resource) I get the following error message: java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=org/glassfish/jersey/jackson/internal/JacksonAutoDiscoverable, offset=6
I have a different application that successfully uses jersey deployed WAS7 on this same machine. I've compared the project and server configurations and see no major difference, particularly no difference in the Installed JRE", Execution Environments or Java Compiler Compliance Level (all using 1.6).
Even though the maven project is using jersey 2.6, I have also tried other lower jersey versions in the non-maven project to see if it's an issue with the dependencies being built for 1.7 but that doesn't seem to be the case at all.
Here is the list of dependencies I have in my library:
aopalliance-repackaged-2.2.0.jar
hk2-api-2.2.0.jar
hk2-locator-2.2.0.jar
hk2-utils-2.2.0.jar
jackson-core-asl-1.9.13.jar
jackson-jaxrs-1.9.13.jar
jackson-mapper-asl-1.9.13.jar
jackson-xc-1.9.13.jar
javassist-3.18.1-GA.jar
javax.annotation-api-1.2.jar
javax.inject-2.2.0.jar
javax.ws.rs-api-2.0.jar
jersey-client-2.6.jar
jersey-common-2.6.jar
jersey-container-servlet-core-2.6.jar
jersey-guava-2.6.jar
jersey-media-json-jackson-2.6.jar
jersey-server-2.6.jar
osgi-resource-locator-1.0.1.jar
validation-api-1.1.0.Final.jar

deployment single ejb module with dependencies in netbeans and glassfish

In NB 7.2 i have ejb module managed by maven with several dependencies. I try to run it on Glassfish 3.1.2.2 but it seems like server doesn't resolve libraries on classpath. I think arguments in deploy command ("deploy?DEFAULT=..." - i'm not sure it is command) are correct - there are all libraries in this command, but during creating ejb server throws class not found exception - although this class is in library in deploy command.
It is possible to deploy single EJB module with dependencies without enterprise application?
Thanks for advice
There are a couple of mechanisms for deploying EJBs. If the EJB has dependencies and is used in a web application, check if it can be used in the EJB lite configuration. It is easiest to deploy it in a WAR file along with a web application. There is an article Introducing the Java EE 6 Platform: Part 3 that details a number of the specifics.
Alternatively, you may deploy it as part of an EAR file which will include the dependencies.
If the EJB must be used as a standalone EJB, the dependencies must be be in the server classpath, or repackaged in the EJB jar file. NetBeans 7.2.1 can do that for you.

grails tomcat 7 deployment

So I have a grails 2.0.4 application that works exactly the way I want. I created the war file and deployed it to Tomcat 7. I'm getting an error saying that the application can't find the jar I'm using to connect to oracle (ojdbc6.jar). The jar is listed under mywebapp/WEB-INF/lib. WHY can't it be found?? Any help would be greatly appreciated!
The jar file should be in the toplevel lib directory of your project (or specified as a dependency in a repository), not webapp/WEB-INF/lib. Is the jar file actually inside the warfile? You can test this by opening the war as a zip file, or by running jar tf target/mywebapp*.war and looking for ojdbc6.jar. If it is, it should get deployed and you should see it in tomcat7/webapps/mywebapp/WEB-INF/lib.
The default environment for grails war is production instead of development. Make sure you've got the production data source configured correctly in grails-app/conf/DataSource.groovy

Resources