Android代码Value of type java.lang.String cannot be converted to JSONObject 5C

在创建jsonObject对象时报错,result是发送poast请求返回的json内容

JSONObject jsonObject = new JSONObject(result);
试了网上说的什么UTF-8 BOM头的问题的方法还是不行,
哪位大神帮忙看一下

W/System.err: org.json.JSONException: Value {"mid":"004YVmzL0O67WR","m4a":"http:\/\/dl.stream.mmmusic.gg.com\/C400004YVmzL0O67WR.m4a?guid=2095717240&skey=CC1743DB70C0AFD81B6CD9A4826F619D0A60FBF859D5238D87EEA2DDEB50D1D6BF1732FDFB30E6C70648F4A57CBC2BAC740D22E1F7D2ED88&uin=0&fromtag=38","mp3_l":"http:\/\/dl.stream.mmmusic.gg.com\/M500004YVmzL0O67WR.mp3?guid=2095717240&skey=CC1743DB70C0AFD81B6CD9A4826F619D0A60FBF859D5238D87EEA2DDEB50D1D6BF1732FDFB30E6C70648F4A57CBC2BAC740D22E1F7D2ED88&uin=0&fromtag=53","mp3_h":"http:\/\/dl.stream.mmmusic.gg.com\/M800004YVmzL0O67WR.mp3?guid=2095717240&skey=CC1743DB70C0AFD81B6CD9A4826F619D0A60FBF859D5238D87EEA2DDEB50D1D6BF1732FDFB30E6C70648F4A57CBC2BAC740D22E1F7D2ED88&uin=0&fromtag=53","ape":"http:\/\/dl.stream.mmmusic.gg.com\/A000004YVmzL0O67WR.ape?guid=2095717240&skey=CC1743DB70C0AFD81B6CD9A4826F619D0A60FBF859D5238D87EEA2DDEB50D1D6BF1732FDFB30E6C70648F4A57CBC2BAC740D22E1F7D2ED88&uin=0&fromtag=53","flac":"http:\/\/dl.stream.mmmusic.gg.com\/F000004YVmzL0O67WR.flac?guid=2095717240&skey=CC1743DB70C0AFD81B6CD9A4826F619D0A60FBF859D5238D87EEA2DDEB50D1D6BF1732FDFB30E6C70648F4A57CBC2BAC740D22E1F7D2ED88&uin=0&fromtag=53","songname":"\u7ae5\u8bdd\u9547","albumname":"\u7ae5\u8bdd\u9547","singername":"\u8bb8\u5a1c","pic":"https:\/\/y.gtimg.cn\/music\/photo_new\/T002R300x300M000000fglnt1hPvpJ.jpg?max_age=2592000"} of type java.lang.String cannot be converted to JSONObject
W/System.err: at org.json.JSON.typeMismatch(JSON.java:112)
at org.json.JSONObject.(JSONObject.java:163)
at org.json.JSONObject.(JSONObject.java:176)

3个回答

也不知道你的json本身不对还是没有贴对。如果不是bom的问题,那么就是你的json本身不对了。比如说,目测下\u7ae5\u8bdd\u9547,其中斜杠没有转义,注意java里需要转义,json里还需要

这个应该格式化一下,而不能直接new吧。看看有没有类似的parse、toJSON、macth等函数。

