Cloudfoundry Grails deployment problems - no thread-bound request found - grails

This works locally. Set up: Grails 2.0.3. Debain Linux. I've deployed other applications successfully to Cloud Foundry.
Apparently this thing can happen as a consequence of the Spring Security Plugin not being happy with the resources plugin. Removing the resources plugin doesn't cure this.
This is the problem:
Class: java.lang.IllegalStateException
Message: No thread-bound request found: Are you referring to request attributes outside of
an actual web request, or processing a request outside of the originally receiving thread?
If you are actually operating within a web request and still receive this message, your
code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use
RequestContextListener or RequestContextFilter to expose the current request.
Adding the org.springframework.web.context.request.RequestContextListener and its loader to web.xml and importing them into the page doesn't help either.
There is much about this on the web, but in my case it only happens on Cloud Foundry.
Cloud Foundry runs on Java 1.6, like my machine. The logs say the same as the quote above, with stack traces identical to what I've found on the web.
Any ideas? I'm stuck. I've spent the best of two days on this.
Thanks.

Adding compile ":webxml:1.4.1" to the plugins section of BuildConfig.groovy should fix that. Credit to http://support.cloudfoundry.com/entries/21371626-grails-mongodb-deployment-fails

Related

Error when trying to get token using Managed Service Identity in a multi-container azure web app service

We have the following scenario:
Current working setup
Web API project using a single DockerFile
A release pipe line with an 'Azure App Service deploy' task.
Proposed new setup
Web API project using multi container Docker Compose file
A release pipe line with an 'Azure Web App for Containers' task.
Upon deploying the new setup we receive the below error message:
ERROR - multi-container unit was not started successfully
Unhandled exception. System.AggregateException: One or more errors occurred.
(Parameters: Connection String: XXX, Resource: https://vault.azure.net, Authority:
https://login.windows.net/xxxxx. Exception Message:
Tried to get token using Managed Service Identity.
Access token could not be acquired. Connection refused)
The exception thrown is because it can't connect to Azure MSI (Managed Service Identity). It does this to obtain a token before connecting to key vault.
I have tried the following based upon some research and solutions others have found:
Connecting with "RunAs=App" (this seems to be the default parameter-less constructor anyway)
Building up the connection string myself manually by pulling the "MSI_SECRET" environment variable from the machine. This is always blank.
Restarting MSI.
Upgrading and downgrading AppAuthentication package
MSI appears to be configured correctly as it works perfectly with our current working setup so we can rule that out.
It's worth noting that this is System assigned identity not a user assigned one.
The documentation that states which services support managed identites only mentions 'Azure Container Instances' not 'Azure Managed Container Instances' and that is for Linux/Preview too so that it could be not supported.
Services that support managed identities for Azure resources
We've spent a considerable amount of time getting to this point with the configuration and deployment and it would be great if we could resolve this last issue.
Any help appreciated.
Unfortunately, there currently is no multi-container support for managed identities. The multi-container feature is in preview and so does not have all its functionality working yet.
However, the documentation you linked to is also not as clear about the supported scenarios, so I am working on getting this documentation updated to better clarify this. I can update this answer once that's done.

Issue Launching Grails project to cloudfoundry

I am having a problem launching my (grails) project to cloud foundry. I have already launched with cf-push, but I keep getting this error
I/O error: Connection reset; nested exception is java.net.SocketException: Connection reset
when I run cf-update.
I also cannot see my log files with cf-crashlogs. I get this in the terminal window:
grails> cf-crashlogs
| Checking for available resources:.....
And if I try to access the page I get a 404 Not Found page.
Did I completely miss something? has anyone else seen this or know how fix this issue?
please check which version of the cf grails plugin were you using. try listing the plugin updates with this command:
grails list-plugin-updates
after that try to get cloud foundry connection info by:
grails cf-info
i suppose you know how to configure the login info, all the configure properties are listed here: http://grails-plugins.github.com/grails-cloud-foundry/docs/manual/guide/3%20Configuration.html
to access your app log, the most commonly used command is
grails cf-logs [destination] [--appname] [--instance] [--stderr] [--stdout] [--startup]
hope that helps.
I was trying to test Cloud Foundry long time ago. Don't remember but also had some issues which I couldn't overcome using default tool.
However then I used the Cloud Foundry Integration.
As I mentioned it was some time ago, so I won't help with the details, but the plugin worked as expected and I was able to deploy. Maybe you will success with it too :)

