Vaadin 23 application doesn't recognize vaadin-dev-server dependency when running in development mode - vaadin

I'm in the process of upgrading a Vaadin Flow application from Vaadin 14 to Vaadin 22. I'm using Gradle 6.9.1 to build the application. When I run the application in Eclipse, I get warnings and errors in the logs identical to those documented in issue 11982. According to this issue, this initial warning about the vaadin-dev-server dependency is the most relevant message:
WARN [] [VaadinServletService] [qtp819245704-14] no DevModeHandlerManager implementation found but dev server enabled. Include the com.vaadin.vaadin-dev-server dependency.
I have included the dependency in my build.gradle file. Here are the dependencies that are relevant to Vaadin:
dependencies {
implementation "com.vaadin:vaadin-core:22.+"
implementation "com.vaadin:vaadin-dev-server:9.0.0"
}
I can see vaadin-dev-server-9.0.0.jar in my Referenced Libraries within Eclipse along with the other Vaadin .jar files. All of them are located in my Gradle cache.
Am I missing something, or is there anything I can do to resolve this issue? Let me know if there's any more information I can provide.
Edit: I'm now trying to upgrade the application to Vaadin 23 instead and I'm experiencing the same issue. I'm also getting the webpack error referenced in this question. If it helps, I'm running the project locally using embedded Jetty and I'm manually instantiating and invoking the initializers used by Vaadin as described in this answer.

Related

How to Import existing Grails app into Intellij

