Rectangle 27 3

@JVerstry Now I use plain bash scripts like this: pastebin.com/mRDYBSS2 It's more useful with jenkins and help's me to escape permgen-on-redeploy-hell. I wish you will love it too :)

java - Cannot invoke Tomcat manager: Server returned HTTP response cod...

java tomcat deployment maven
Rectangle 27 1

Have you included maven tomcat plugin in your pom.xml? build section of your pom shoul be like :

<build>
   <resources>
      <resource>
          <directory>src/main/resources</directory>
          <filtering>true</filtering>
          </resource>
   </resources>
   <plugins>
      <!-- Maven Tomcat Plugin -->
      <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>tomcat-maven-plugin</artifactId>
    <configuration>
        <url>http://127.0.0.1:8080/manager</url>
        <server>TomcatServer</server>
        <path>/mkyongWebApp</path>
    </configuration>
       </plugin>
    <plugins>
</build>

You also have to add an user with administrator access right for Tomcat. Edit the file %TOMCAT_PATH%/conf/tomcat-users.xml and add role manager for user tomcat.

<role rolename="tomcat"/>
  <role rolename="role1"/>
  <role rolename="manager"/>
  <user username="tomcat" password="tomcat" roles="tomcat,manager"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>

when using mvn tomcat:run the error shows [ERROR] Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:run (de fault-cli) on project spring-mvc-thymeleaf: Could not start Tomcat: Protocol han dler initialization failed: java.net.BindException: Address already in use: JVM_ Bind <null>:8080 -> [Help 1]

java - How to Change Error Cannot invoke Tomcat manager: Server return...

java spring maven tomcat spring-mvc
Rectangle 27 0

@JVerstry Now I use plain bash scripts like this: pastebin.com/mRDYBSS2 It's more useful with jenkins and help's me to escape permgen-on-redeploy-hell. I wish you will love it too :)

java - Cannot invoke Tomcat manager: Server returned HTTP response cod...

java tomcat deployment maven
Rectangle 27 0

Previously, if you are using Eclipse with the plugin m2e, here is explained how to configure Eclipse in order to use Tomcat with it: tomcat-maven-plugin: Server returned HTTP response code: 403

Now, we need a proper settings.xml in the C:\Users\user.m2 with the same user and password than tomcat-users.xml. Then, we need to have our pom.xml configurated as follow:

<packaging>war</packaging>


<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
    <url>http://127.0.0.1:8080/manager</url>   
    <!-- The next server must be the same than the one in settings.xml (at C:\Users\user\.m2): -->
    <server>TomcatServer</server>
</configuration>
</plugin>   


<plugin>
    <groupId>org.grails</groupId>
    <artifactId>grails-maven-plugin</artifactId>
    <version>${grails.version}</version>
    <extensions>true</extensions>
    <executions>
        <execution>
            <goals>
                <goal>init</goal>
                <goal>maven-clean</goal>
                <goal>validate</goal>
                <goal>config-directories</goal>
                <goal>maven-compile</goal>
                <goal>maven-test</goal>
                <goal>maven-war</goal>
                <goal>maven-functional-test</goal>
            </goals>
        </execution>
        </executions>
</plugin>

The next command get the configuration values of our database from datasource.groovy - production environmnent:

To get the values from the development environment, the commands are the next:

Note1: if we not add -DskipTests (to no running tests before to deploying), and some test fail, it won't deploy.

Note2: in eclipse (with the plugin m2e for maven installed), you have to type these commands in the next field:

  • Run - Run Configurations - Maven Build - Goals

Do not forget to create an empty web.xml under src/main/webapp/WEB-INF!

I think the key part is binding the Grails plugin to the maven-war phase. You should accept your own answer as it's a good reference for the correct config for the grails plugin.

maven - In Grails, the command "tomcat:deploy" does not generate the c...

maven grails grails-plugin sts-springsourcetoolsuite
Rectangle 27 0

