小编Bat*_*man的帖子

错误:com.android.volley.ParseError:org.json.JSONException:值<!DOCTYPE类型java.lang.String无法转换为JSONObject

JsonParse.Java试图从URL获取json数组对象,但它抛出了Parsing ERROR,
而CountriedBean是我的POJO类.
parse_json只有ListView,而parse_json_view有4个TextView

任何人都可以帮助我................

private List<CountriesBean> cntries= new ArrayList<CountriesBean>();
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.parse_json);

            RequestQueue queues = Volley.newRequestQueue(JsonParse.this);

            JsonObjectRequest myRequest = new JsonObjectRequest(Request.Method.GET,
                    "https://github.com/SaiNitesh/REST-Web-services/blob/master/RESTfulWS/json_file.json",
                    null,
                    new Response.Listener<JSONObject>() {
                        @Override
                        public void onResponse(JSONObject response) {
                            try{
                                Log.i("myCountries**", "response:" +response);
                            JSONArray countryItems = response.getJSONArray("countryItems");

                            Log.i("myTagx", "response:" +countryItems);

                                for(int i=0; i<countryItems.length();i++){
                                    JSONObject temp= countryItems.getJSONObject(i);

                                    String nm = temp.getString("nm");
                                    String cty = temp.getString("cty");
                                    String hse = temp.getString("hse");
                                    String yrs = temp.getString("yrs");

                                    cntries.add(new CountriesBean(nm, cty, hse, yrs));
                                }
                            } catch(JSONException e){ …
Run Code Online (Sandbox Code Playgroud)

android json android-volley android-json

0
推荐指数
1
解决办法
3132
查看次数

无法使用 @EnableWebMvc 配置运行 SPRING BOOT 应用程序

我是 Spring Boot 的新手,我非常有兴趣学习这项技术。问题是,我得到了一个带有 @configuration 标记的配置文件。因此,当我尝试添加 @enablemvc 注释或者在 Spring Boot 应用程序中添加带有 @enablemvc 注释的新文件时,我无法运行该应用程序。如果有人能帮助我解决这个问题,我真的很感激。

日志

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'resourceHandlerMapping' defined in class path resource [org/springframework/web/servlet/config/annotation/DelegatingWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.HandlerMapping]: Factory method 'resourceHandlerMapping' threw exception; nested exception is org.springframework.beans.factory.BeanInitializationException: Failed to init ResourceHttpRequestHandler; nested exception is java.lang.IllegalStateException: WebApplicationObjectSupport instance [ResourceHttpRequestHandler [locations=[class path resource [resources/], class path resource [images/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@39e6b948]]] does not run in a WebApplicationContext but in: org.springframework.context.annotation.AnnotationConfigApplicationContext@19b44076: startup …
Run Code Online (Sandbox Code Playgroud)

java spring-mvc gradle spring-boot

0
推荐指数
1
解决办法
8328
查看次数