Deploy Grails app to AppFog using Eclipse CloudFoundry plugin

I'm trying to deploy my Grails application to AppFog using CloudFoundry plugin (ver. 1.1) in Spring Source Suites (STS 2.9.2).
I'm using https://api.appfog.com as server address and MYAPPNAME.aws.af.cm for application address when deploying app.
Application is pushed and started, services are bounded but, after that, I recive error saying that:
Communication with server failed: I/O error: Server returned HTTP response code: 405 for URL: https://api.appfog.com/apps/MYAPPNAME/application
Also, when I try to create Caldecott tunnel toward database I recive response "The URIs: caldecott-85393a.appfog.com have already been taken or reserved. (404 Not Found)" which I also saw when (by mistake) treid to deploy application to MYAPPNAME.api.appfog.com (default AF name instead of particular infrastructure adress).
I suppose that CloudFoundry plugin uses default server address to reach application and also trying to create Caldecott tunnel on default server address (caldecott-85393a.appfog.com instead of caldecott-85393a.aws.af.cm)
Does anybody have idea how to circumvent this situation?
BR
Zoran
this doesn't sound like an issue with the plugin itself but the response coming back from AppFog's cloud. I would take this up as an issue with them and clarify you can use that plugin with their cloud.
AppFog had issues recently with their Java deployments that was specifically affecting Grails apps. This has been resolved and should be working seamlessly as expected now. You can always reach out for more information in the active google group as well: https://groups.google.com/forum/#!forum/appfog-users

Deploying Grails Atmosphere app in JBoss 7

Greeting,
I'm trying to make this example work in Grails 2.1 using atmosphere plugin. When running in development environment on Tomcat it does not work, probably because Tomcat does not support web-services.
So I'm deploying it on JBoss 7.1. It does not work as well. And the following exception could be found in the log file
AtmosphereFramework exception: java.lang.IllegalStateException: The servlet or filters
that are being used by this request do not support async operation
I found the article related to async servlets support in Grails. Seems that Servlet3AsyncWebXmlProcessor should add async support to web.xml. But somebody should invoke it.
I think that atmosphere plugin is responsible for allowing async communication.
Have I missed something? Could you please help to make it work on AS7?
Ideally, I would like to figure out the way of running atmosphere applications in development environment? Is it possible?

Grails 2.0, Resource Plugin and root hosting

I've been upgrading a Grails 1.3.7 project to Grails 2.0. Everything was going smoothly until I hit integration (first non-local deployment). The gist of the problem is that it appears the Resource plugin always prepends the app name to the static CSS/JS URLs it generates, regardless of the grails.serverURL or grails.app.context specified for the environment. What's strange is image resources are hosted with the appropriate URL "/static/foo.png" but CSS/JS files attempt to be served as "/AppName/static/foo.js". Tracking this issue in ResourceTagLib, this initially looks like a issue in Resource Plugin but I don't want to jump to conclusions.
Our integration environment is setup with Apache proxy passing all traffic from "/" to ":8080/AppName" hosted on Tomcat. Therefore, all traffic to "http://int.sitename.com" is hitting the app running on Tomcat. Previously, in 1.3.7, grails.serverURL="http://int.sitename.com" was all that was required to get resources to served correctly.
Does anyone know a way to resolve this issue or does this look like a bug present in Resource plugin.
I'm using Grails 2.0 too. There is a line app.context=/ in the application.properties. As application is deployed to Tomcat, it's also on renamed to ROOT.war on deployment, so Tomcat will use a ROOT ie / context for this application. As result I don't have the described issue.

Resources