If you are using Eclipse with the plugin m2eclipse and you still have this error after trying these solutions, it could be because this plugin has not the manager included. You should download Tomcat separately and configure Eclipse to use it (check this link: tomcat-maven-plugin: Server returned HTTP response code: 403)

tomcat-maven-plugin 403 error - Stack Overflow

maven tomcat maven-tomcat-plugin
Rectangle 27 0

If you are deploying to Tomcat 7, you might consider using the Tomcat 7 Maven plugin from Apache instead of the Codehaus version.

Typically, credentials do not go into the plugin configuration in the POM, as the POM ends up in an artifact repository and is usually shared with other developers. Credentials go in the settings.xml <servers> element, then you configure the plugin to reference that server. This is what the Tomcat 7 plugin usage docs and the Codehaus tomcat plugin describe.

....
<servers>
  <server>
      <id>raspinaserver</id>
      <username>admin</username>
      <password>admin</password>
  </server>
</servers>
...
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>tomcat-maven-plugin</artifactId>
    <configuration>
      <server>raspinaserver</server>
      <path>/azraspina</path>
      <url>http://localhost:8080/manager/html</url>
    </configuration>
</plugin>

thanks for reply. i tried this but didnt solve the problem. i think i move on to jetty

+1 for pointing out that the credentials should better be configured in the settings.xml and NOT in the POM.

eclipse - How to fix "Cannot invoke Tomcat manager: Server returned HT...

eclipse maven java-ee tomcat
Rectangle 27 0

I would take the following steps:

  • Try the same URL from a browser, ideally on several different boxes and browsers
  • Use Wireshark to see what's happening on the network
  • Try to run the applet against a debugger, to see whether your code is actually getting called

Basically it's unlikely to be a client-side issue at all, unless something like a proxy is getting in the way and screwing things up. WireShark will show you what's happening on the network... and if it really is getting to your code, debugging should help you find out what's going on in your server, and hopefully why it's not getting into the Tomcat logs.

tomcat - java.io.IOException: Server returned HTTP response code: 500 ...

java tomcat servlets applet http-error
Rectangle 27 0

I have spent over three days on Server returned HTTP response code: 400 while trying to deploy web application onto Tomcat Server 8.0 bundled with Netbeans. When I used mvn tomcat7:deploy over command line, everything worked perfect, but no success through Netbeans IDE. I have set tomcat maven plugin in POM.xml

<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <configuration>
        <url>http://localhost:8080/manager/text</url>
        <server>tomcat</server>
    </configuration>
</plugin>

plus server record in .m2/conf/settings.xml for Maven,

<settings>
    <servers>
        <server>
            <id>tomcat</id>
            <username>admin</username>
            <password>admin</password>
        </server>
    </servers>
</settings>

even appropriate tomcat user in tomcat-users.xml

<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<user username="tomcat" password="tomcat" roles="manager-script,manager-gui"/>

but still without success. The root cause was Proxy server used in our company and Netbeans settings. In Netbeans, go to Tools -> Options and on General tab, use Manual Proxy Settings instead of System Proxy Settings (even if System Proxy Settings works). It helped me and now I am able to deploy web app on Tomcat 8 from Netbeans directly. You can also set No Proxy when you are using only localhost server. Root cause for my trouble was bad proxy set in default web browser, which is the source for option System Proxy Settings.

tomcat-maven-plugin 403 error - Stack Overflow

maven tomcat maven-tomcat-plugin
Rectangle 27 0

If you are deploying to Tomcat 7, you might consider using the Tomcat 7 Maven plugin from Apache instead of the Codehaus version.

Typically, credentials do not go into the plugin configuration in the POM, as the POM ends up in an artifact repository and is usually shared with other developers. Credentials go in the settings.xml <servers> element, then you configure the plugin to reference that server. This is what the Tomcat 7 plugin usage docs and the Codehaus tomcat plugin describe.

....
<servers>
  <server>
      <id>raspinaserver</id>
      <username>admin</username>
      <password>admin</password>
  </server>
