[B cannot be cast to java.lang.String

來源:互聯網
上載者:User

標籤:mysql

sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)    java.lang.reflect.Method.invoke(Method.java:597)    org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)    org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)    org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)    org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)    $Proxy22.getAllNoticeList(Unknown Source)

昨天一下午找的bug,這個錯誤碼,百度Google了一下,大概都能知道是什麼原因導致的錯誤,但是有些錯誤是很細了,就比如這個,因此記錄下來,希望以後不要再犯。
先貼上之前百度的,
這個錯誤一般是類型不符,具體的什麼類型,要看你的是什麼資料了,從資料庫中查詢的資料是亂碼,但是資料庫裡顯示的是正常的utf-8,原因在於用到了巢狀查詢,巢狀查詢中使用了中文字串拼接。然後就斯巴達了,其實這個錯誤很容易避免的,因為測試的時候用的本機資料庫才出現的,用伺服器的資料庫巢狀查詢不會出現亂碼。應該是MySql的設定問題,但是可以通過sql語句中加入編碼來解決,就是這樣。

著作權聲明:本文為博主原創文章,未經博主允許不得轉載。

[B cannot be cast to java.lang.String

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.