【java】itoo项目实战之常见问题三

错误一:

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

希望分享的错误能解决你的燃眉之急.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 13
    评论
评论 13
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

弯_弯

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值