</servers>
...
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>tomcat-maven-plugin</artifactId>
    <configuration>
      <server>raspinaserver</server>
      <path>/azraspina</path>
      <url>http://localhost:8080/manager/html</url>
    </configuration>
</plugin>

thanks for reply. i tried this but didnt solve the problem. i think i move on to jetty

+1 for pointing out that the credentials should better be configured in the settings.xml and NOT in the POM.

eclipse - How to fix "Cannot invoke Tomcat manager: Server returned HT...

eclipse maven java-ee tomcat
Rectangle 27 0

Have you included maven tomcat plugin in your pom.xml? build section of your pom shoul be like :

<build>
   <resources>
      <resource>
          <directory>src/main/resources</directory>
          <filtering>true</filtering>
          </resource>
   </resources>
   <plugins>
      <!-- Maven Tomcat Plugin -->
      <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>tomcat-maven-plugin</artifactId>
    <configuration>
        <url>http://127.0.0.1:8080/manager</url>
        <server>TomcatServer</server>
        <path>/mkyongWebApp</path>
    </configuration>
       </plugin>
    <plugins>
</build>

You also have to add an user with administrator access right for Tomcat. Edit the file %TOMCAT_PATH%/conf/tomcat-users.xml and add role manager for user tomcat.

<role rolename="tomcat"/>
  <role rolename="role1"/>
  <role rolename="manager"/>
  <user username="tomcat" password="tomcat" roles="tomcat,manager"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>

when using mvn tomcat:run the error shows [ERROR] Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:run (de fault-cli) on project spring-mvc-thymeleaf: Could not start Tomcat: Protocol han dler initialization failed: java.net.BindException: Address already in use: JVM_ Bind <null>:8080 -> [Help 1]

java - How to Change Error Cannot invoke Tomcat manager: Server return...

java spring maven tomcat spring-mvc
Rectangle 27 0

The attached is a Maven project;
The server side code is implemented as a Spring MVC controller;
The client side code is implemented in the simple "index.jsp" file;
The project uses Java 8 and Tomcat 7. If you want to try this example by yourself, I would recommend JDK 8 and Eclipse Luna Java EE IDE for web developers or above.
I will assume that you have some general background on Maven, Spring MVC, and jQuery. If you are not familiar with these, you can always check out the internet to get the ideas on them.

The server side code
The attached is a Maven project, the POM file is the following:

Hide   Shrink    Copy Code
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

  <modelVersion>4.0.0</modelVersion>
  <groupId>com.song.example</groupId>
  <artifactId>jquery-simple-upload</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>

    <properties>
        <spring.version>4.1.7.RELEASE</spring.version>
        <jackson.version>2.6.1</jackson.version>
        <tomcat.version>7.0.55</tomcat.version>
    </properties>

    <dependencies>
        <!-- Minimal dependencies for Spring MVC -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <!-- Multi-part file support -->
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.3.1</version>
        </dependency>

        <!-- Jackson dependencies -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
              <groupId>com.fasterxml.jackson.core</groupId>
              <artifactId>jackson-databind</artifactId>
              <version>${jackson.version}</version>
        </dependency>

        <!-- Sevlet jars for compilation, provided by Tomcat -->
        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>tomcat-servlet-api</artifactId>
            <version>${tomcat.version}</version>
            <scope>provided</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>     
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <warSourceDirectory>webcontent</warSourceDirectory>
                    <failOnMissingWebXml>true</failOnMissingWebXml>
                </configuration>
            </plugin>

            <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.3</version>
                    <configuration>
                      <source>1.8</source>
                      <target>1.8</target>
                    </configuration>
                </plugin>
        </plugins>
    </build>
</project>
The "web.xml" and the "mvc-dispatcher-servlet.xml" file are the following:

