首页 新闻 会员 周边 捐助

新人报道,问题求解决:arcgis server for java adf 自定义task报错

0
[已解决问题] 浏览: 563次 解决于 2015-04-21 09:47

最近在学习 arcgis server for java,看到吴泳锋 王坚的arcgis server java adf 开发教程,就按照步骤来做。

 

在前端添加一个连接 ,弹出task:

<li class="menu-bar">
<a href="#" class="menu-header" title="query task" onclick="wma.toggleWindow('win_EsriTaskCell_queryTask');">
<span> query task </span>
</a>
</li>

task部分:

<a:task id="queryTask" 
value="#{mapContext.attributes.queryTask}" 
taskInfo="#{mapContext.attributes.queryTask.taskInfo}" 
mapId="map1" 
windowingSupport="true"
style="padding:0px;margin:0px;"/>

查询部分代码:

public void query(TaskEvent event) {
//System.out.println(this.getClass().getName() + ":query()");
WebContext webContext = event.getWebContext(); 
WebQuery webQuery = (WebQuery) webContext.getAttribute("query"); 
TextCriteria textCriteria = new TextCriteria(); 
textCriteria.setMaxRecordCount(100); 
textCriteria.setSearchText(this.keyWord); 
List<QueryResult> listQueryResult = webQuery.query(textCriteria, webQuery.getQueryLayers()); 
webContext.getWebGraphics().clearGraphics(); 
for (int i = 0; i < listQueryResult.size(); i++) { 
QueryResult queryResult = listQueryResult.get(i); 
queryResult.highlight(); 

webContext.refresh(); 
}

 

运行后,

但是在我的控制台却出现

警告: Error encountered while caching initial state of the application. This will prevent the application from optimizing session startup times.
java.io.NotSerializableException: asd.QueryTask
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
at java.util.HashMap.writeObject(HashMap.java:1001)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:940)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1469)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:422)
at com.esri.adf.web.data.WebContext.writeObject(WebContext.java:2147)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:940)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1469)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
at java.util.ArrayList.writeObject(ArrayList.java:570)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:940)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1469)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
at com.esri.adf.web.util.ADFFilter.a(ADFFilter.java:244)
at com.esri.adf.web.util.ADFFilter.doFilter(ADFFilter.java:130)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.esri.adf.web.util.ADFSessionTimeoutFilter.doFilter(ADFSessionTimeoutFilter.java:137)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:861)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584)
at java.lang.Thread.run(Thread.java:662)
Could not load mediaLib accelerator wrapper classes. Continuing in pure Java mode.

 

不懂了。 如何解决 。。。  求大神指点。

谁说不可以重名的主页 谁说不可以重名 | 初学一级 | 园豆:15
提问于:2015-04-20 15:50
< > 字节跳动旗下AI助手豆包
分享
最佳答案
1

添加如下的代码试试:

/**
* this gets rid of exception for not using native acceleration
*/
static
{
    System.setProperty("com.sun.media.jai.disableMediaLib", "true");
}

参考:get rid of "Could not find mediaLib accelerator wrapper classes"

奖励园豆:5
dudu | 高人七级 |园豆:29737 | 2015-04-20 15:57

     是在我的查询方法里加么?

谁说不可以重名 | 园豆:15 (初学一级) | 2015-04-20 16:03

很感谢   

Could not load mediaLib accelerator wrapper classes. Continuing in pure Java mode.

这个错误没有了  

 

谁说不可以重名 | 园豆:15 (初学一级) | 2015-04-20 16:04
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册
Top