Grails war command doesn't set the environment - grails

I run an app using embedded container using grails run-app -Dgrails.env=myenv and it works fine. I then do grails war -Dgrails.env=myenv deploy it on a Tomcat 6 server and it doesn't work. I get a bunch of log4J errors that go away once I add log4j jars to Tomcat lib's directory. The lo4j errors now go away. I am left with:
INFO: Deploying web application archive qkr2.war
Sep 7, 2013 11:09:54 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Sep 7, 2013 11:09:54 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/mk2] startup failed due to previous errors
But there are no previous errors. So I haven't a clue what could be wrong.
Or what to do next. Any tips?
Thanks

According to http://grails.org/doc/latest/ref/Command%20Line/war.html, the environment comes BEFORE the "war" part of the command, so that could be it. i.e. the command should read:
grails -Dgrails.env=myenv war
Check the logging to see what environment grails thinks it's starting under. Otherwise, I'd try adding the environment variable at Tomcat startup, rather than building different wars for different environments.
This all presumes that the logging config is correct in this myenv environment. If not, then I can't tell you why it's not starting without more of the logging available.

When you see "SEVERE: Error listenerStart" deploying to Tomcat, look at the log files. In general you'll find that the error is in stacktrace.log or localhost.2013-09-07.log (the date part of the file name may be different of course).

Related

Build fails intermittently on Jenkins node machine

I created a build system on windows 2019 server where I installed Jenkins version 2.375.1 and which is running Java 17. I am completely new in this and doing it for first time.
Here is the issue: Whenever I run any job, sometime s(4-6 out of 10) it fails by throwing an exception. See below :
java.nio.channels.ClosedChannelException
at jenkins.agents.WebSocketAgents$Session.closed(WebSocketAgents.java:153)
at jenkins.websocket.WebSockets$1.onWebSocketClose(WebSockets.java:80)
at jenkins.websocket.Jetty10Provider$2.onWebSocketClose(Jetty10Provider.java:149)
at org.eclipse.jetty.websocket.common.JettyWebSocketFrameHandler.notifyOnClose(JettyWebSocketFrameHandler.java:308)
at org.eclipse.jetty.websocket.common.JettyWebSocketFrameHandler.onClosed(JettyWebSocketFrameHandler.java:292)
at org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession.lambda$closeConnection$0(WebSocketCoreSession.java:272)
at org.eclipse.jetty.server.handler.ContextHandler.handle(ContextHandler.java:1450)
at org.eclipse.jetty.server.handler.ContextHandler.handle(ContextHandler.java:1487)
at org.eclipse.jetty.websocket.core.server.internal.AbstractHandshaker$1.handle(AbstractHandshaker.java:212)
at org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession.lambda$closeConnection$1(WebSocketCoreSession.java:272)
at org.eclipse.jetty.util.Callback$4.completed(Callback.java:184)
at org.eclipse.jetty.util.Callback$Completing.succeeded(Callback.java:344)
at org.eclipse.jetty.websocket.common.JettyWebSocketFrameHandler.onError(JettyWebSocketFrameHandler.java:268)
at org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession.lambda$closeConnection$2(WebSocketCoreSession.java:284)
at org.eclipse.jetty.server.handler.ContextHandler.handle(ContextHandler.java:1468)
at org.eclipse.jetty.server.handler.ContextHandler.handle(ContextHandler.java:1487)
............
............
............
And the log I got in node machine on console is :
INFO: Connected
Jan 15, 2023 8:05:02 AM hudson.remoting.UserRequest perform
WARNING: LinkageError while performing
UserRequest:hudson.node_monitors.SwapSpaceMonitor$MonitorTask#4c55cc1c
java.lang.UnsatisfiedLinkError: C:\Users\test*****\AppData\Local\Temp\jna--202642030\jna2121667260400486382.dll: A dynamic link library (DLL) initialization routine failed
at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:388)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:232)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:174)
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2389)
at java.base/java.lang.Runtime.load0(Runtime.java:755)
at java.base/java.lang.System.load(System.java:1953)
at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1045)
at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:1015)
at com.sun.jna.Native.<clinit>(Native.java:221)
at com.sun.jna.Structure.setAlignType(Structure.java:291)
at com.sun.jna.Structure.<init>(Structure.java:208)
at com.sun.jna.Structure.<init>(Structure.java:204)
at com.sun.jna.Structure.<init>(Structure.java:191)
at com.sun.jna.Structure.<init>(Structure.java:183)
at org.jvnet.hudson.Windows$MEMORYSTATUSEX.<init>(Windows.java:67)
Some more info about configuration :
Both controller and node machine is windows server 2019
Since in latest Jenkins the java web connect(Run Jenkins as service on node) is not available so directly running the agent command in node's CLI.
Both controller and node is running Java v17
I went through couple of links and tried all the possible suggestion provided like power management settings on salve machine, increasing Jenkins build timeout settings etc... but no luck.
Any help on this is highly appreciated.
Thanks.
Not sure if there is a bug in Jenkins itself or something. I could not find the answer of the exact issue but after making some changes in jenkins configuration, now i am able to run all the jobs without getting above exception.
Here it is : Earlier i checked jenkins to use websocket in slave configuration. If i just disable it and run then not getting any issue.
Just disbaling this worked for me.. Thanks.