Hide   Shrink    Copy Code
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
        http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    id="WebApp_ID" version="3.0">

    <display-name>D3 Example</display-name>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

    <filter>
        <filter-name>nocachefilter</filter-name>
        <filter-class>com.song.example.filter.NocacheFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>nocachefilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <servlet>
        <servlet-name>mvc-dispatcher</servlet-name>
          <servlet-class>
              org.springframework.web.servlet.DispatcherServlet
          </servlet-class>
          <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>mvc-dispatcher</servlet-name>
        <url-pattern>/api/*</url-pattern>
    </servlet-mapping>

    <context-param>
        <param-name>BaseUrl</param-name>
          <param-value>
            http://localhost:8080/jquery-simple-upload/
          </param-value>
    </context-param>

</web-app>
Hide   Copy Code
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:p="http://www.springframework.org/schema/p" 
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context-3.2.xsd
        http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd">

     <context:component-scan base-package="com.song.example.controller" />
     <mvc:annotation-driven />

     <bean id="multipartResolver"
        class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
        <property name="maxUploadSize" value="1048576"/>
    </bean>
</beans>
The MVC controller that takes the uploaded file is implemented in the "FileController" file:

Hide   Shrink    Copy Code
package com.song.example.controller;

import java.io.InputStream;
import java.util.HashMap;

import javax.servlet.http.HttpServletResponse;

import org.apache.commons.io.IOUtils;
import org.springframework.stereotype.Controller;
import org.springframework.util.Base64Utils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;

@Controller
public class FileController {

    @RequestMapping(value = "/echofile", method = RequestMethod.POST, produces = {"application/json"})
    public @ResponseBody HashMap<String, Object> echoFile(MultipartHttpServletRequest request,
            HttpServletResponse response) throws Exception {

        MultipartFile multipartFile = request.getFile("file");
        Long size = multipartFile.getSize();
        String contentType = multipartFile.getContentType();
        InputStream stream = multipartFile.getInputStream();
        byte[] bytes = IOUtils.toByteArray(stream);

        HashMap<String, Object> map = new HashMap<String, Object>();
        map.put("fileoriginalsize", size);
        map.put("contenttype", contentType);
        map.put("base64", new String(Base64Utils.encode(bytes)));

        return map;
    }
}
The "echoFile()" method takes the uploaded file though the "MultipartHttpServletRequest" object;
It converts the file content into Base64 format and returns the Base64 content in the JSON response;
The goal of this example is to use jQuery Ajax to upload a file to the server and receive the responded JSON object. Now let us take a look at the client side code.

The client side code
The client side code is implemented in the "index.jsp" file. The HTML part of the file is the following:

Hide   Copy Code
<body style="font-family: calibri; font-size: 8pt">
<div>
<form id="fileForm">
    <input type="file" name="file" />
    <button id="btnUpload" type="button">Upload file</button>
    <button id="btnClear" type="button">Clear</button>
</form>
<div id="imgContainer"></div>
</div>
</body>
The Javascript part of the file is the following:

Hide   Shrink    Copy Code
<script type="text/javascript">

var isJpg = function(name) {
    return name.match(/jpg$/i)
};

var isPng = function(name) {
    return name.match(/png$/i)
};

$(document).ready(function() {
    var file = $('[name="file"]');
    var imgContainer = $('#imgContainer');

    $('#btnUpload').on('click', function() {
        var filename = $.trim(file.val());

        if (!(isJpg(filename) || isPng(filename))) {
            alert('Please browse a JPG/PNG file to upload ...');
            return;
        }

        $.ajax({
            url: '<%=baseUrl%>api/echofile',
            type: "POST",
            data: new FormData(document.getElementById("fileForm")),
            enctype: 'multipart/form-data',
            processData: false,
            contentType: false
          }).done(function(data) {
              imgContainer.html('');
              var img = '<img src="data:' + data.contenttype + ';base64,'
                  + data.base64 + '"/>';

              imgContainer.append(img);
          }).fail(function(jqXHR, textStatus) {
              //alert(jqXHR.responseText);
              alert('File upload failed ...');
          });

    });

    $('#btnClear').on('click', function() {
        imgContainer.html('');
        file.val('');
    });
});

</script>
The jQuery reference is to the jQuery CDN "<script src="//code.jquery.com/jquery-2.1.4.min.js"></script>". If you want to run this example on your own computer, you need to make sure that you have the internet access, so your browser can download jQuery from the CDN.

The HTML part declared a file input in an HTML form;
In the click event of the "btnUpload" button, an Ajax call is issued to upload the file. The data to be uploaded is a "FormData" object;
Upon a success Ajax call, a JSON response is received. The JSON object should have the Base64 content responded from the server.
In order to show the responded data, I insisted that only JPG/PNG images can be uploaded. The responded Base64 image will be displayed on the web page.

asp.net - Send value and file from view to controller by ajax method -...

asp.net ajax file controller asp.net-mvc-5
Rectangle 27 0

I think that the problem could be in the manager URL. Try this on your pom.xml :

instead of :

<url>http://localhost:8080/manager</url>

I couldn't find documentation about those URLs (surely exists), but anyway it works for me to deploy to apache-tomcat-6.0.39 using tomcat-maven-plugin v1.1

That's a second possible problem in your pom.xml : you haven't specified which version of the plugin to use. It can work ... but it's error prone. Maven even warns about these things. I use this on my pom.xml :

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>tomcat-maven-plugin</artifactId>
  <version>1.1</version>
  <configuration>
    <url>http://localhost:8080/manager</url>
    <server>MyTomcat</server>
    <path>/agalindo-webui</path>
  </configuration>
</plugin>

There I have specified the server like user944849 sugests on my settings.xml (~/.m2/settings.xml), like this:

<settings>
  <servers>
    <server>
      <id>MyTomcat</id>
      <username>myusername</username>
      <password>mypassword</password>
    </server>
  </servers>
  <!-- .. -->
</settings>

eclipse - How to fix "Cannot invoke Tomcat manager: Server returned HT...

eclipse maven java-ee tomcat
Rectangle 27 0

I have spent over three days on Server returned HTTP response code: 400 while trying to deploy web application onto Tomcat Server 8.0 bundled with Netbeans. When I used mvn tomcat7:deploy over command line, everything worked perfect, but no success through Netbeans IDE. I have set tomcat maven plugin in POM.xml

<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <configuration>
        <url>http://localhost:8080/manager/text</url>
        <server>tomcat</server>
    </configuration>
</plugin>

plus server record in .m2/conf/settings.xml for Maven,

<settings>
    <servers>
        <server>
            <id>tomcat</id>
            <username>admin</username>
            <password>admin</password>
        </server>
    </servers>
</settings>

even appropriate tomcat user in tomcat-users.xml

<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<user username="tomcat" password="tomcat" roles="manager-script,manager-gui"/>

but still without success. The root cause was Proxy server used in our company and Netbeans settings. In Netbeans, go to Tools -> Options and on General tab, use Manual Proxy Settings instead of System Proxy Settings (even if System Proxy Settings works). It helped me and now I am able to deploy web app on Tomcat 8 from Netbeans directly. You can also set No Proxy when you are using only localhost server. Root cause for my trouble was bad proxy set in default web browser, which is the source for option System Proxy Settings.

tomcat-maven-plugin 403 error - Stack Overflow

maven tomcat maven-tomcat-plugin
Rectangle 27 0

I think that the problem could be in the manager URL. Try this on your pom.xml :

instead of :

<url>http://localhost:8080/manager</url>

I couldn't find documentation about those URLs (surely exists), but anyway it works for me to deploy to apache-tomcat-6.0.39 using tomcat-maven-plugin v1.1

That's a second possible problem in your pom.xml : you haven't specified which version of the plugin to use. It can work ... but it's error prone. Maven even warns about these things. I use this on my pom.xml :

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>tomcat-maven-plugin</artifactId>
  <version>1.1</version>
  <configuration>
    <url>http://localhost:8080/manager</url>
    <server>MyTomcat</server>
    <path>/agalindo-webui</path>
  </configuration>
</plugin>

There I have specified the server like user944849 sugests on my settings.xml (~/.m2/settings.xml), like this:

<settings>
  <servers>
    <server>
      <id>MyTomcat</id>
      <username>myusername</username>
      <password>mypassword</password>
    </server>
  </servers>
  <!-- .. -->
</settings>

eclipse - How to fix "Cannot invoke Tomcat manager: Server returned HT...

eclipse maven java-ee tomcat
Rectangle 27 0

If you are using Eclipse with the plugin m2eclipse and you still have this error after trying these solutions, it could be because this plugin has not the manager included. You should download Tomcat separately and configure Eclipse to use it (check this link: tomcat-maven-plugin: Server returned HTTP response code: 403)

tomcat-maven-plugin 403 error - Stack Overflow

maven tomcat maven-tomcat-plugin
Rectangle 27 0

You're using HTTP servlets; Tomcat is running as a Web server. You have to speak HTTP from the client, not serialized Java objects. If you are wanting to use Java serialization, you need to use sockets. If you want to use servlets, you need to use some form of putting your information into HTTP; JSON (with Jackson) is a good choice.

But it works when I send a serialized object, it just crashes when I try to receive one and send it back in the same block.

While this may not be the model of an RPC implementation, there's no reason why serialized Java objects cannot be traded.

Tomcat error: java.io.IOException: Server returned HTTP response code:...

java tomcat servlets http-status-code-405
Rectangle 27 0

I have spent over three days on Server returned HTTP response code: 400 while trying to deploy web application onto Tomcat Server 8.0 bundled with Netbeans. When I used mvn tomcat7:deploy over command line, everything worked perfect, but no success through Netbeans IDE. I have set tomcat maven plugin in POM.xml

<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <configuration>
        <url>http://localhost:8080/manager/text</url>
        <server>tomcat</server>
    </configuration>
</plugin>

plus server record in .m2/conf/settings.xml for Maven,

<settings>
    <servers>
        <server>
            <id>tomcat</id>
            <username>admin</username>
            <password>admin</password>
        </server>
    </servers>
</settings>

even appropriate tomcat user in tomcat-users.xml

<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<user username="tomcat" password="tomcat" roles="manager-script,manager-gui"/>

but still without success. The root cause was Proxy server used in our company and Netbeans settings. In Netbeans, go to Tools -> Options and on General tab, use Manual Proxy Settings instead of System Proxy Settings (even if System Proxy Settings works). It helped me and now I am able to deploy web app on Tomcat 8 from Netbeans directly. You can also set No Proxy when you are using only localhost server. Root cause for my trouble was bad proxy set in default web browser, which is the source for option System Proxy Settings.

tomcat-maven-plugin 403 error - Stack Overflow

maven tomcat maven-tomcat-plugin
Rectangle 27 0

500 Internal Server Error is an Error on the Server, not the Client. If your program is the client, you can't fix this other that telling the server administrator to fix it.

tomcat - java.io.IOException: Server returned HTTP response code: 500 ...

java tomcat servlets applet http-error
Rectangle 27 0

If you are deploying to Tomcat 7, you might consider using the Tomcat 7 Maven plugin from Apache instead of the Codehaus version.

Typically, credentials do not go into the plugin configuration in the POM, as the POM ends up in an artifact repository and is usually shared with other developers. Credentials go in the settings.xml <servers> element, then you configure the plugin to reference that server. This is what the Tomcat 7 plugin usage docs and the Codehaus tomcat plugin describe.

....
<servers>
  <server>
      <id>raspinaserver</id>
      <username>admin</username>
      <password>admin</password>
  </server>
</servers>
...
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>tomcat-maven-plugin</artifactId>
    <configuration>
      <server>raspinaserver</server>
      <path>/azraspina</path>
      <url>http://localhost:8080/manager/html</url>
    </configuration>
</plugin>

thanks for reply. i tried this but didnt solve the problem. i think i move on to jetty

+1 for pointing out that the credentials should better be configured in the settings.xml and NOT in the POM.

eclipse - How to fix "Cannot invoke Tomcat manager: Server returned HT...

eclipse maven java-ee tomcat