I'm having a hard time importing an existing Grails 3 application into Intellij, in what feels like the "right way". I have the looked through the official intellij documentation but haven't found much to help me (what I have found hasn't fixed any of my issues). It's possible that I simply didn't find what I needed. This post here doesn't quite help me out either.
Here's what I've tried:
Note: The application I'm importing is grails 3.1.9 and works fine using the Grails CLI.
Import the project on build.gradle
I get the following errors/warnings:
Warning:<i><b>root project 'app': Unable to build Grails project configuration</b>
Details: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':compileCopy'.
Caused by: java.lang.RuntimeException: A conflict was found between the following modules:
- jline:jline:2.12
- jline:jline:2.11</i>
Warning:<i><b>root project 'app': Unable to build Grails project configuration</b>
Details: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':compileCopy'.
Caused by: java.lang.RuntimeException: A conflict was found between the following modules:
- jline:jline:2.12
- jline:jline:2.11</i>
However if I ignore those warnings, I can get the application to run by using a gradle run/debug configuration, using bootRun. If I try to setup a run/debug with Grails, intellij doesn't let me pick an "application". Adding Grails as a framework does not change this behavior. I'm also missing some of the grails specific features that Intellij gives you.
Create the project from existing sources
Following this series of menu's, I have no idea what to pick. With the defaults that Intellij selects, I am still unable to set a Grails run/debug configuration. I assume I just have to select the right sources, but I have no idea what I should be selecting.
If someone could give me a list of steps to perform, or point out exactly where I need to go in the documentation, that would be very helpful and appreciated.

Grails 3.0 and Spring Security

I'm using Grails 3.0.1 with IntelliJ Idea and I'm trying to use Spring Security plugin on my project.
I know that old spring-seurity-core plugin is not compatible with Grails 3.0 version. Thus I've tried to follow this tutorial: http://spiesdavid.blogspot.fi/2015/03/grails-3-app-with-security-part-1.html
I've added the compile line in build.gradle file in dependencies. I've also added the logger line in logback.groovy file.
Problems start after that. There is no such file as SecurityConfiguration.groovy and there is no org.springframework.security package so I can't import them and it gives an error. So I can't create the file either.
So I am assuming that your question is: «How do I get this to work?»
spring security plugin 3.0.0 (for grails 3.x) was released just a few days ago. Documentation is quite good. Start here: https://grails-plugins.github.io/grails-spring-security-core/
There are some problems with Intellij. I tried to add spring security to a slightly older grails project (started with intellij 15.0.1 and grails 3.0.9). Adding the dependencies was successful and rebuilding it made the plugin available, also in the grails console. But when I launched a debug instance of the application directly from the IDE, it would not show spring security among the loaded/installed plugins. I made a pristine project with IntelliJ 15.02, grails 3.0.10 and just copied my code over to the new project. Now it works.
Note there are some issue with IntelliJ not major. do the following it will work:
on your build.gradle add compile 'org.grails.plugins:spring-security-core:3.0.0.M2'
run command compile
run comand s2-quickstart yourAppName User Role
now you should see "application.groovy" file under conf folder
as usual use #Secured annotation in your controller

Grails 2.4.0.RC1 seems to lock javascript files on Windows 7 - 64bit

I am using Grails 2.4.0.RC1 (and JDK 1.7.0_55) and whenever I browse to any app view that makes use of javascript files from the web-app folder, the java process seems to lock those files.
So I cannot work on any of those javascript files any more since when I try to save changes Windows 7 will not let me do it.
I used Process Explorer to check which process is locking the files and it's the java process running the grails app indeed.
At first I thought that this problem could be related to the new asset-pipeline:1.8.7 plugin which I am using. So I uninstalled it to check if the problem was still there... and it was.
The same app was running on Grails 2.3.5 just fine (although we were using an older JDK too... I must check with JDK 1.7.0_55).
By the way, something similar happened with a much older version of Grails: https://jira.grails.org/browse/GRAILS-3585
Is Anyone experiencing the same problem?
UPDATE 1:
I have tested this problem running the app on different versions of java and these are my results:
Win7-64bits, grails2.4.0.RC1, jdk1.7.0_55 -> PROBLEM OCCURS
Win7-64bits, grails2.4.0.RC1, jdk1.7.0_25 -> PROBLEM OCCURS
Win7-64bits, grails2.4.0.RC1, jdk1.6.0_18 -> OK
UPDATE 2:
I created a blank app (which uses Tomcat by default) and everything works fine.
The same blank app using jetty-plugin (with Jetty8) DOES present the problem.
I am further investigating this now.
I found the problem.
It had to do with the jetty-plugin indeed.
On the official version of the plugin 2.0.3 which uses Jetty7, the locking problem is NOT present. But this plugin uses a very old version of Jetty, so it's no use.
On the branch of the plugin created to run Jetty8:
https://github.com/grails-plugins/grails-jetty/tree/2.0.x
... the problem is there.
Also, on the new grails jetty plugin version 3.0.x (which uses Jetty 9.0.x), the problem is there too!
UPDATE 1:
Have a look at:
Jetty locking static files in Windows
Apparently the "useFileMappedBuffer" init-param of Jetty has to be set to false to prevent file locking.
You can use a local version of the jetty plugin and modify the above-mentioned property on [jetty-plugin]/grails-app/conf/webdefault.xml

Grails extension in SpringSource Tool Suite errors

I recently installed SpringSource Tool Suite. And I want to start working with Grails projects. So, I went to the Dashboard -> Extension, where I saw two extensions: Grails (current production release) and Grails Support as in the image below.
But when I try to install them, I get the following errors :
Problems occurred while performing installation: Operation details
Operation details
Cannot complete the install because one or more required items could not be found.
Software currently installed: Shared profile 1.0.0.1340820181092 (SharedProfile_com.springsource.sts.ide 1.0.0.1340820181092)
Missing requirement: Shared profile 1.0.0.1340820181092 (SharedProfile_com.springsource.sts.ide 1.0.0.1340820181092) requires 'org.maven.ide.eclipse [1.0.100.20110804-1717]' but it could not be found
What can I do to resolve this error ? Or are there any other options I can follow to install Grails extension?
Thank you!
I would switch to the new "Groovy/Grails Tool Suite" that was recently announced (see http://www.springsource.org/node/3582). Go to the standard download page at http://www.springsource.org/downloads/sts and click "Other Downloads >". Download the version for your OS under "Milestone Version - Groovy/Grails Tool Suite 3.0.0.M2".
It is a beta/milestone release but I've been using it since it was released and it's as stable as a final release so far. It's convenient since the Groovy-Eclipse plugin and the Grails support are already configured for you, in addition to the latest Grails (2.0.4). Any other plugins that you need from the standard STS can always be installed using the standard install/update procedure.
Yes, what #BurtBeckwith said. You should move to the new GGTS.
However, to address your particular problem, you installed STS into a read-only directory (or in C:\Program files). You need to re-install it somewhere else.
The Eclipse p2 installer cannot handle installing feature patches into a read-only directory. Groovy-Eclipse ships with a feature patch to extend the JDT compiler. I believe that this problem was fixed in the Juno release of Eclipse (4.2), which came out last week.
Deleting corresponding application from Windows memory removed the problem (Grails extension in SpringSource Tool Suite errors). Double running applications (earlier and new) could also be reason why GGS or STS sometimes cannot save .groovy files (with error message or without).

Grails - trying to deploy a nojars application into glassfish 3.0.1

Because of memory constraint i am trying to build a grails app with smaller memory footprint. I build the war with this argument "--nojars". I created a war file without all the jar and when i deploy within the glassfish i encounter this error
Exception while loading the app : java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: java.lang.ClassNotFoundException: org.codehaus.groovy.grails.web.util.Log4jConfigListener
It seems like the application fail to find where is the jar file.
I had already indicates the path to the library before deploying the application in glassfish.
did i miss out somethinng?
It is commonly recommended to use GlassFish's Common Classloader. That means putting the shared JARS into the $domain-dir/lib folder (but not into a subfolder of that).
You're probably trying to use the Application Classloader with the asadmin deploy --libraries command. This is more complicated and error-prone. If you don't need different versions of the same JARs with different web applications, you should definitely go for the Common Classloader as specified above.
Also see The Classloader Hierarchy for a reference.
EDIT Updated as per the questioner's comment:
The domain/domain1/lib folder definitely works (I've tested that). To validate that, put log4j.jar into that folder and add a test.jsp to domain1/applications/$applicationName, that just contains:
<% out.println(
org.apache.log4j.Logger.getLogger(this.getClass())); %>
If that works but your other code does not, there may be another point to consider: Are you using Log4J's Logger.getLogger(..) or Apache Commons' LogFactory.getInstance(..) in your code?
See the article Taxonomy of class loader problems encountered when using Jakarta Commons Logging for related issues. - I'd also like to advise you to post your complete stacktrace.

Resources