FAIL - War file cannot be uploaded if context is defined in server.xml (Spring mvc) - spring-mvc

I'm trying to deploy my webapplication (made with Spring MVC) on the server of a provider (Tomcat 7). I was trying to upload my ROOT.WAR, by using Tomcat manager page (without specifing a context), to the server, but I get this error:
FAIL - War file "ROOT.war" cannot be uploaded if context is defined in server.xml
How can I solve this problem? I read something on the internet but the solution is not clear to me.
Thank you in advance

Related

Spring Boot static files deployed via WAR with bad encoding

I am working on a project with spring boot web to serve a rest API (and using react.js on frontend) where embedded tomcat and dev-tools is used in development phase but is deployed to a jboss server via war file.
To keep consistency between dev mode and deployment mode, I am copying my front-end files to the classpath directory classpath:/public. This way of working is being very productive and I liked it.
The problem that is happening is that these front-end files have special characters (Portuguese characters) and only when I serve my application via WAR in jboss these characters are being displayed with problems. When I serve with embedded tomcat everything works fine.
Thanks in advance.
Spring MVC defaults to ISO-8859-1, embedded Tomcat overrides it to UTF-8, see https://github.com/spring-projects/spring-boot/issues/1182
I fixed it with property spring.http.encoding.force=true

Flex/Coldfusion Remoting issue. - 'Destination ColdFusion does not exist'

I'm trying to resolve a Flex remote object Coldfusion call. I'm getting the following error.
[MessingError message='Destination 'ColdFusion' either does not exist or the destination has no channels defined (and the application does not define any default channels.)']
When I access my CFC through a cfm page, they work. Due to the way the servers are configured, I'm having issues setting up flex with a coldfusion service when I create a new project because I'm developing on a machine, but have to push everything to the server where CF is located. I'm also wondering if the way CF is setup may be an issue. The company is running Coldfusion from the c:\inetpub directory with IIS and out of the same webroot directory they are running WordPress/MySQL (6 WP sites to be exact). Any suggestions would be appreciated.
I will also add that when I create the flex project I can not set ColdFusion as the web server whether local (1.This machine doesn't run a local instance due to office permissions) and 2.) They don't have the J2EE setup.
The first thing I would check is what you get when you go to: http://www.domain.com/flex2gateway. That should give you a blank page, but if you get anything else (such as a 404) the flex gateway isn't running.
The other thing to make sure is that you set your services compiler argument on flash builder to the coldfusion services-config.xml file in the WEB-INF/flex directory.
-services c:/Coldfusion/wwwroot/WEB-INF/flex/services-config.xml

Spring web app deploys on Gradle's embedded Jetty but not in standalone Jetty

I have built a small web app using Gradle. Things seemed to be going well using the embedded Jetty server, but not so well when I tried to copy the WAR file to a standalone server.
I used the gradle war plugin to assemble the war.
Running gradle jettyRunWar works fine.
Copying the war to the Jetty webapps folder and running Jetty fails with this exception:
java.lang.IllegalStateException: No such servlet servlet_name
But this very same servlet is found and used without issue in the embedded Jetty server.
The same issue happens if I manually copy the exploded war to the webapps directory.
The Spring web and Spring mvc libs are copied and present in the WEB-INF/libs directory, so it isn't an issue of not finding Spring (or is it?)
I'm using Jetty 9.1, and my web.xml file is configured for Servlets v3.
I'm also using Spring 3.2. The web app I'm writing is a RESTful service, using the #Controller annotations to route requests.
This should be as simple as copying the war over, but it seems not to be. At a bit of a loss at what to do here, any thoughts?
Thanks!
Sometimes the answer is staring you in the face...after posting I realized that I had my servlet-mapping before my servlet declaration. While this did not present an issue for the Gradle Jetty (not sure why), it made Jetty unhappy. Not sure why I changed the order to begin with...
In short, Jetty seemed to not find the servlet because it had not been declared yet.

Where does the root of spring-mvc application come from?

I created a simple Spring MVC project in STS according to this tutorial. When run it on server, the "Hello World" page was displayed under this url:
http://localhost:8080/goodproject/
My question is, where does the root url "/goodproject/" come from? The top-level package is com.duckranger.goodproject, is this the reason? May I use a different name as the url root?
In duckrabger's tutorial, the project name was used as the url root (from the screenshot). But in my case, using project name resulted a 404 error.
if you package your application in an EAR, you have an application.xml that defines the context-root of any web app. (which is generated from the EAR project POM if you use Maven)
If you deploy WARs directly, it depends on the application server : you may have specific xml configuration that defines the context path for each application.
For example, Jetty uses a context.xml file.

Problems consuming webservice on ASP.NET on production(IIS) server

We've implemented some SOAP client code on our ASP.NET site that calls up a remote service. Implementation was basically done by using Visual Studio "Add Web Reference" wizard, adding proper 'using remote.service.namespace' to the code and calling the service.
Code works perfect locally(from Visual Studio), but fails on production web server with missing assembly reference error:
CS0246: The type or namespace name 'remote.service' could not be found (are you missing a using directive or an assembly reference?)
I have a sneaky suspicion that I am not deploying everything properly, maybe some one can point out what is that I am missing there?
Thanks!
Additional info:
Project is a Website.
ASP.NET version 2.0 installed and used as a target on both dev box and production server.
Proxy file generated by WSDL.exe is deployed into the root folder of the website, same folder where the page resides. Global namespace(default) was used for proxy class generation.
If this is a WebSite project, then the proxy file should reside inside the App_Code folder
You mentioned the proxy dll is placed on "the root folder of the web site, where the page resides".
You should place the dll inside the "bin" folder. If the folder is not there create it.
The Web Service client stack in .NET does runtime generation of the proxy client (from the annotations in the class generated by wsdl.exe/svcutil.exe). this generated file typically ends up in one of your servers temp directories (there's one under the main windows tree somewhere). The problem is that the ASP.NET user account doesn't have rights to write to this particular temp directory, but doesn't notice at the time it writes the file, so you end up with an error with it trying to load the generated file back. You can end up in the situation depending on the exact installation order on your server. Once you find the right directory you can simply fix the NTFS perms on the directory to solve the problem.
Did you copy the App_WebReferences folder and all its contents to the server?
Does other parts of your ASP.NET site work?
Does your site target 3.5 and possibly 3.5 is not installed on the production server?
Is this a Web Site, or a Web Application Project? I bet it's a Web Site.

Resources