Grails compilation error: unable to resolve class JSON - java

I have the following setup, grails 2.0.3, STS, and I'm doing this in one of my controllers:
render(['car': contactL] as JSON)
When I run the application I get the following error:
I have read about the error, but none of the solutions have worked for me, I have tried cleaning, upgrading, using the Grails Tools -> Refresh dependencies but it gave me:
grails> | Error Error running script null: Cannot invoke method trim() on null object (Use --stacktrace to see the full trace)
I'm also getting this error in my project:
The project was not built since its build path is incomplete. Cannot find the class file for groovy.lang.GroovyObject. Fix the build path then try building this project Ristretto Unknown Java Problem
What's you diagnose?

To fix the "unable to resolve class JSON" error, you should just have to import it:
import grails.converters.JSON
...
class MyController {
...
render [car: contactL] as JSON

I finally managed to get it working, I switched workspace, and added my project - problem solved.

Related

io.restassured.RestAssured cannot be resolved

Hi I am not able to resolve the error while using rest assured 5.2.0 library in my Eclipse IDE. I have added the rest assured library in my pom.xml file still the error is not resolved also removed Scope from the dependency.
I tried importing the rest assured library from https://mvnrepository.com/artifact/io.rest-assured/rest-assured/5.2.0 But still doesn't work.It is "RestAssured cannot be resolved".
Please find the attached screenshotenter image description here
Screenshot of Maven Dependencies node expanded to the class and import statement with error message.
enter image description here
Try importing it directly by using:
import static io.restassured.RestAssured
You can also run in terminal:
mvn clean install

Error occurred during initialization of boot layer java.lang.module.ResolutionException

Currently I am working for some homework, with postgis.jdbc in combination with postgis.geometry and postgresql.
The problem is now that Intellij always throws the following error when running the programm.
Error occurred during initialization of boot layer
java.lang.module.ResolutionException: Modules postgis.geometry and
postgis.jdbc export package org.postgis to module org.postgresql.jdbc
Process finished with exit code 1
I tried different ways to import, but nothing seems to work.
According to the following entry I should use classpath instead of modulepath but I can't find a setting to import a jar file using class path instead of module path.
I tried to import using Runtime instead of compile option but the packages are no longer recognized by Intellij, so this is not a working option for me.
Thanks for help.

AWS Lambda can't find dependent library

This is my first time deploying to AWS Lambda and am getting a little stuck.
I have a large maven project called Helpers which has many submodules, many of them dependent on each other. In there I have one Helper called Alerts. I have a parent directory and everything builds and compiles successfully. So, that's good.
In Alerts there's a class called PaymentAlerts which has the line
import com.mywebsite.messages.Doers
where messages.Doers is found in the dependencies.
But, when I do a mvn package on the whole project and I find alerts-1.0.jar and upload it to AWS Lambda and I set my handler as com.mywebsite.alerts.PaymentAlerts::doAlert I get the following error:
{
com.mywebsite.alerts.PaymentAlerts: com/mywebsite/messaging/Doers",
"errorType": "java.lang.NoClassDefFoundError"
"errorMessage": "Error loading class
}
How do I reconfigure this so that it finds all the necessary files?
Any and all help is appreciated!
AWS Lambda can't find dependent library
Except mvn, you can do with simple library dependency by putting all jars in one, Where your MANIFEST file contains like Class-Path: libs/xyz.jar libs/abc.jar ...
Hope this process can resolve your "errorType": "java.lang.NoClassDefFoundError"
From here I was able to find out about maven-shade-plugin which jarred everything together nicely and solved the problem.

Error: Could not find or load main class ... in eclipse

I knew there are similar question posted already but none of it helped in resolving my issue. Currently I am working on a Scala project using eclipse.
Issue 1 : Unable to get Run As -> Scala application
Issue 2: When I run my program through Run Configurations, getting the following error
Error: Could not find or load main class NewStreaming
Code :
src/main/scala/NewStreaming.scala
object NewStreaming {
def main(args:Array[String]): Unit = {
...
...
}}
Issue 3: Able to do "mvn package", but when I execute the jar in hdp, with spark-submit, getting the following exception
java.lang.ClassNotFoundException: NewStreaming
Could you try to do a Rebuild / Clean of your Project? :)
I didn't use eclipse since a while. But I remember I got a problem of that kind.

error: cannot find symbol for CompatibilityAssertions

Am trying to build project, but receives next error. Can't deal why. Seems like it written without spell errors.
D:\Projects\iqpdct\iqpdct-domain\src\test\java\de\iq2dev\domain\datatype\OctetSt
ringDatatypeTest.java:5: error: cannot find symbol
import org.assertj.core.api.CompatibilityAssertions;
You are missing a jar on your Java buildpath. According to the thrown exception you should be able to find the jar here. The link points to a Maven repository of assertj-core. After opening the link please select the proper version of aspectj for your project.

Categories