肯定会报错啊,这个地方要加try catch捕获异常的,官方有介绍

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Value  of type java.lang.String cannot be
public class Register_ extends Activity{ private ProgressDialog pDialog; JSONParser jsonParser = new JSONParser(); EditText name; EditText password; Button login_button; private static String url = "http://192.168.1.203/EnjoyDemo/test.php"; private static final String TAG_MESSAGE = "message"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.signup); name=(EditText)findViewById(R.id.editText1); password=(EditText)findViewById(R.id.editText2); login_button=(Button)findViewById(R.id.button1); login_button.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { if(validate()){ new Up().execute(); } } }); } private boolean validate() { String name1 = name.getText().toString().trim(); if (name1.equals("")) { DialogUtil.showDialog(this, "����û����д����", false); return false; } String password1 = password.getText().toString().trim(); if (password1.equals("")) { DialogUtil.showDialog(this, "����û����д����", false); return false; } return true; } class Up extends AsyncTask<String, String, String> { @Override protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDialog(Register_.this); pDialog.setMessage("�����ϴ�.."); pDialog.setIndeterminate(false); pDialog.setCancelable(true); pDialog.show(); } protected String doInBackground(String... args) { String name1 = name.getText().toString(); String password1 = password.getText().toString(); List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("name", name1)); params.add(new BasicNameValuePair("password", password1)); try{ JSONObject json = jsonParser.makeHttpRequest(url, "POST", params); String message = json.getString(TAG_MESSAGE); return message; }catch(Exception e){ e.printStackTrace(); return ""; } } } } public class JSONParser { static InputStream is = null; static JSONObject jObj = null; static String json = ""; // constructor public JSONParser() { } // function get json from url // by making HTTP POST public JSONObject makeHttpRequest(String url, String method, List<NameValuePair> params) { // Making HTTP request try { // request method is POST // defaultHttpClient DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); httpPost.setEntity(new UrlEncodedFormEntity(params,HTTP.UTF_8)); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); is = httpEntity.getContent(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } try { BufferedReader reader = new BufferedReader(new InputStreamReader( is, "UTF-8")); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } is.close(); json = sb.toString(); } catch (Exception e) { Log.e("Buffer Error", "Error converting result " + e.toString()); Log.d("json", json.toString()); } // try parse the string to a JSON object try { jObj = new JSONObject(json); } catch (JSONException e) { Log.e("JSON Parser", "Error parsing data " + e.toString()); } // return JSON String return jObj; } } 做注册界面传输json字符串时出现了这个错误 菜鸟初学 没有指导不知道该怎么做了。。。有没有人指导下怎么改 谢谢了 只有这个错误显示 org.json.JSONException: Value  of type java.lang.String cannot be converted to JSONObject
按照第一行代码上打酷欧天气提示我 Value Request of type java.lang.String cannot be converte
12-28 19:54:35.763 7686-8889/com.example.administrator.kuou W/System.err: org.json.JSONException: Value Request of type java.lang.String cannot be converted to JSONObject 12-28 19:54:35.763 7686-8889/com.example.administrator.kuou W/System.err: at org.json.JSON.typeMismatch(JSON.java:111) 12-28 19:54:35.763 7686-8889/com.example.administrator.kuou W/System.err: at org.json.JSONObject.<init>(JSONObject.java:160) 12-28 19:54:35.763 7686-8889/com.example.administrator.kuou W/System.err: at org.json.JSONObject.<init>(JSONObject.java:173) 12-28 19:54:35.763 7686-8889/com.example.administrator.kuou W/System.err: at com.example.administrator.kuou.util.Utility.handleWeatherResponse(Utility.java:125) 12-28 19:54:35.764 7686-8889/com.example.administrator.kuou W/System.err: at com.example.administrator.kuou.WeatherActivity$1.onResponse(WeatherActivity.java:91) 12-28 19:54:35.764 7686-8889/com.example.administrator.kuou W/System.err: at okhttp3.RealCall$AsyncCall.execute(RealCall.java:126) 12-28 19:54:35.764 7686-8889/com.example.administrator.kuou W/System.err: at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) 12-28 19:54:35.764 7686-8889/com.example.administrator.kuou W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 12-28 19:54:35.764 7686-8889/com.example.administrator.kuou W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 12-28 19:54:35.764 7686-8889/com.example.administrator.kuou W/System.err: at java.lang.Thread.run(Thread.java:760) 12-28 19:54:35.764 7686-7686/com.example.administrator.kuou D/TAG: run: null 12-28 19:54:35.782 7686-7686/com.example.administrator.kuou I/Toast: Show toast from OpPackageName:com.example.administrator.kuou, PackageName:com.example.administrator.kuou ``` ```public static Weather handleWeatherResponse(String response) { try { // 将整个json实例化保存在jsonObject中 JSONObject jsonObject = new JSONObject(response); // 从jsonObject中取出键为"HeWeather"的数据,并保存在数组中 JSONArray jsonArray = jsonObject.getJSONArray("Weather"); // 取出数组中的第一项,并以字符串形式保存 String weatherContent = jsonArray.getJSONObject(0).toString(); // 返回通过Gson解析后的Weather对象 return new Gson().fromJson(weatherContent, Weather.class); } catch (JSONException e) { e.printStackTrace(); } return null; }
java.lang.ClassCastException: com.easy.demo.entity.User cannot be cast to java.lang.String
``` @RequestMapping(value={"/login"}, method=RequestMethod.GET) public boolean login(HttpServletRequest request, @Param(value = "number")String number, @Param(value = "password")String password) throws UnsupportedEncodingException, NoSuchAlgorithmException { number = request.getParameter("number"); password = request.getParameter("password"); // 获取加密后的密码 password password = MD5Util.getEncryptedPwd(password); // 获取数据库对应账户密码, findPasswordByAccount 查询数S据库账号的密码 // userService 业务实现内部调用userDao 去执行select 语句,可以吧 String encryptPassword = userMapper.findPasswordByNumber(number); System.out.println(encryptPassword); // 比对数据库中的密码 encryptPassword if (password.equals(encryptPassword)) { return true; } else { return false; } } ``` 下面是有关方法的片段 ``` //userMapper的 User login(String number,String password); String findPasswordByNumber(String number); //userService void login(String number,String password); String findPasswordByNumber(String number); //userServiceImpl @Override public void login(String number,String password){ userMapper.login(number,password); } @Override public String findPasswordByNumber(String number){ String password = userMapper.findPasswordByNumber(number); return password; } //userMapper.xml <select id="login" resultMap="result"> SELECT * FROM user where number=#{number} and password=#{password} </select> <select id="findPasswordByNumber" resultMap="result"> SELECT password FROM user where number=#{number} </select> ``` 如题出现的异常报错要怎么解决?想了半天也没弄懂,求大佬解答一下!!!
安卓解析JSON时候出现的问题
Value http of type java.lang.String cannot be converted to JSONObject
运行mapredurce出现Method threw 'java.lang.IllegalStateException' exception. Cannot evaluate org.apache.hadoop.mapreduce.Job.toString()
执行下述代码后在,创建job后会有上述异常,但是可以执行到最后,但是job没有提交上去执行,在历史里也看不到有执行记录求帮助新手o(╥﹏╥)o。 package MapReducer; import com.sun.org.apache.bcel.internal.generic.RETURN; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mapreduce.Reducer; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.input.TextInputFormat; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat; import org.apache.hadoop.util.Tool; import org.apache.hadoop.util.ToolRunner; import java.io.File; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.util.StringTokenizer; /** * @Describe MapReducer第一个读取文档并计数 * @Author zhanglei * @Date 2019/11/18 22:53 **/ public class WordCountApp extends Configured implements Tool { public int run(String[] strings) throws Exception { String input_path="hdfs://192.168.91.130:8020/data/wc.txt"; String output_path="hdfs://192.168.91.130:8020/data/outputwc"; Configuration configuration = getConf(); final FileSystem fileSystem = FileSystem.get(new URI(input_path),configuration); if(fileSystem.exists(new Path(output_path))){ fileSystem.delete(new Path(output_path),true); } Job job = Job.getInstance(configuration,"WordCountApp"); job.setJarByClass(WordCountApp.class); job.setMapperClass(WordCountMapper.class); job.setOutputKeyClass(Text.class); job.setOutputValueClass(IntWritable.class); job.setReducerClass(WordCountReducer.class); job.setInputFormatClass(TextInputFormat.class); Path inpath = new Path(input_path); FileInputFormat.addInputPath(job,inpath); job.setOutputFormatClass(TextOutputFormat.class); Path outpath = new Path(output_path); FileOutputFormat.setOutputPath(job,outpath); return job.waitForCompletion(true) ? 0:1; } //继承 public static class WordCountMapper extends Mapper<Object,Text,Text,IntWritable>{ private final static IntWritable one= new IntWritable(1); private Text word = new Text(); public void map(Object key,Text value,Context context) throws IOException, InterruptedException { Text t = value; StringTokenizer itr = new StringTokenizer(value.toString()); while(itr.hasMoreTokens()){ word.set(itr.nextToken()); context.write(word,one); } } } public static class WordCountReducer extends Reducer<Object,Text,Text,IntWritable>{ private final static IntWritable res= new IntWritable(1); public void reduce(Text key,Iterable<IntWritable> values,Context context) throws IOException, InterruptedException { int sum = 0; for(IntWritable val:values){ sum+=val.get(); } res.set(sum); context.write(key,res); } } public static void main(String[] args) throws Exception { int exitCode = ToolRunner.run(new WordCountApp(), args); System.exit(exitCode); } }
修改图片保存 400 控制台只打印一条数据 有没有哪位大神遇到过
这是控制台打印的 Field error in object 'film' on field 'imageName': rejected value [org.springframework.web.multipart.support.StandardMultipartHttpServletRequest$StandardMultipartFile@5d83e8de]; codes [typeMismatch.film.imageName,typeMismatch.imageName,typeMismatch.java.lang.String,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [film.imageName,imageName]; arguments []; default message [imageName]]; default message [Failed to convert property value of type 'org.springframework.web.multipart.support.StandardMultipartHttpServletRequest$StandardMultipartFile' to required type 'java.lang.String' for property 'imageName'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'org.springframework.web.multipart.support.StandardMultipartHttpServletRequest$StandardMultipartFile' to required type 'java.lang.String' for property 'imageName': no matching editors or conversion strategy found]] Controller 代码![图片说明](https://img-ask.csdn.net/upload/201811/27/1543284630_12136.png) 报错信息
java,用foreach循环list出现的错误
Cannot convert value of type [java.util.ArrayList] to required type [java.lang.String] for property 'items': no matching editors or conversion strategy found
JDK1.7中java.lang.String类的toCharArray方法注释:不能用Arrays.copyOf实现?求解惑
JDK1.7重新设计了String类,各个String对象各自维护一个属于自身的char数组,下面是该类中的toCharArray方法的实现源码: public char[] toCharArray() { // Cannot use Arrays.copyOf because of class initialization order issues char result[] = new char[value.length]; System.arraycopy(value, 0, result, 0, value.length); return result; } 这个方法中有一段注释,说不能使用Arrays.copyOf方法来实现,请问为什么?在下不太明白注释中的解释,还请高手指教:)。 另外,在String的以char[]为参数的构造方法中却正常地使用了Arrays.copyOf方法。源码如下: public String(char value[]) { this.value = Arrays.copyOf(value, value.length); } 为什么toCharArray不能用Arrays.copyOf来实现?为什么构造方法就可以了呢?请高人解惑呀:)。
关于struts2日期类型转换问题
search实体里是 private Timestamp createTime; get.. set... jsp页面 <input name="search.createTime" type="text" value="${search.createTime}" /> 输入的信息是:2010-09-12 已提交就显示 # Messages: java.lang.String cannot be cast to java.util.Date File: org/hibernate/type/TimestampType.java Stacktraces java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Date 请问该如何操作呢
spring+junit4测试报错,求大神解答
java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:308) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:220) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:301) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:303) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loginLogDao': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.jdbc.core.JdbcTemplate com.baobaotao.dao.LoginLogDao.jdbcTemplate; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdbcTemplate' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'javax.sql.DataSource' for property 'dataSource'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425) at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:84) at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1) at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:280) at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:304) ... 24 more Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.jdbc.core.JdbcTemplate com.baobaotao.dao.LoginLogDao.jdbcTemplate; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdbcTemplate' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'javax.sql.DataSource' for property 'dataSource'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:502) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:282) ... 38 more Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdbcTemplate' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'javax.sql.DataSource' for property 'dataSource'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:844) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:786) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:474) ... 40 more Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'javax.sql.DataSource' for property 'dataSource'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:462) at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:499) at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:493) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1371) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1330) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) ... 49 more Caused by: java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231) at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:447) ... 55 more
springmvc2.5中绑定表单日期字段报错,请大神帮忙
action为MultiActionController 绑字数据方法为 Article formData = (Article)newCommandObject(Article.class); bind(request, formData); 其中有一个字段类型为Date型 页面文件字段为<input name='createTime' value='201207-24'/> 提示:Errors binding onto object 'command'; nested exception is org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors Field error in object 'command' on field 'createTime': rejected value [2012-07-24]; codes [typeMismatch.command.createTime,typeMismatch.createTime,typeMismatch.java.sql.Timestamp,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [command.createTime,createTime]; arguments []; default message [createTime]]; default message [Failed to convert property value of type [java.lang.String] to required type [java.sql.Timestamp] for property 'createTime'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [java.sql.Timestamp] for property 'createTime': no matching editors or conversion strategy found] •返回 请问如何解决????????
Error parsing data org.json.JSONException:
Android环境是wampserver+eclipse,在网上找了个demo,想实现初步的注册和登录功能.但是测试的时候报了Error parsing data org.json.JSONException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject,卡住了。求解... logcat打印的信息: ``` 11-17 15:40:04.666: D/Log_Debug(14690): this json<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> 11-17 15:40:04.666: D/Log_Debug(14690): <HTML><HEAD><TITLE>Bad Request</TITLE> 11-17 15:40:04.666: D/Log_Debug(14690): <META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD> 11-17 15:40:04.666: D/Log_Debug(14690): <BODY><h2>Bad Request - Invalid Header</h2> 11-17 15:40:04.666: D/Log_Debug(14690): <hr><p>HTTP Error 400. The request has an invalid header name.</p> 11-17 15:40:04.666: D/Log_Debug(14690): </BODY></HTML> 11-17 15:40:04.669: E/JSON Parser(14690): Error parsing data org.json.JSONException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject 11-17 15:40:04.671: W/System.err(14690): java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String org.json.JSONObject.getString(java.lang.String)' on a null object reference
spring boot mybatis 枚举错误,无法映射
spring boot mybatis 枚举错误 * 今天遇到一个问题,解决了好几个小时,没有搞定,搞到现在,有大佬可以帮我看下吗?万分感谢,没有分了,枚举映射,在idea中可以使用, 部署使用java -jar 方式就报错 * jdk1.8 * mybatis3.0.7.1 * application.yml环境为prod * ``` mybatis-plus: #枚举 typeHandlersPackage: com.xxx.common.module.handler ``` 1. Enum代码 ``` /** * Enum - 状态 * * @author xxx * @version 1.0.0 */ @JSONType(serializeEnumAsJavaBean = true) @JsonFormat(shape = JsonFormat.Shape.OBJECT) public enum StatusEnum implements BaseEnum<StatusEnum, Integer> { /** 删除 */ 删除(-1, "删除"), /** 无效 */ 无效(0, "无效"), /** 有效 */ 有效(1, "有效"); /** * 值. */ private Integer value; /** * 名称. */ private String name ; static { subClass.add(StatusEnum.class); } StatusEnum(Integer value, String name) { this.value = value; this.name = name; } @Override public Integer getValue() { return value; } public void setValue(Integer value) { this.value = value; } @Override public String getName() { return name; } public void setName(String name) { this.name = name; } //根据key获取枚举 public static StatusEnum getEnumByValue(Integer value){ if (null == value){ return null; } for(StatusEnum e: StatusEnum.values()){ if(e.getValue().equals(value)){ return e; } } return null; } } ``` 2. 枚举转换处理器 ``` package com.xxx.common.module.handler; import com.xxx.common.module.enums.*; import lombok.extern.slf4j.Slf4j; import org.apache.ibatis.type.BaseTypeHandler; import org.apache.ibatis.type.JdbcType; import org.apache.ibatis.type.MappedTypes; import java.sql.CallableStatement; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; /** * 枚举转换处理器 * * @author xxx * @version 1.0.0 */ @Slf4j @MappedTypes(value = {StatusEnum.class}) public final class BaseEnumTypeHandler<E extends BaseEnum> extends BaseTypeHandler<E> { private Class<E> type; private E[] enums; public BaseEnumTypeHandler() { } public BaseEnumTypeHandler(Class<E> type) { if (type == null) { throw new IllegalArgumentException("Type argument cannot be null"); } this.type = type; this.enums = this.type.getEnumConstants(); if (this.enums == null) { throw new IllegalArgumentException(type.getSimpleName() + " does not represent an enum type."); } } @Override public void setNonNullParameter(PreparedStatement ps, int i, E parameter, JdbcType jdbcType) throws SQLException { //BaseTypeHandler 进行非空校验 log.debug("index : {}, parameter : {},jdbcType : {} ", i, parameter.getValue(), jdbcType); if (jdbcType == null) { ps.setObject(i, parameter.getValue()); } else { ps.setObject(i, parameter.getValue(), jdbcType.TYPE_CODE); } } @Override public E getNullableResult(ResultSet rs, String columnName) throws SQLException { Object code = rs.getObject(columnName); if (rs.wasNull()) { return null; } return getEnmByCode(code); } @Override public E getNullableResult(ResultSet rs, int columnIndex) throws SQLException { Object code = rs.getObject(columnIndex); if (rs.wasNull()) { return null; } return getEnmByCode(code); } @Override public E getNullableResult(CallableStatement cs, int columnIndex) throws SQLException { Object code = cs.getObject(columnIndex); if (cs.wasNull()) { return null; } return getEnmByCode(code); } private E getEnmByCode(Object code) { if (code == null) { throw new NullPointerException("the result code is null " + code); } if (code instanceof Integer) { for (E e : enums) { if (e.getValue() == code) { return e; } } throw new IllegalArgumentException("Unknown enumeration type , please check the enumeration code : " + code); } if (code instanceof String) { for (E e : enums) { if (code.equals(e.getValue())) { return e; } } throw new IllegalArgumentException("Unknown enumeration type , please check the enumeration code : " + code); } throw new IllegalArgumentException("Unknown enumeration type , please check the enumeration code : " + code); } } ``` 3. 报错信息 2020-01-20 02:45:35.879 ERROR 2472 --- [nio-8081-exec-1] c.l.exception.RRExceptionHandler : nested exception is org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'status' from result set. Cause: java.lang.IllegalArgumentException: No enum constant com.xxx.common.module.enums.StatusEnum.1 * org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'status' from result set. Cause: java.lang.IllegalArgumentException: No enum constant com.xxx.common.module.enums.StatusEnum.1 * at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77) * at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446) * at com.sun.proxy.$Proxy132.selectList(Unknown Source) * at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:230) * at com.baomidou.mybatisplus.core.override.PageMapperMethod.executeForMany(PageMapperMethod.java:173) * at com.baomidou.mybatisplus.core.override.PageMapperMethod.execute(PageMapperMethod.java:86) * at com.baomidou.mybatisplus.core.override.PageMapperProxy.invoke(PageMapperProxy.java:64) * at com.sun.proxy.$Proxy137.selectList(Unknown Source) * at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.getOne(ServiceImpl.java:259) * at com.baomidou.mybatisplus.extension.service.IService.getOne(IService.java:230) * at com.xxx.common.module.service.impl.AppServiceImpl.queryByAppKey(AppServiceImpl.java:100) * at com.xxx.common.module.service.impl.AppServiceImpl$$FastClassBySpringCGLIB$$9380a940.invoke(<generated>) * at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) * at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:684) * at com.xxx.common.module.service.impl.AppServiceImpl$$EnhancerBySpringCGLIB$$307b01.queryByAppKey(<generated>) * at com.xxx.common.module.service.impl.AppInfoServiceImpl.validateBaseApi(AppInfoServiceImpl.java:141) * at com.xxx.common.module.service.impl.AppInfoServiceImpl.appInfo(AppInfoServiceImpl.java:157) * at com.xxx.common.module.service.impl.AppInfoServiceImpl$$FastClassBySpringCGLIB$$2bb67632.invoke(<generated>) * at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) * at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:684) * at com.xxx.common.module.service.impl.AppInfoServiceImpl$$EnhancerBySpringCGLIB$$8bd88917.appInfo(<generated>) * at com.xxx.controller.ApiAppProductController.list(ApiAppProductController.java:79) * at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) * at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) * at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) * at java.lang.reflect.Method.invoke(Method.java:483) * at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:189) * at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) * at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) * at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) * at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:800) * at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) * at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038) * at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942) * at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005) * at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:908) * at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) * at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882) * at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) * at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) * at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) * at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) * at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) * at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) * at com.xxx.common.xss.XssFilter.doFilter(XssFilter.java:24) * at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) * at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) * at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) * at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) * at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) * at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) * at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) * at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) * at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) * at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) * at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) * at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) * at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) * at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) * at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) * at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) * at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) * at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) * at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) * at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) * at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) * at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) * at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) * at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) * at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) * at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) * at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) * at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834) * at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1417) * at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) * at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) * at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) * at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) * at java.lang.Thread.run(Thread.java:745) * Caused by: org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'status' from result set. Cause: java.lang.IllegalArgumentException: No enum constant com.xxx.common.module.enums.StatusEnum.1 * at org.apache.ibatis.type.BaseTypeHandler.getResult(BaseTypeHandler.java:68) * at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.applyAutomaticMappings(DefaultResultSetHandler.java:520) * at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.getRowValue(DefaultResultSetHandler.java:401) * at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValuesForSimpleResultMap(DefaultResultSetHandler.java:355) * at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValues(DefaultResultSetHandler.java:330) * at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSet(DefaultResultSetHandler.java:303) * at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSets(DefaultResultSetHandler.java:196) * at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:64) * at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79) * at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) * at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) * at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) * at java.lang.reflect.Method.invoke(Method.java:483) * at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63) * at com.sun.proxy.$Proxy200.query(Unknown Source) * at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63) * at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:326) * at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) * at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:136) * at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148) * at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141) * at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) * at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) * at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) * at java.lang.reflect.Method.invoke(Method.java:483) * at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433) * ... 77 common frames omitted * Caused by: java.lang.IllegalArgumentException: No enum constant com.xxx.common.module.enums.StatusEnum.1 * at java.lang.Enum.valueOf(Enum.java:238) * at org.apache.ibatis.type.EnumTypeHandler.getNullableResult(EnumTypeHandler.java:49) * at org.apache.ibatis.type.EnumTypeHandler.getNullableResult(EnumTypeHandler.java:26) * at org.apache.ibatis.type.BaseTypeHandler.getResult(BaseTypeHandler.java:66) * ... 102 common frames omitted
java.lang.ClassCastException
public class ipSort { public static class Map extends Mapper<LongWritable, IntWritable, IntWritable, Text>{ //将输入文件转换成<ipNum,ipAdd>的形式 private final static IntWritable ipNum = new IntWritable(); private Text ipAdd = new Text(); public void map(LongWritable key, IntWritable value, Context context) throws IOException, InterruptedException{ //把每一行转成字符串 String line = value.toString(); // 分割每一行 StringTokenizer token = new StringTokenizer(line); //solve every line while(token.hasMoreElements()){ //divided by blank StringTokenizer tokenLine = new StringTokenizer(token.nextToken()); ipAdd.set(token.nextToken().trim()); ipNum.set(Integer.valueOf(token.nextToken().trim())); context.write(ipNum,new Text(ipAdd)); } } } public static class Reduce extends Reducer<IntWritable, Text, Text, IntWritable>{ //把Map阶段的输出结果颠倒; private Text result = new Text(); public void reduce(IntWritable key,Iterable<Text> values, Context context) throws IOException, InterruptedException{ for(Text val : values){ result.set(val.toString()); context.write(new Text(result),key); } } } public static class IntKeyDescComparator extends WritableComparator{ protected IntKeyDescComparator(){ super(IntWritable.class,true); } public int compare(WritableComparable a, WritableComparable b){ return super.compare(a, b); } } public static void main(String args[]) throws IOException, ClassNotFoundException, InterruptedException{ System.setProperty("hadoop.home.dir", "C:\\Users\\lenovo\\Desktop\\hadoop-2.6.0\\hadoop-2.6.0"); Configuration conf = new Configuration(); conf.set("mapred.job.tracker", "192.168.142.138"); Job job = new Job(conf,"ipSort"); job.setJarByClass(ipSort.class); job.setSortComparatorClass(IntKeyDescComparator.class); job.setMapperClass(Map.class); job.setReducerClass(Reduce.class); job.setOutputKeyClass(IntWritable.class); job.setOutputValueClass(Text.class); FileInputFormat.addInputPath(job, new Path("hdfs://10.170.54.193:9000/input")); FileOutputFormat.setOutputPath(job, new Path("hdfs://10.170.54.193:9000/output")); System.exit(job.waitForCompletion(true)?0:1); } 运行时出现问题Caused by: java.lang.ClassCastException: org.apache.hadoop.io.Text cannot be cast to org.apache.hadoop.io.IntWritable,但是找不到哪里类型转换错误了
求解这个异常怎么回事
String resultStr = response.body().string(); JSONObject jsonObj = new JSONObject(resultStr); String iconImg = jsonObj.getString("iconImg"); String result = jsonObj.getString("result"); 运行 就报这个异常 org.json.JSONException: Value 260 of type java.lang.Integer cannot be converted to JSONObject
SSM框架配置ehcache 使用工具类报错 org.springframework.cache.ehcache.EhCacheCacheManager cannot be cast to net.sf.ehcache.CacheManager 怎么解决啊?
报错 ``` java.lang.ExceptionInInitializerError at com.ssm.moudles.SsmTest.testEhCache(SsmTest.java:32) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) Caused by: java.lang.ClassCastException: org.springframework.cache.ehcache.EhCacheCacheManager cannot be cast to net.sf.ehcache.CacheManager at com.ssm.common.utils.EhCacheUtils.<clinit>(EhCacheUtils.java:13) ... 25 more ``` springcontext.xml配置 ``` <!-- 应用spring-cache注解功能 --> <cache:annotation-driven cache-manager="cacheManager" /> <!-- 配置ehcache管理器--> <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager"> <property name="cacheManager" ref="ehcache"></property> </bean> <bean id="ehcache" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"> <!-- <property name="shared" value="true" /> --> <property name="configLocation" value="classpath:ehcache.xml"></property> </bean> ``` EhCacheUtils工具类 at com.ssm.common.utils.EhCacheUtils.<clinit>(EhCacheUtils.java:13) 指 private static CacheManager cacheManager = ((CacheManager)SpringContextHolder.getBean("cacheManager")); ``` public class EhCacheUtils { private static CacheManager cacheManager = ((CacheManager)SpringContextHolder.getBean("cacheManager")); private static final String SYS_CACHE = "sysCache"; public static Object get(String key) { return get(SYS_CACHE, key); } public static void put(String key, Object value) { put(SYS_CACHE, key, value); } ``` 方法 ``` @Test public void testEhCache(){ EhCacheUtils.put("user", "张三"); System.out.println(EhCacheUtils.get("user")); } ``` pom.xml 包都在
哪位大神帮我看下,这是什么问题啊,说是不能注入这个类...
如题: ``` org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.rjs.marketing.api.service.MarketingRestService': Cannot resolve reference to bean 'marketingRestService' while setting bean property 'ref'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'marketingRestService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.rjs.marketing.app.service.MarketingService com.rjs.marketing.app.rest.MarketingRestServiceImpl.marketingService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'marketingService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.rjs.marketing.app.service.task.RecommendService com.rjs.marketing.app.service.MarketingService.recommendService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'recommendService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.rjs.marketing.app.vo.ServerConfig com.rjs.marketing.app.service.task.RecommendService.serverConfig; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serverConfig' defined in class path resource [rjs-marketing-app_context.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'java.util.List' for property 'pushConfig'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [java.util.Map] for property 'pushConfig[0]': no matching editors or conversion strategy found ```
急救: java.lang.ClassCastException: $Proxy2 cannot be cast to XXXX 错误
我是个新手,这几天写了个小东西,刚开头就磕磕碰碰的,求哥哥大侠们能帮帮我. struts1.3+spring2.0+hibernate3 报错信息: [code="java"] [com.jin.bbs.common.ActionExceptionHandler]-[ERROR] java.lang.ClassCastException: $Proxy2 cannot be cast to com.jin.bbs.user.UserManagerImpl at com.jin.bbs.user.presentation.UserAction.add(UserAction.java:25) 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) [/code] applicationContext.xml [code="xml"] <!-- 以下是: 处理Blob类型的特殊声明 //--> <bean id="defaultLobHandler" class="org.springframework.jdbc.support.lob.DefaultLobHandler"></bean> <bean id="nativeJdbcExtractor" class="org.springframework.jdbc.support.nativejdbc.CommonsDbcpNativeJdbcExtractor" lazy-init="true" /> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <!-- 为处理lob类型字段的句柄声明 //--> <!-- oracle --> <!-- <property name="lobHandler" ref="oracleLobHandler" /> --> <!-- mysql --> <property name="lobHandler" ref="defaultLobHandler" /> <property name="hibernateProperties"> <props> <!-- oracle --> <!-- <prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop> --> <!-- mysql --> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> <prop key="hibernate.show_sql">true</prop> <prop key="jdbc.fetch_size">50</prop> <prop key="jdbc.batch_size">25</prop> <prop key="hibernate.cglib.use_reflection_optimizer">true</prop> </props> </property> <property name="mappingResources"> <list> <value>com/jin/bbs/user/model/UserType.hbm.xml</value> <value>com/jin/bbs/user/model/User.hbm.xml</value> </list> </property> </bean> <!-- DAO 的IoC配置//--> <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <!-- 事务处理的AOP配置 //--> <bean id="txProxyTemplate" abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager" ref="transactionManager" /> <property name="transactionAttributes"> <props> <prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="create*">PROPAGATION_REQUIRED</prop> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="write*">PROPAGATION_REQUIRED</prop> <prop key="update*">PROPAGATION_REQUIRED</prop> <prop key="remove*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="*">PROPAGATION_REQUIRED,readOnly</prop> </props> </property> </bean> <bean id="baseDaoHibernate" class="com.jin.bbs.common.BaseDaoHibernate" autowire="byName" /> <!-- 用户 --> <bean id="userDao" class="com.jin.bbs.user.UserDaoHibernate" autowire="byName" /> <bean id="userManager" parent="txProxyTemplate"> <property name="target"> <bean class="com.jin.bbs.user.UserManagerImpl"> <property name="userDao" ref="userDao" /> </bean> </property> </bean> <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"> <property name="dataSource" ref="dataSource" /> </bean> [/code] BaseAction.java [code="java"] public class BaseAction extends DispatchAction { protected final Log log = LogFactory.getLog(getClass()); private static final Long defaultLong = null; ................... ................... public Object getBean(String name) { ApplicationContext ctx = WebApplicationContextUtils .getRequiredWebApplicationContext(servlet.getServletContext()); return ctx.getBean(name); } ................... ................... [/code] UserAction.java 中的方法 [code="java"] public ActionForward add(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { if (log.isDebugEnabled()) { log.debug("Entering 'add' method"); } UserManagerImpl userManagerImpl = (UserManagerImpl) getBean("userManager"); UserForm userForm = (UserForm)form; User user = (User)convert(userForm); try { user.setScore(new Integer(0)); userManagerImpl.saveUser(user); } catch (Exception e) { log.error(e); return mapping.findForward("error"); } return mapping.findForward("save"); } [/code] 为什么总是会报那个错,找了半天没找到什么问题,我也用instanceof判断过getBean("userManager") 出不是UserManagerImpl 对象,这是为什么? 有没有那个大哥能帮我解决下这个问题,都纠结了一个下午了,总感觉是配置文件里的问题.
spring-mybatis.xml配置出错了,请大神看看
这是第一个错 ` org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.fishoad.services.QuartzService] for bean with name 'quartzTask' defined in class path resource [spring-quartz.xml]; nested exception is java.lang.ClassNotFoundException: com.fishoad.services.QuartzService at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1327) Caused by: java.lang.ClassNotFoundException: com.fishoad.services.QuartzService at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)`` ``` ``` 三月 07, 2016 10:49:24 上午 org.apache.catalina.core.StandardContext listenerStart SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-mybatis.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'org.springframework.core.io.Resource[]' for property 'mapperLocations'; nested exception is java.lang.IllegalArgumentException: Could not resolve resource location pattern [classpath:/com/fishoad/dao/*.xml]: class path resource [com/fishoad/dao/] cannot be resolved to URL because it does not exist at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:547) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ``` 第二个错 ``` Caused by: org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'org.springframework.core.io.Resource[]' for property 'mapperLocations'; nested exception is java.lang.IllegalArgumentException: Could not resolve resource location pattern [classpath:/com/fishoad/dao/*.xml]: class path resource [com/fishoad/dao/] cannot be resolved to URL because it does not exist at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:479) at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:511) at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:505) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1502) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1461) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1197) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537) ... 21 more Caused by: java.lang.IllegalArgumentException: Could not resolve resource location pattern [classpath:/com/fishoad/dao/*.xml]: class path resource [com/fishoad/dao/] cannot be resolved to URL because it does not exist at org.springframework.core.io.support.ResourceArrayPropertyEditor.setAsText(ResourceArrayPropertyEditor.java:140) at org.springframework.beans.TypeConverterDelegate.doConvertTextValue(TypeConverterDelegate.java:430) at org.springframework.beans.TypeConverterDelegate.doConvertValue(TypeConverterDelegate.java:403) at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:181) at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:459) ... 27 more ```
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它是一个过程,是一个不断累积、不断沉淀、不断总结、善于传达自己的个人见解以及乐于分享的过程。
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 free -m 其中:m表示兆,也可以用g,注意都要小写 Men:表示物理内存统计 total:表示物理内存总数(total=used+free) use...
比特币原理详解
一、什么是比特币 比特币是一种电子货币,是一种基于密码学的货币,在2008年11月1日由中本聪发表比特币白皮书,文中提出了一种去中心化的电子记账系统,我们平时的电子现金是银行来记账,因为银行的背后是国家信用。去中心化电子记账系统是参与者共同记账。比特币可以防止主权危机、信用风险。其好处不多做赘述,这一层面介绍的文章很多,本文主要从更深层的技术原理角度进行介绍。 二、问题引入 假设现有4个人...
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发...
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 演示地点演示 html代码如下` music 这个年纪 七月的风 音乐 ` 然后就是css`*{ margin: 0; padding: 0; text-decoration: none; list-...
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。
数据库优化 - SQL优化
以实际SQL入手,带你一步一步走上SQL优化之路!
通俗易懂地给女朋友讲:线程池的内部原理
餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”
经典算法(5)杨辉三角
杨辉三角 是经典算法,这篇博客对它的算法思想进行了讲解,并有完整的代码实现。
使用 Docker 部署 Spring Boot 项目
Docker 技术发展为微服务落地提供了更加便利的环境,使用 Docker 部署 Spring Boot 其实非常简单,这篇文章我们就来简单学习下。首先构建一个简单的 S...
英特尔不为人知的 B 面
从 PC 时代至今,众人只知在 CPU、GPU、XPU、制程、工艺等战场中,英特尔在与同行硬件芯片制造商们的竞争中杀出重围,且在不断的成长进化中,成为全球知名的半导体公司。殊不知,在「刚硬」的背后,英特尔「柔性」的软件早已经做到了全方位的支持与支撑,并持续发挥独特的生态价值,推动产业合作共赢。 而对于这一不知人知的 B 面,很多人将其称之为英特尔隐形的翅膀,虽低调,但是影响力却不容小觑。 那么,在...
面试官:你连RESTful都不知道我怎么敢要你?
干货,2019 RESTful最贱实践
刷了几千道算法题,这些我私藏的刷题网站都在这里了!
遥想当年,机缘巧合入了 ACM 的坑,周边巨擘林立,从此过上了"天天被虐似死狗"的生活… 然而我是谁,我可是死狗中的战斗鸡,智力不够那刷题来凑,开始了夜以继日哼哧哼哧刷题的日子,从此"读题与提交齐飞, AC 与 WA 一色 ",我惊喜的发现被题虐既刺激又有快感,那一刻我泪流满面。这么好的事儿作为一个正直的人绝不能自己独享,经过激烈的颅内斗争,我决定把我私藏的十几个 T 的,阿不,十几个刷题网...
白话阿里巴巴Java开发手册高级篇
不久前,阿里巴巴发布了《阿里巴巴Java开发手册》,总结了阿里巴巴内部实际项目开发过程中开发人员应该遵守的研发流程规范,这些流程规范在一定程度上能够保证最终的项目交付质量,通过在时间中总结模式,并推广给广大开发人员,来避免研发人员在实践中容易犯的错误,确保最终在大规模协作的项目中达成既定目标。 无独有偶,笔者去年在公司里负责升级和制定研发流程、设计模板、设计标准、代码标准等规范,并在实际工作中进行...
SQL-小白最佳入门sql查询一
不要偷偷的查询我的个人资料,即使你再喜欢我,也不要这样,真的不好;
redis分布式锁,面试官请随便问,我都会
文章有点长并且绕,先来个图片缓冲下! 前言 现在的业务场景越来越复杂,使用的架构也就越来越复杂,分布式、高并发已经是业务要求的常态。像腾讯系的不少服务,还有CDN优化、异地多备份等处理。 说到分布式,就必然涉及到分布式锁的概念,如何保证不同机器不同线程的分布式锁同步呢? 实现要点 互斥性,同一时刻,智能有一个客户端持有锁。 防止死锁发生,如果持有锁的客户端崩溃没有主动释放锁,也要保证锁可以正常释...
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // doshom...
Nginx 原理和架构
Nginx 是一个免费的,开源的,高性能的 HTTP 服务器和反向代理,以及 IMAP / POP3 代理服务器。Nginx 以其高性能,稳定性,丰富的功能,简单的配置和低资源消耗而闻名。 Nginx 的整体架构 Nginx 里有一个 master 进程和多个 worker 进程。master 进程并不处理网络请求,主要负责调度工作进程:加载配置、启动工作进程及非停升级。worker 进程负责处...
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,...
程序员:我终于知道post和get的区别
是一个老生常谈的话题,然而随着不断的学习,对于以前的认识有很多误区,所以还是需要不断地总结的,学而时习之,不亦说乎
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU...
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1...
Java世界最常用的工具类库
Apache Commons Apache Commons有很多子项目 Google Guava 参考博客
程序员把地府后台管理系统做出来了,还有3.0版本!12月7号最新消息:已在开发中有github地址
第一幕:缘起 听说阎王爷要做个生死簿后台管理系统,我们派去了一个程序员…… 996程序员做的梦: 第一场:团队招募 为了应对地府管理危机,阎王打算找“人”开发一套地府后台管理系统,于是就在地府总经办群中发了项目需求。 话说还是中国电信的信号好,地府都是满格,哈哈!!! 经常会有外行朋友问:看某网站做的不错,功能也简单,你帮忙做一下? 而这次,面对这样的需求,这个程序员...
网易云6亿用户音乐推荐算法
网易云音乐是音乐爱好者的集聚地,云音乐推荐系统致力于通过 AI 算法的落地,实现用户千人千面的个性化推荐,为用户带来不一样的听歌体验。 本次分享重点介绍 AI 算法在音乐推荐中的应用实践,以及在算法落地过程中遇到的挑战和解决方案。 将从如下两个部分展开: AI算法在音乐推荐中的应用 音乐场景下的 AI 思考 从 2013 年 4 月正式上线至今,网易云音乐平台持续提供着:乐屏社区、UGC...
【技巧总结】位运算装逼指南
位算法的效率有多快我就不说,不信你可以去用 10 亿个数据模拟一下,今天给大家讲一讲位运算的一些经典例子。不过,最重要的不是看懂了这些例子就好,而是要在以后多去运用位运算这些技巧,当然,采用位运算,也是可以装逼的,不信,你往下看。我会从最简单的讲起,一道比一道难度递增,不过居然是讲技巧,那么也不会太难,相信你分分钟看懂。 判断奇偶数 判断一个数是基于还是偶数,相信很多人都做过,一般的做法的代码如下...
为什么要学数据结构?
一、前言 在可视化化程序设计的今天,借助于集成开发环境可以很快地生成程序,程序设计不再是计算机专业人员的专利。很多人认为,只要掌握几种开发工具就可以成为编程高手,其实,这是一种误解。要想成为一个专业的开发人员,至少需要以下三个条件: 1) 能够熟练地选择和设计各种数据结构和算法 2) 至少要能够熟练地掌握一门程序设计语言 3) 熟知所涉及的相关应用领域的知识 其中,后两个条件比较容易实现,而第一个...
Android 9.0 init 启动流程
阅读五分钟,每日十点,和您一起终身学习,这里是程序员Android本篇文章主要介绍Android开发中的部分知识点,通过阅读本篇文章,您将收获以下内容:一、启动流程概述一、 启动流程概述Android启动流程跟Linux启动类似,大致分为如下五个阶段。1.开机上电,加载固化的ROM。2.加载BootLoader,拉起Android OS。3.加载Uboot,初始外设,引导Kernel启动等。...
相关热词 c# 输入ip c# 乱码 报表 c#选择结构应用基本算法 c# 收到udp包后回包 c#oracle 头文件 c# 序列化对象 自定义 c# tcp 心跳 c# ice连接服务端 c# md5 解密 c# 文字导航控件
立即提问