Did you get the error below when trying to post a form?
org.springframework.web.client.HttpClientErrorException: 405 Method Not Allowed
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:91)
at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:614)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:570)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:530)
at org.springframework.web.client.RestTemplate.postForEntity(RestTemplate.java:357)
...
Here's how I fixed it:
open the controller class and go to the method that handles the request:
@RestController
@RequestMapping("/my-mapping")
public class MyController
@RequestMapping(value = "/commands/MyCommand", method = RequestMethod.PUT)
public void invoke(@RequestBody MyCommand command) {
...
change the method from RequestMethod.PUT (or whatever the value is) to RequestMethod.POST.
Restart the server and post the form again. That should fix the error
Thursday, June 25, 2015
Wednesday, June 24, 2015
How to fix "ERROR: Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options." error
Did you get the error below when you tried to launch tomcat in debug mode?
"Error occurred during initialization of VM
agent library failed to init: jdwp
ERROR: Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options."
Here's how to fix it:
I'm using Spring STS 3.6.4 (which essentially is Eclipse tailored for Spring). So the screenshots may not exactly the same as Eclipse.
In Eclipse IDE, open the server tab.
Double click the server instance that you're trying to start. This will open the server overview tab.
Under General Information click the "Open launch configuration link"
Select the Arguments tab
In the VM arguments text area, look for -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
and remove it.
Click OK to save
Launch tomcat in debug again. The error should go away.
"Error occurred during initialization of VM
agent library failed to init: jdwp
ERROR: Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options."
Here's how to fix it:
I'm using Spring STS 3.6.4 (which essentially is Eclipse tailored for Spring). So the screenshots may not exactly the same as Eclipse.
In Eclipse IDE, open the server tab.
Double click the server instance that you're trying to start. This will open the server overview tab.
Under General Information click the "Open launch configuration link"
Select the Arguments tab
In the VM arguments text area, look for -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
and remove it.
Click OK to save
Launch tomcat in debug again. The error should go away.
Thursday, June 18, 2015
How to fix "Failed to execute goal org.apache.maven.plugins:maven-eclipse-plugin:2.7:eclipse (default-cli) on project XXX-webapp: Cant canonicalize system path: {0}: The filename, directory name, or volume label syntax is incorrect -> [Help 1]" error
Are you getting the following cryptic error message from Maven when trying to execute the eclipse:eclipse goal?
Here's how to fix it:
Open your pom.xml and look for the <resource> tag. If it looked like this:
change it to this:
Then run your maven goal eclipse:eclipse again. That should fix it.
Maven goal: eclipse:eclipse
...
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time:
14.650 s
[INFO] Finished at:
2015-06-18T16:19:38-08:00
[INFO] Final Memory:
32M/357M
[INFO]
------------------------------------------------------------------------
[ERROR] Failed to
execute goal org.apache.maven.plugins:maven-eclipse-plugin:2.7:eclipse
(default-cli) on project xxx-webapp: Cant canonicalize system path: {0}: The filename, directory name, or
volume label syntax is incorrect -> [Help 1]
[ERROR]
[ERROR] To see the
full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven
using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more
information about the errors and possible solutions, please read the following
articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
Open your pom.xml and look for the <resource> tag. If it looked like this:
<build>
<resources>
<resource>
<directory>src/main/config/tomcat/META-INF</directory>
<filtering>true</filtering>
<targetPath>${project.build.directory}/m2e-wtp/web-resources/META-INF</targetPath>
</resource>
…
change it to this:
<resource>
<directory>src/main/config/tomcat/META-INF</directory>
<filtering>true</filtering>
<targetPath>m2e-wtp/web-resources/META-INF</targetPath>
</resource>
Then run your maven goal eclipse:eclipse again. That should fix it.
Subscribe to:
Posts (Atom)