错误一:
405的错误表示是资源被禁止HTTP.一般出现"Requestmethod 'post' not supported"的原因有两个"
1.在JSP页面没有调用post()方法引起的.
2.在servlet中跳转没有外跳(response.sendRedirect).
在Springmvc项目中,页面的form表单中设置了method="post",但是仍然报这个错,那么解决方案:
把controller中
@RequestMapping("/testModelAttribute")
修改为:
@RequestMapping(value="/testModelAttribute",method = RequestMethod.POST)
错误二:
原因:由类方法处的@SessionAttributes引起的.
解决方案:
(一)把类上方的注解@SessionAttributes(value={"user"},types={String.class})去掉就行:
(二)创建注解为@ModelAttrubutes的方法,如下:
@ModelAttribute
public void getUser(@RequestParam(value="id",required=false) Integer id,
Map<String, Object> map){
System.out.println("modelAttribute method");
if(id != null){
……..
}
}
(三)在方法中使用@@ModelAttribute标识一个和@SessionAttributes注解的value值不一样,例如:
@SessionAttributes(value={"user"}, types={String.class})
@RequestMapping("/springmvc")
@Controller
public class SpringMVCTest {
public String testModelAttribute(@ModelAttribute("abc")User user){
…….
}
}
错误三:
ERROR[org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/itoo-basic-professional-web].[action]](http-localhost/127.0.0.1:8080-2) 58846 260 JBWEB000236: Servlet.service() forservlet action threw exception: java.lang.IllegalStateException:EJBCLIENT000025: No EJB receiver available for handling [appName:java:global,moduleName:itoo-basic-professional-ear,distinctName:itoo-basic-teacher-core-0.0.1-SNAPSHOT] combination for invocationcontext org.jboss.ejb.client.EJBClientInvocationContext@5ef94da4
原因是jboss远程调用的时候,配置文件缺少配置语句.
Jboss-ejb-client.properties配置文件缺少:
org.jboss.ejb.client.scoped.context=true
正确配置:
endpoint.name=client-endpoint
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
org.jboss.ejb.client.scoped.context=true
jboss.naming.client.ejb.context=true
Context.URL_PKG_PREFIXES=org.jboss.ejb.client.naming
javax.naming.Context.INITIAL_CONTEXT_FACTORY=org.jboss.naming.remote.client.InitialContextFactory
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
remote.connectionprovider.create.options.org.xnio.Options.SSL_STARTTLS=false
jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT=false
remote.connections=one
remote.connection.one.host=192.168.24.246
remote.connection.one.port=4444
remote.connection.one.username=lishehe
remote.connection.one.password=!lishehe123456
希望分享的错误能解决你的燃眉之急.