最新的DWR2.0M2版本。2.0加了很多东西,也有不少变化的地方。最容易看到的变化就是包名的变化了,由 uk.ltd.getahead 变成了 org.directwebremoting 。
换上了新的配置
1
<
servlet
>
2 < servlet - name > dwr - invoker </ servlet - name >
3 < servlet - class > org.directwebremoting.servlet.DwrServlet </ servlet - class >
4 < init - param >
5 < param - name > debug </ param - name >
6 < param - value > true </ param - value >
7 </ init - param >
8 < load - on - startup > 1 </ load - on - startup >
9 </ servlet >
2 < servlet - name > dwr - invoker </ servlet - name >
3 < servlet - class > org.directwebremoting.servlet.DwrServlet </ servlet - class >
4 < init - param >
5 < param - name > debug </ param - name >
6 < param - value > true </ param - value >
7 </ init - param >
8 < load - on - startup > 1 </ load - on - startup >
9 </ servlet >
启动服务,抱错了。
1
java.lang.IllegalArgumentException: DefaultContainer can
'
t find a classes
2 at org.directwebremoting.impl.DefaultContainer.getBean(DefaultContainer.java: 216 )
3 at org.directwebremoting.annotations.AnnotationsConfigurator.configure(AnnotationsConfigurator.java: 50 )
4 at org.directwebremoting.servlet.DwrServlet.init(DwrServlet.java: 121 )
2 at org.directwebremoting.impl.DefaultContainer.getBean(DefaultContainer.java: 216 )
3 at org.directwebremoting.annotations.AnnotationsConfigurator.configure(AnnotationsConfigurator.java: 50 )
4 at org.directwebremoting.servlet.DwrServlet.init(DwrServlet.java: 121 )
在DWR的Maillist里面搜索了一下,还有答案,原来DWR2.0 加入了JDK5的注释(annotations).DwrServlet初始化的时候会去检查注释的类,找不到就抱错了。如果你不用annotations也可以忽略掉这个错误。不过看起来总是不爽。有人提出了方案。这样就ok了。
1
<
servlet
>
2 < servlet - name > dwr - invoker </ servlet - name >
3 < servlet - class > org.directwebremoting.servlet.DwrServlet </ servlet - class >
4 < init - param >
5 < param - name > debug </ param - name >
6 < param - value > true </ param - value >
7 </ init - param >
8 < init - param >
9 < param - name > classes </ param - name >
10 < param - value > java.lang.Object </ param - value >
11 </ init - param >
12 < load - on - startup > 100 </ load - on - startup >
13 </ servlet >
2 < servlet - name > dwr - invoker </ servlet - name >
3 < servlet - class > org.directwebremoting.servlet.DwrServlet </ servlet - class >
4 < init - param >
5 < param - name > debug </ param - name >
6 < param - value > true </ param - value >
7 </ init - param >
8 < init - param >
9 < param - name > classes </ param - name >
10 < param - value > java.lang.Object </ param - value >
11 </ init - param >
12 < load - on - startup > 100 </ load - on - startup >
13 </ servlet >