Grails 2.3.2 not working

Good morning,
I created a new project with
Grails 2.3.2
Java JDK 1.7.0_45
When I run the command:
grails run-app
see the following errors:
**| Configuring classpath
nov 09, 2013 1:52:27 PM java.util.prefs.WindowsPreferences <init>
| Running Grails application
*** java.lang.instrument ASSERTION FAILED ***: "!errorOutstanding" with message transform method call failed at ../../../src/share/instrument/JPLISAgent.c line: 844
Exception in thread "main"
| Error Forked Grails VM exited with error**
Can anyone help me?
thanks
Just tried with exact same setup, as you have.
Comment-out lines inside of grails.project.fork=[-----]
Delete .grails in user's home directory
grails clean
grails run-app
Its worked for newly created app but surely there are some problems in asm libraries.
Just comment-out section grails.project.fork of BuildConfig.groovy
That's it.
The error will run away.
For me help adding in BuildConfig.groovy
build "org.fusesource.jansi:jansi:1.11"
More information on http://jira.grails.org/browse/GRAILS-10756?focusedCommentId=78003&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel
Just remove grails.project.fork then clean-app and run-app.
That's all.
Following are the steps which work for me:-
Delete .grails in user's home directory
Right click on icon IntelliJ IDE and run as administrator
Hope your problem will be solved.

Grails war deployement on WSAS

I generate a war using grails war, but when I deploy it to Websphere I have errors, what features I need to add so I can run my war under WSAS, here are the errors → http://paste.ubuntu.com/6179593/
Note: The web page show me this error → Context Root Not Found
According log there is no problem and application has started successfully.
Check your Virtual Hosts settings.
There is good article about grails application deployment.

Spring Framework NoSuchMethodFound Tomcat Error

I work on a 4 person development team using IntelliJ, but for some reason only one the team members can successfully build a WAR file and deploy. All other members will receive the following error:
Aug 17, 2012 2:14:31 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Aug 17, 2012 2:14:31 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/xxx] startup failed due to previous errors
2012-08-17 14:14:40,171 [http-8080-1] ERROR context.ContextLoader - Context initialization failed
java.lang.NoSuchMethodError: org.springframework.web.context.support.XmlWebApplicationContext.getEnvironment()Lorg/springframework/core/env/ConfigurableEnvironm
ent;
From everything I've researched, this is caused by a version conflict in the Spring Framework, but for the life of me I can't seem to resolve the issue.
Has anyone ever run into this issue? And how can I resolve it?
Modify your catalina.sh/catalina.bat such that you launch java using the -verbose:class flag. It will produce a lot of output, but you should be able to see which JAR file you're loading org.springframework.web.context.support.XmlWebApplicationContext from and chances are it's not the same version that your version of Grails is using. Remove the bad version from your classpath and hopefully you'll be good to go.

SEVERE: Exception sending context initialized event to listener instance of class org.apache.struts2.tiles.StrutsTilesListener

While building the war file (Struts2.0) and deploying it on the local tomcat everything is working file and I can able to access the web page but when I am trying to deploy it on the remote server I am getting the below exception. I checked the DTD tiles veriosn in tiles.xml it looks good. Can you please suggest me the way to solve this error?
Sep 15, 2011 7:34:37 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.apache.struts2.tiles.StrutsTilesListener
java.lang.IllegalStateException: Unable to instantiate container.
at org.apache.tiles.listener.TilesListener.contextInitialized(TilesListener.java:60)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4336)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:761)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:741)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:825)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:714)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1206)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1307)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1571)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1580)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1560)
at java.lang.Thread.run(Unknown Source)
Hi
My struts version is 2.0.6 and tiles is 2.0 and I don have any other errors. Differences between locan and remote also I couldnt see – veeru 9 mins ago
Got the answer . Problem solved. The mistake wa in web.xml .
The local server is on windows where as remote server is on unix
so there is a mistake in mentioning the relating path in web.xml ( / not required in unix server)
This may be caused by missing dependencies. Doing a search for this error turns up several occurences of people not including:
commons-beanutils-VERSION.jar
commons-collections-VERSION.jar
commons-digest-VERSION.jar
Make sure you have all the requirements listed here: To use Tiles in your application you need
Here is another example of the same error: Struts2 & Tiles: When apache.org is down my webapp fails to start
The last one is a DTD version mismatch.
As you can see it can be due to several reasons, but since it works on your local PC and not the remote, I would lean towards missing dependencies.

Resources