mysql数据库存储过程报错Error Code: 1172. Result consisted of more than one row

本人新手,在mysql数据库写了一个存储过程,第一遍执行正常,第二遍执行就报错:Error Code: 1172. Result consisted of more than one row。存储过程如下:
CREATE DEFINER=root@localhost PROCEDURE generatePage(in sid varchar(3),in snum int,in mnum int,in jnum int,in setnum int)
BEGIN

declare i int;
declare gid varchar(10);
declare title1 text;
declare answer1 text;
declare title2 text;
declare answer2 text;
declare title3 text;
declare answer3 text;
set i= 0;
insert into generateinfo(subjectid,singlenum,multiplenum,judgmentnum,setnum,createtime) values(sid,snum,mnum,jnum,setnum,now());
select @@IDENTITY into gid from generateinfo;

while i<setnum Do
    set title1 = "";
    set answer1 = "";
    set title2 = "";
    set answer2 = "";
    set title3 = "";
    set answer3 = "";

    if(snum>0) then
        SELECT GROUP_CONCAT(a.id separator ','),GROUP_CONCAT(a.answer separator ',') into title1,answer1 FROM (SELECT q.* FROM questionbank q where q.qsubject = sid and q.qtype = '1' ORDER BY rand() LIMIT snum) as a limit 1;
    end if;
    if(mnum>0) then
        SELECT GROUP_CONCAT(a.id separator ','),GROUP_CONCAT(a.answer separator ',') into title2,answer2 FROM (SELECT q.* FROM questionbank q where q.qsubject = sid and q.qtype = '2' ORDER BY rand() LIMIT mnum) as b limit 1;
    end if;
    if(jnum>0) then
        SELECT GROUP_CONCAT(a.id separator ','),GROUP_CONCAT(a.answer separator ',') into title3,answer3 FROM (SELECT q.* FROM questionbank q where q.qsubject = sid and q.qtype = '3' ORDER BY rand() LIMIT jnum) as c limit 1;
    end if;
    if(title1!=""&&answer1!="") then
        insert into pageinfo(generateid,questionid,questiontype,qanswer,setno) values(gid,title1,'1',answer1,i+1);
    end if;
    if(title2!=""&&answer2!="") then
        insert into pageinfo(generateid,questionid,questiontype,qanswer,setno) values(gid,title2,'2',answer2,i+1);
    end if;
    if(title3!=""&&answer3!="") then
        insert into pageinfo(generateid,questionid,questiontype,qanswer,setno) values(gid,title3,'3',answer3,i+1);
    end if;
    set i=i+1;
end while;

commit;
END
在网上查了很多资料,都是说需要在insert into 语句后面加上limit 1,但是我加上之后还是会报错,并且之前查询出来的结果是拼接数据,应该就只有一条。
求大神帮忙解决,谢谢!

1个回答

我没细看,但建议你查一下查询语句或者用到结果集的地方吧,报错显然是结果集大于1啊

msx985211
写程序的项目经理 回复u010402129: 好的好的
一年多之前 回复
u010402129
坚持信仰的石头 一开始也知道是结果集的问题,一直漏看了一个取id的地方,现在改好了
一年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
python报错:requests.exceptions.ConnectionError: ('Connection aborted.', OSError("(10060, 'WSAETIMEDOUT')"))

代码如下: ``` #!/usr/bin/env python # coding=utf-8 #import importlib,sys #import sys #sys.setdefaultencoding('gbk') from urllib.parse import quote '''import sys import imp import sys reload(sys) sys.setdefaultencoding('utf8') ''' ''' import urllib import urllib2 import requests import sys sys.setdefaultencoding('utf-8') import jieba import json''' #from bs4 import BeautifulSoup import urllib.request import urllib.parse as parse import ssl import re import os,os.path import codecs import requests def getText(html): '''headers = {'Host': 'https://pypi.org','User-Agent':'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36 LBBROWSER','Referer': 'https://pypi.org/search/?c=Programming+Language+%3A%3A+Python+%3A%3A+3', 'Connection': 'keep-alive', 'Upgrade-Insecure-Requests': '1', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36 LBBROWSER', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'Accept-Encoding': 'gzip, deflate, sdch, br', 'Accept-Language': 'zh-CN,zh;q=0.8'} #req = urllib.urlretrieve(download_url,headers=headers) ''' #urllib.request.urlopen('https://www.lfd.uci.edu/~gohlke/pythonlibs/') #req = urllib.request.Request(url=url,headers=header) #headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0'} #import requests res = requests.get(html) res.encoding = 'utf-8' #print(res.text) words=res.text ''' soup = BeautifulSoup(res.text, "html.parser") words = "" for a1 in soup.find_all("a"): words = words + str(a1.string) ''' return words def file(url1,file_name,name): print(url1) headers = {'Host': 'https://files.pythonhosted.org/packages/','User-Agent':'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36 LBBROWSER','Referer': 'https://pypi.org/', 'Connection': 'keep-alive', 'Upgrade-Insecure-Requests': '1', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36 LBBROWSER', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'Accept-Encoding': 'gzip, deflate, sdch, br', 'Accept-Language': 'zh-CN,zh;q=0.8'} #req = urllib.urlretrieve(download_url,headers=headers) #urllib.request.urlopen('https://www.lfd.uci.edu/~gohlke/pythonlibs/') #req = urllib.request.Request(url=url,headers=header) request = requests.get(url=url1,headers=headers) #response = urllib.request.urlopen(request) global i i += 1 print(request.content) file = open(name ,'wb+') file.write(request.content) file.close() print(file_name) print("Completed : .... %d ..." % x) '''for i in range(len(name_list)): j=0 if name_list[i-24:i+1]=='https://pypi.org/project/': name_list1.append(name_list[i+1:i+60])''' def get(url): global name_list1 res=getText(url) #print('\n\n\n\n\n\nok\n\n\n\n\n\n\n\n\n\n') #name_list = getText(url) #print(res) print('html done,page:'+str(count)+'\n') for i in range(len(res)): #j=0 if (res[i-8:i+1]=='/project/')==True: name_list1.append('https://pypi.org'+res[i-8:i+20]) #print(name_list1) def trim(list1): k=0 list2=[] for i in list1: j=25 while j<len(list1[k]): if list1[k][j]=='/': list2.append(list1[k][0:j]) break j+=1 k+=1 return list2 def get1(url): """o=0 for n in len(url): if url[n]=='"': url=url[0:n-1]+'#files' """ global namelist url=url+'#files' #import requests res = requests.get(url) res.encoding = 'utf-8' #print(res.text) html=res.text for p in range(len(html)): stri='https://files' if html[p-len(stri):p]==stri: namelist.append(html[p-len(stri):p+170]) import httplib2 as httplib httplib.HTTPConnection._http_vsn = 10 httplib.HTTPConnection._http_vsn_str = 'HTTP/1.0' ''' #-*- coding:utf-8 -*- import time import hmac import hashlib import requests import json import mysql.connector import requests import httplib2 as httplib import urllib from urllib import unquote import json def query_total_flow(): header = {"Content-Type": "application/json", 'Connection': 'close', 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36'} post_data = { "operator": "xxxxxx", # 调用系统的名字 "type": "set", "set_id": [1], "set_name": [], "feature_type": ["入流量"], "date": "2019-06-15", "begintime": "23:55", "endtime": "23:59", } url = "http://xxx.xxx.xxx.xxx:80/xxxxx/xxxxx/xxxxx.cgi/json?" post_data = json.dumps(post_data, ensure_ascii=False, separators=(',',':')) print (post_data) # url = url + post_data url = url + urllib.urlencode({'data': post_data}) # data = urllib.urlencode({'data': post_data}) # print post_data # print data data = unquote(url) try: # print data print (data) response = requests.get(url, json=data, timeout=60, headers=header) print (response.headers) print (response.url) print (response.text.encode('utf-8')) if response['code'] != 0: result_dict = json.loads(response.text) data = result_dict["data"] print(data) print(data) set_info = [] return response raise exp_with_err_instance(err.RESULT_ERROR, 'can not find inst info') print ("none!") return [] except Exception as e: print ("Exception") raise if __name__ == "__main__": query_total_flow() ''' save_path = os.getcwd() ''' url = 'https://pypi.org/search/?c=Programming+Language+%3A%3A+Python+%3A%3A+3' name_list = getText(url) print(name_list) print('html done') #html.decode('utf-8') #print(name_list)''' x=1 files=os.listdir(save_path) #print(files) #print(type(name_list)) name_list1=[] #print(name_list) #for name in name_list: k=0 # name[k]=str(name1[k]) '''for i in range(len(name_list)): j=0 if name_list[i-25:i+1]=='https://pypi.org/project/': name_list1.append(name_list[i-25:i+20]) for u in range(len(name_list1[len(name_list1)])): if name_list1[len(name_list1)][u]==' ': name_list1[len(name_list1)]=name_list1[len(name_list1)][0:u-1] ''' global count count=2 name_list1=[] for count in range(51): get('https://pypi.org/search/?c=Programming+Language+%3A%3A+Python+%3A%3A+3&page='+str(count)) """ global m if k<len(name_list1): for l in range(len(name_list1[k])): if l-9>=0: if name_list1[k][l-4:l]=='.whl' or name_list1[k][l-3:l]=='.gz' or name_list1[k][l-4:l]=='.zip': j=1 m=l if j==1: name_list1[k]=name_list1[k][0:m] k+=1""" '''if j==0: name_list.remove(name)''' #file_name = os.path.join(save_path ,name) #i=0 #print(name) #print(name_list1) namelist=[] h=0 for y in trim(name_list1): get1(y) #print(namelist) '''if h==3: break''' h+=1 i=0 for name in namelist: j=0 for l in range(len(name)): if l-9>=0: if name[l-4:l]=='.whl' or name[l-3:l]=='.gz' or name[l-4:l]=='.zip': j=1 m=l break if j==1: name=name[0:m] k+=1 while m>0: if m<len(name): if name[m]=='/': filename=name[m+1:len(name)]#p] break m-=1 if filename in files: continue '''if name=='Delny‑0.4.1‑cp27‑none‑win_amd64.whl</a></li>\n<li>' or name==Delny‑0.4.1‑cp27‑none‑win32.whl</a></li> </ul> </: continue ''' print('no:'+str(x)) print('\ndownload '+name) # importlib.reload(sys) #imp.reload(sys) for l in range(len(name)): if l-9>=0: if name[l-4:l]=='.whl' or name[l-3:l]=='.gz' or name[l-4:l]=='.zip': j=1 m=l break if j==1: name=name[0:m] k+=1 p=m #string='https://download.lfd.uci.edu/pythonlibs/s2jqpv5t/' + name#[0:4+name.find('.whl')]#https://download.lfd.uci.edu/pythonlibs/s2jqpv5t/ print('00'+save_path) #file(name,save_path,filename) url1=name +'/' + filename url1=url1.encode() name=filename file_name=save_path #file = open(name ,'wb+') #file.write(url1 ) #file.close() #print(file_name) headers = {'Host': 'https://files.pythonhosted.org/packages/','User-Agent':'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36 LBBROWSER','Referer': 'https://pypi.org/', 'Connection': 'keep-alive', 'Upgrade-Insecure-Requests': '1', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36 LBBROWSER', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'Accept-Encoding': 'gzip, deflate, sdch, br', 'Accept-Language': 'zh-CN,zh;q=0.8'} #req = urllib.urlretrieve(download_url,headers=headers) #urllib.request.urlopen('https://www.lfd.uci.edu/~gohlke/pythonlibs/') #req = urllib.request.Request(url=url,headers=header) #request = urllib.request.urlopen(url1) #response = urllib.request.urlopen(request) urllib.request.urlretrieve(url1.decode(),name) i += 1 print(url1.decode()) #file = open(name ,'wt+') #file.write(str(req.content())) #file.close() print(file_name) print("Completed : .... %d ..." % x) '''for i in range(len(name_list)): j=0 if name_list[i-24:i+1]=='https://pypi.org/project/': name_list1.append(name_list[i+1:i+60])''' print('\n........'+filename+'..........complete\n') x=x+1 print('09') print('finished') ``` 报错: Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license()" for more information. >>> ===================== RESTART: E:\2345Downloads\版本2下载whl.py ==================== Traceback (most recent call last): File "E:\2345Downloads\版本2下载whl.py", line 154, in <module> httplib.HTTPConnection._http_vsn = 10 AttributeError: module 'httplib2' has no attribute 'HTTPConnection' >>> 如果不加 ``` import httplib2 as httplib httplib.HTTPConnection._http_vsn = 10 httplib.HTTPConnection._http_vsn_str = 'HTTP/1.0' ``` 就会 Traceback (most recent call last): File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 665, in urlopen httplib_response = self._make_request( File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 421, in _make_request six.raise_from(e, None) File "<string>", line 3, in raise_from File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 416, in _make_request httplib_response = conn.getresponse() File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 1322, in getresponse response.begin() File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 303, in begin version, status, reason = self._read_status() File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 264, in _read_status line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\socket.py", line 669, in readinto return self._sock.recv_into(b) File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\contrib\pyopenssl.py", line 318, in recv_into raise SocketError(str(e)) OSError: (10060, 'WSAETIMEDOUT') During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\adapters.py", line 439, in send resp = conn.urlopen( File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 719, in urlopen retries = retries.increment( File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\util\retry.py", line 400, in increment raise six.reraise(type(error), error, _stacktrace) File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\packages\six.py", line 734, in reraise raise value.with_traceback(tb) File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 665, in urlopen httplib_response = self._make_request( File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 421, in _make_request six.raise_from(e, None) File "<string>", line 3, in raise_from File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 416, in _make_request httplib_response = conn.getresponse() File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 1322, in getresponse response.begin() File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 303, in begin version, status, reason = self._read_status() File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 264, in _read_status line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\socket.py", line 669, in readinto return self._sock.recv_into(b) File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\contrib\pyopenssl.py", line 318, in recv_into raise SocketError(str(e)) urllib3.exceptions.ProtocolError: ('Connection aborted.', OSError("(10060, 'WSAETIMEDOUT')")) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "E:\2345Downloads\版本2下载whl.py", line 282, in <module> get1(y) File "E:\2345Downloads\版本2下载whl.py", line 141, in get1 res = requests.get(url) File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\api.py", line 75, in get return request('get', url, params=params, **kwargs) File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\api.py", line 60, in request return session.request(method=method, url=url, **kwargs) File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\sessions.py", line 533, in request resp = self.send(prep, **send_kwargs) File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\sessions.py", line 646, in send r = adapter.send(request, **kwargs) File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\adapters.py", line 498, in send raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: ('Connection aborted.', OSError("(10060, 'WSAETIMEDOUT')")) 求高手解决

错误:org.json.JSONException:java.lang.String类型的值<br无法转换为JSONObject

<div class="post-text" itemprop="text"> <p>I know I have seen all similar questions on SO. I tried to solve this error but I failed. I tried almost everything but does not get solution.</p> <p>My code is as follows:-</p> <pre><code>public class Tab2 extends Fragment { private static String TAG = Tab2.class.getSimpleName(); private EditText editText1,editText2,editText3; private Button button; private String name,email,password; private TextInputLayout inputLayoutName, inputLayoutEmail, inputLayoutPassword; private ProgressDialog pDialog; private SessionManager session; private database db; static InputStream is = null; static JSONObject jObj = null; static String json = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.tab2,container,false); pDialog = new ProgressDialog(getActivity()); pDialog.setCancelable(false); // Session manager session = new SessionManager(getActivity()); // SQLite database handler db = new database(getActivity()); // Check if user is already logged in or not if (session.isLoggedIn()) { // User is already logged in. Take him to main activity Intent intent = new Intent(getActivity(),MainActivity.class); startActivity(intent); } editText1 = (EditText)view.findViewById(R.id.name); editText2 = (EditText)view.findViewById(R.id.email); editText3 = (EditText)view.findViewById(R.id.password); inputLayoutEmail = (TextInputLayout)view. findViewById(R.id.view1); inputLayoutPassword = (TextInputLayout)view. findViewById(R.id.view2); inputLayoutName = (TextInputLayout)view. findViewById(R.id.view3); button = (Button)view.findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view1) { name = editText1.getText().toString().trim(); email = editText2.getText().toString().trim(); password = editText3.getText().toString().trim(); if (!validateName() || !validateEmail() || !validatePassword() ) { Log.d(TAG, "Successfull"); return; } try { new Thread(new Runnable() { @Override public void run() { registerUser(name, email, password); } }).start(); }catch (NullPointerException e){ e.printStackTrace(); } Toast.makeText(getActivity(), "Account Created Successfully!", Toast.LENGTH_SHORT).show(); Intent i = new Intent(getActivity(), MainActivity.class); startActivity(i); } }); return view; } public boolean validateName(){ if(name.isEmpty() ) { inputLayoutName.setError(getString(R.string.error_name1)); return false; } else if(name.length()&lt;3){ inputLayoutName.setError(getString(R.string.error_name2)); return false; } else inputLayoutName.setErrorEnabled(false); return true; } public boolean validateEmail(){ if(email.isEmpty() || !android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches()){ inputLayoutEmail.setError(getString(R.string.error_email)); return false; } else inputLayoutEmail.setErrorEnabled(false); return true; } public boolean validatePassword(){ if(password.isEmpty() ){ inputLayoutPassword.setError(getString(R.string.error_password1)); return false; } else if(password.length()&lt;4){ inputLayoutPassword.setError(getString(R.string.error_password2)); return false; } else inputLayoutPassword.setErrorEnabled(false); return true; } public void registerUser(final String name, final String email, final String password){ String req = "req_request"; pDialog.setMessage("Registering ..."); showDialog(); RequestQueue requestQueue = Volley.newRequestQueue(getActivity()); StringRequest strReq = new StringRequest(Request.Method.POST, appConfig.url_sign, new Response.Listener&lt;String&gt;(){ @Override public void onResponse(String response) { try { JSONObject jObj = new JSONObject(response); boolean error = jObj.getBoolean("error"); Log.d(TAG,name + " " + email + " " + password ); if (!error) { String uid = jObj.getString("uid"); JSONObject user = jObj.getJSONObject("user"); String name = user.getString("name"); String email= user.getString("email"); String created_at = user.getString("created_at"); db.addUser(name, email, uid, created_at); Toast.makeText(getActivity(), "User successfully registered. Try login now!", Toast.LENGTH_LONG).show(); // Launch login activity Intent i = new Intent( getActivity(), Login.class); startActivity(i); } else { String errorMsg = jObj.getString("error_msg"); Toast.makeText(getActivity(), errorMsg, Toast.LENGTH_LONG).show(); } } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { NetworkResponse networkResponse = error.networkResponse; if (networkResponse != null) { Log.e("Volley", "Error. HTTP Status Code:"+networkResponse.statusCode); } if (error instanceof TimeoutError) { Log.e("Volley", "TimeoutError"); }else if(error instanceof NoConnectionError){ Log.e("Volley", "NoConnectionError"); } else if (error instanceof AuthFailureError) { Log.e("Volley", "AuthFailureError"); } else if (error instanceof ServerError) { Log.e("Volley", "ServerError"); } else if (error instanceof NetworkError) { Log.e("Volley", "NetworkError"); } else if (error instanceof ParseError) { Log.e("Volley", "ParseError"); } //Log.e(TAG, "Registration Error: " + error.getMessage()); // Toast.makeText(getActivity(), // error.getMessage(), Toast.LENGTH_LONG).show(); // hideDialog(); } }) { @Override protected Map&lt;String, String&gt; getParams() { // Posting params to register url Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;(); params.put("name", name); params.put("email", email); params.put("password", password); return params; } }; int socketTimeout = 10000;//30 seconds - change to what you want RetryPolicy policy = new DefaultRetryPolicy(socketTimeout, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT); strReq.setRetryPolicy(policy); requestQueue.add(strReq); } private void showDialog() { if (!pDialog.isShowing()) pDialog.show(); } private void hideDialog() { if (pDialog.isShowing()) pDialog.dismiss(); } } </code></pre> <p>This is my php file</p> <pre><code>&lt;?php $response = array(); if (isset($_POST['name']) &amp;&amp; isset($_POST['email']) &amp;&amp; isset ($_POST['password'] )) { $name = $_POST['name']; $email = $_POST['email']; $password = $_POST['password']; require_once __DIR__ . '/db_connection.php'; $db = new DB_CONNECT(); $result = mysql_query("Insert into words(name,email,password) values('$name','$email','$password')"); if ($result) { $response["success"] = 1; $response["message"] = "Registration successfully."; echo json_encode($response); } else { $response["success"] = 0; $response["message"] = "Oops! An error occurred."; echo json_encode($response); } } else { $response["success"] = 0; $response["message"] = "Required field(s) is missing"; echo json_encode($response); } ?&gt; </code></pre> <p>My JSON response is:-</p> <pre><code>{"success":0,"message":"Required field(s) is missing"} </code></pre> <p>Can you identify the error please tell me.</p> </div>

解析数据org.json.JSONException时出错,已经尝试过其他帖子

<div class="post-text" itemprop="text"> <p>I know there are several posts with the same error, but I've proven solutions and still have the same error</p> <p>Log.txt:</p> <pre><code>03-18 18:32:33.082: D/gralloc_goldfish(974): Emulator without GPU emulation detected. 03-18 18:33:21.706: E/JSON Parser(974): Error parsing data org.json.JSONException: End of input at character 0 of 03-18 18:33:21.706: W/dalvikvm(974): threadid=11: thread exiting with uncaught exception (group=0x40a71930) 03-18 18:33:21.726: E/AndroidRuntime(974): FATAL EXCEPTION: AsyncTask #1 03-18 18:33:21.726: E/AndroidRuntime(974): java.lang.RuntimeException: An error occured while executing doInBackground() 03-18 18:33:21.726: E/AndroidRuntime(974): at android.os.AsyncTask$3.done(AsyncTask.java:299) 03-18 18:33:21.726: E/AndroidRuntime(974): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352) 03-18 18:33:21.726: E/AndroidRuntime(974): at java.util.concurrent.FutureTask.setException(FutureTask.java:219) 03-18 18:33:21.726: E/AndroidRuntime(974): at java.util.concurrent.FutureTask.run(FutureTask.java:239) 03-18 18:33:21.726: E/AndroidRuntime(974): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) 03-18 18:33:21.726: E/AndroidRuntime(974): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 03-18 18:33:21.726: E/AndroidRuntime(974): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 03-18 18:33:21.726: E/AndroidRuntime(974): at java.lang.Thread.run(Thread.java:856) 03-18 18:33:21.726: E/AndroidRuntime(974): Caused by: java.lang.NullPointerException 03-18 18:33:21.726: E/AndroidRuntime(974): at com.example.cambio_moneda.LoadAllProducts.doInBackground(LoadAllProducts.java:25) 03-18 18:33:21.726: E/AndroidRuntime(974): at com.example.cambio_moneda.LoadAllProducts.doInBackground(LoadAllProducts.java:1) 03-18 18:33:21.726: E/AndroidRuntime(974): at android.os.AsyncTask$2.call(AsyncTask.java:287) 03-18 18:33:21.726: E/AndroidRuntime(974): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 03-18 18:33:21.726: E/AndroidRuntime(974): ... 4 more 03-18 18:33:21.786: D/dalvikvm(974): GC_CONCURRENT freed 149K, 10% free 2622K/2896K, paused 4ms+5ms, total 43ms </code></pre> <p>MainActivity.java</p> <pre><code>package com.example.cambio_moneda; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.TextView; public class MainActivity extends Activity { JSONParser jParser = new JSONParser(); private TextView tvCambio; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tvCambio = (TextView) findViewById(R.id.tvCambio); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } public void consultarCambio(View v){ new LoadAllProducts().execute(); } } </code></pre> <p>LoadAllProducts.java</p> <pre><code>package com.example.cambio_moneda; import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.json.JSONObject; import android.os.AsyncTask; import android.util.Log; class LoadAllProducts extends AsyncTask&lt;String, String, String&gt;{ JSONParser jsonParser = new JSONParser(); private static String url_all_products = "http://10.10.1.40/cordova/Servidor/cambio_moneda_app/index.php"; @Override protected void onPreExecute(){ } @Override protected String doInBackground(String... params) { List&lt;NameValuePair&gt; params1 = new ArrayList&lt;NameValuePair&gt;(); JSONObject json = jsonParser.makeHttpRequest(url_all_products,"POST",params1); Log.d("All Products: ", json.toString()); return null; } } </code></pre> <p>JSONParser.java</p> <pre><code>package com.example.cambio_moneda; import java.io.InputStream; import java.util.List; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.utils.URLEncodedUtils; import org.apache.http.impl.client.DefaultHttpClient; import org.json.JSONException; import org.json.JSONObject; import android.util.Log; public class JSONParser { static InputStream is = null; static JSONObject JObj = null; static String json = ""; // Constructor public JSONParser() { } public JSONObject makeHttpRequest(String url, String method, List&lt;NameValuePair&gt; params) { try { if (method == "POST") { DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); httpPost.setEntity(new UrlEncodedFormEntity(params)); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); is = httpEntity.getContent(); } else if (method == "GET") { // request method is GET DefaultHttpClient httpClient = new DefaultHttpClient(); String paramString = URLEncodedUtils.format(params, "utf-8"); url += "?" + paramString; HttpGet httpGet = new HttpGet(url); HttpResponse httpResponse = httpClient.execute(httpGet); HttpEntity httpEntity = httpResponse.getEntity(); is = httpEntity.getContent(); } } catch (Exception e) { e.printStackTrace(); } try{ JObj = new JSONObject(json); } catch (JSONException e){ Log.e("JSON Parser", "Error parsing data " + e.toString()); } return JObj; } } </code></pre> <p>index.php</p> <pre><code>&lt;?php require_once 'include/app_android/DB_Functions.php'; $db = new DB_Functions(); $response = array(); $result = $db-&gt;get_cambio(); if (mysql_num_rows($result) != 0) { while($reg = mysql_fetch_array($result)){ $fecha = date_create($reg['fecha']); $response['fecha'] = date_format($fecha, 'd-m-Y')." ".date_format($fecha, 'H:i:s'); $response['cambio'] = $reg['cambio']; } echo json_encode($response); } ?&gt; </code></pre> <p>I am new to all this, but I really do not watch what may be the mistake, as I said above, I followed the other post, and I don't find the error</p> <p>Thank you all.</p> <p>PD: In some post gave me negative points, please if I give them, leave a comment to know that I am wrong</p> </div>

java.lang.RuntimeException: Error

at cn.cty.dao.SqlPool.getConnection(SqlPool.java:119) at cn.cty.dao.SqlHelper.addpermission(SqlHelper.java:280) at cn.cty.service.impl.PerMissionServiceImlp.getMission(PerMissionServiceImlp.java:27) at cn.cty.control.MissionClServlet.doGet(MissionClServlet.java:76) at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) 后台错误显示 ![图片说明](https://img-ask.csdn.net/upload/201610/15/1476462523_643820.png) 同一个操作没问题 操作几次 就出现这个错误了

mysql 数据库update时出错,错误代码 SQL ERROR :1213

mysql 数据库update时出错,错误代码 SQL ERROR :1213 SQLSTATE: 40001

使用Volley将android应用程序连接到localhost的TimeoutError

<div class="post-text" itemprop="text"> <p>I want to make a web service that allow my app to connect with a database in localhost. I'm trying to follow this <a href="http://www.hermosaprogramacion.com/2015/05/crear-un-webservice-para-android-con-mysql-php-y-json/" rel="nofollow noreferrer">example</a> making some changes in the names.</p> <p>In my android code I have this:</p> <pre><code>VolleySingleton. getInstance(getApplicationContext()). addToRequestQueue(new JsonObjectRequest(Request.Method.GET, Constantes.GET, null, new Response.Listener&lt;JSONObject&gt;() { @Override public void onResponse(JSONObject response) { String result = response.toString(); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { if (error.networkResponse == null) { if (error.getClass().equals(TimeoutError.class)) { // Show timeout error message Log.e("error volley",error.getStackTrace().toString()); Toast.makeText(getApplicationContext(), "Oops. Timeout error!", Toast.LENGTH_LONG).show(); } } } } )); </code></pre> <p><em>VolleySingleton</em> class:</p> <pre><code>public final class VolleySingleton { // Atributos private static VolleySingleton singleton; private RequestQueue requestQueue; private static Context context; private VolleySingleton(Context context) { VolleySingleton.context = context; requestQueue = getRequestQueue(); } public static synchronized VolleySingleton getInstance(Context context) { if (singleton == null) { singleton = new VolleySingleton(context.getApplicationContext()); } return singleton; } public RequestQueue getRequestQueue() { if (requestQueue == null) { requestQueue = Volley.newRequestQueue(context.getApplicationContext()); } return requestQueue; } public &lt;T&gt; void addToRequestQueue(Request&lt;T&gt; req) { getRequestQueue().add(req); } </code></pre> <p>The constants that I have in <em>Constantes</em> class:</p> <pre><code>private static final String PUERTO_HOST = "63343"; private static final String IP = "http://10.0.2.2:"; public static final String GET = IP + PUERTO_HOST + "/prueba/obtener_canales.php"; </code></pre> <p>I used that ip because I read that 10.0.2.2 is for android studio emulator and 10.0.3.2 is for genymotion.</p> <p>I'm using XAMPP and the route of my file is "D:\xampp\htdocs\prueba\obtener_canales.php</p> <p>I'm getting all time the Toast with timeout error and when I debug in android studio there's nothing to see.</p> </div>

错误“警告:mysql_result()[function.mysql-result]:无法跳转到第0行”

<div class="post-text" itemprop="text"> <p>This is my error:</p> <blockquote> <p>Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 53 in C:\xampp\htdocs\includes\class.rooms.php on line 35</p> </blockquote> <p>This is the line in the coding:</p> <pre><code>return mysql_result( dbquery( "SELECT " . $var . " FROM rooms WHERE id = '" . $roomId . "' LIMIT 1" ), 0); </code></pre> </div>

如何修复FATAL EXCEPTION:AsyncTask#2错误

<div class="post-text" itemprop="text"> <p>I just want to access my database using PHP, and view the result in a <code>Toast</code>, but I don't know where I should looking for the error (<code>FATAL EXCEPTION: AsyncTask #2</code>).</p> <p>Android Code:</p> <pre><code>btnLogin.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub if ( ( !username.getText().toString().equals("")) &amp;&amp; ( !password.getText().toString().equals("")) ) { new Connect().execute(); } else if ( ( !username.getText().toString().equals("")) ) { Toast.makeText(getApplicationContext(), "Password field empty", Toast.LENGTH_SHORT).show(); } else if ( ( !password.getText().toString().equals("")) ) { Toast.makeText(getApplicationContext(), "User Name field empty", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(getApplicationContext(), "User Name and Password field are empty", Toast.LENGTH_SHORT).show(); } } }); } class Connect extends AsyncTask&lt;String, String, String&gt; { @Override protected String doInBackground(String... arg0) { // TODO Auto-generated method stub List&lt;NameValuePair&gt; params= new ArrayList&lt;NameValuePair&gt;(); params.add(new BasicNameValuePair("username", username.getText().toString())); params.add(new BasicNameValuePair("password", password.getText().toString())); JSONObject json=JSONParser.getJSONFromUrl(loginURL, params); try { String login = json.getString(sTag_Login); if (login=="Admin") { Toast.makeText(getApplicationContext(), "Welcome Admin", Toast.LENGTH_LONG).show(); } else if (login=="Customer") { Toast.makeText(getApplicationContext(), "Welcome", Toast.LENGTH_LONG).show(); } { Toast.makeText(getApplicationContext(), "error ", Toast.LENGTH_LONG).show(); } } catch(JSONException e) { e.printStackTrace(); } return null; } } </code></pre> <p>And this's my PHP code:</p> <pre><code>&lt;?php // array for JSON response $response = array(); $db = mysqli_connect('mysql.hostinger.ae','u641845309_ur','q1p0w2o9','u641845309_song'); // username and password sent from Form and protect MySQL injection for Security purpose $username = $_POST['username']; $password = $_POST['password']; $sql = "SELECT * FROM customer WHERE UName='$username' and Password='$password'"; // Establishing Connection with Server by passing server_name, user_id and password as a parameter $result=mysqli_query($db,$sql); // If result matched $myusername and $mypassword, table row must be 1 row if ($result) { while($row = mysqli_fetch_array($result)) { if(strtolower($username) == 'admin') $response["login"] = "Admin"; else $response["login"] = "Customer"; } } else { $response["login"] ="error"; } // echoing JSON response echo json_encode($response); </code></pre> <p>JSON Code:</p> <pre><code>public class JSONParser { static InputStream is = null; static JSONObject jObj = null; static String json = ""; // constructor public JSONParser() { } public static JSONObject getJSONFromUrl(String url, List&lt;NameValuePair&gt; params) { // Making HTTP request try { // defaultHttpClient DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); httpPost.setEntity(new UrlEncodedFormEntity(params)); 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, "iso-8859-1"), 8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + " "); } is.close(); json = sb.toString(); Log.e("JSON", json); } catch (Exception e) { Log.e("Buffer Error", "Error converting result " + e.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; } } </code></pre> <p>And this is <code>logcat</code>:</p> <pre><code>01-15 13:49:35.770: D/gralloc_goldfish(2098): Emulator without GPU emulation detected. 01-15 13:49:39.800: D/dalvikvm(2098): GC_FOR_ALLOC freed 166K, 7% free 3117K/3348K, paused 54ms, total 68ms 01-15 13:49:39.800: D/InputEventConsistencyVerifier(2098): KeyEvent: ACTION_UP but key was not down. 01-15 13:49:39.800: D/InputEventConsistencyVerifier(2098): in android.widget.LinearLayout{b3d26008 V.E..... ......I. 0,59-455,118} 01-15 13:49:39.800: D/InputEventConsistencyVerifier(2098): 0: sent at 8592505000000, KeyEvent { action=ACTION_UP, keyCode=KEYCODE_TAB, scanCode=15, metaState=0, flags=0x8, repeatCount=0, eventTime=8592505, downTime=8592401, deviceId=0, source=0x101 } 01-15 13:50:01.560: W/System.err(2098): java.net.UnknownHostException: Unable to resolve host "mwssong.esy.es": No address associated with hostname 01-15 13:50:01.570: W/System.err(2098): at java.net.InetAddress.lookupHostByName(InetAddress.java:424) 01-15 13:50:01.580: W/System.err(2098): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236) 01-15 13:50:01.580: W/System.err(2098): at java.net.InetAddress.getAllByName(InetAddress.java:214) 01-15 13:50:01.580: W/System.err(2098): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:137) 01-15 13:50:01.590: W/System.err(2098): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164) 01-15 13:50:01.590: W/System.err(2098): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119) 01-15 13:50:01.590: W/System.err(2098): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360) 01-15 13:50:01.600: W/System.err(2098): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555) 01-15 13:50:01.600: W/System.err(2098): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487) 01-15 13:50:01.600: W/System.err(2098): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465) 01-15 13:50:01.600: W/System.err(2098): at com.example.e_music.JSONParser.getJSONFromUrl(JSONParser.java:44) 01-15 13:50:01.610: W/System.err(2098): at com.example.e_music.MainActivity$Connect.doInBackground(MainActivity.java:126) 01-15 13:50:01.620: W/System.err(2098): at com.example.e_music.MainActivity$Connect.doInBackground(MainActivity.java:1) 01-15 13:50:01.620: W/System.err(2098): at android.os.AsyncTask$2.call(AsyncTask.java:288) 01-15 13:50:01.620: W/System.err(2098): at java.util.concurrent.FutureTask.run(FutureTask.java:237) 01-15 13:50:01.640: W/System.err(2098): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 01-15 13:50:01.640: W/System.err(2098): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 01-15 13:50:01.650: W/System.err(2098): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 01-15 13:50:01.650: W/System.err(2098): at java.lang.Thread.run(Thread.java:841) 01-15 13:50:01.670: W/System.err(2098): Caused by: libcore.io.GaiException: getaddrinfo failed: EAI_NODATA (No address associated with hostname) 01-15 13:50:01.670: W/System.err(2098): at libcore.io.Posix.getaddrinfo(Native Method) 01-15 13:50:01.670: W/System.err(2098): at libcore.io.ForwardingOs.getaddrinfo(ForwardingOs.java:61) 01-15 13:50:01.670: W/System.err(2098): at java.net.InetAddress.lookupHostByName(InetAddress.java:405) 01-15 13:50:01.670: W/System.err(2098): ... 18 more 01-15 13:50:01.680: E/Buffer Error(2098): Error converting result java.lang.NullPointerException: lock == null 01-15 13:50:01.680: E/JSON Parser(2098): Error parsing data org.json.JSONException: End of input at character 0 of 01-15 13:50:01.680: W/dalvikvm(2098): threadid=12: thread exiting with uncaught exception (group=0xb3a22ba8) 01-15 13:50:01.750: E/AndroidRuntime(2098): FATAL EXCEPTION: AsyncTask #2 01-15 13:50:01.750: E/AndroidRuntime(2098): Process: com.example.e_music, PID: 2098 01-15 13:50:01.750: E/AndroidRuntime(2098): java.lang.RuntimeException: An error occured while executing doInBackground() 01-15 13:50:01.750: E/AndroidRuntime(2098): at android.os.AsyncTask$3.done(AsyncTask.java:300) 01-15 13:50:01.750: E/AndroidRuntime(2098): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) 01-15 13:50:01.750: E/AndroidRuntime(2098): at java.util.concurrent.FutureTask.setException(FutureTask.java:222) 01-15 13:50:01.750: E/AndroidRuntime(2098): at java.util.concurrent.FutureTask.run(FutureTask.java:242) 01-15 13:50:01.750: E/AndroidRuntime(2098): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 01-15 13:50:01.750: E/AndroidRuntime(2098): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 01-15 13:50:01.750: E/AndroidRuntime(2098): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 01-15 13:50:01.750: E/AndroidRuntime(2098): at java.lang.Thread.run(Thread.java:841) 01-15 13:50:01.750: E/AndroidRuntime(2098): Caused by: java.lang.NullPointerException 01-15 13:50:01.750: E/AndroidRuntime(2098): at com.example.e_music.MainActivity$Connect.doInBackground(MainActivity.java:129) 01-15 13:50:01.750: E/AndroidRuntime(2098): at com.example.e_music.MainActivity$Connect.doInBackground(MainActivity.java:1) 01-15 13:50:01.750: E/AndroidRuntime(2098): at android.os.AsyncTask$2.call(AsyncTask.java:288) 01-15 13:50:01.750: E/AndroidRuntime(2098): at java.util.concurrent.FutureTask.run(FutureTask.java:237) 01-15 13:50:01.750: E/AndroidRuntime(2098): ... 4 more </code></pre> </div>

获取错误:解析数据时出错org.json.JSONException:org.json.JSONArray类型的值无法转换为JSONObject

<div class="post-text" itemprop="text"> <p>Stuck and need help. JSON parser cannot convert data so I can use the username and password to login.</p> <pre><code>jsonParser = new JSONParser(); public JSONObject loginUser(String username, String password) { // Building Parameters List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;(); params.add(new BasicNameValuePair("tag", login_tag)); params.add(new BasicNameValuePair("username", username)); params.add(new BasicNameValuePair("password", password)); JSONObject json = jsonParser.getJSONFromUrl(loginURL, params); return json; } </code></pre> <p>PHP part of the code:</p> <pre><code>while($r = mysql_fetch_assoc($result)) { $json[] = $r; } print json_encode($json); </code></pre> </div>

manjaro下安装了mysql8,之前都运行正常,突然启动不了了,应该怎么查?

[NBC1700155 mysql]# systemctl start mysqld Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details. [NBC1700155 mysql]# systemctl status mysqld ● mysqld.service - MySQL Server Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor pres> Active: failed (Result: exit-code) since Wed 2019-11-06 21:14:40 CST; 8s ago Docs: man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Process: 3107 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0> Process: 3128 ExecStart=/usr/bin/mysqld $MYSQLD_OPTS (code=exited, status=127) Main PID: 3128 (code=exited, status=127) 11月 06 21:14:40 NBC1700155 systemd[1]: mysqld.service: Service RestartSec=100m> 11月 06 21:14:40 NBC1700155 systemd[1]: mysqld.service: Scheduled restart job, > 11月 06 21:14:40 NBC1700155 systemd[1]: Stopped MySQL Server. 11月 06 21:14:40 NBC1700155 systemd[1]: mysqld.service: Start request repeated > 11月 06 21:14:40 NBC1700155 systemd[1]: mysqld.service: Failed with result 'exi> 11月 06 21:14:40 NBC1700155 systemd[1]: Failed to start MySQL Server. [NBC1700155 mysql]#

mysql报错Unknown column

本人小白(c币有限,求帮忙!!),在搭建ssh框架时遇到如题的问题,在网上也没有找到解决方案,求大神帮帮忙,在线等: 建表语句: ``` CREATE TABLE `user` ( `userId` varchar(100) NOT NULL, `userName` varchar(255) DEFAULT NULL, `userPassword` varchar(255) DEFAULT NULL, `userCreateTime` varchar(255) DEFAULT NULL, `userUpdateTime` varchar(255) DEFAULT NULL, `userStatus` varchar(255) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- ---------------------------- -- Records of user -- ---------------------------- INSERT INTO `user` VALUES ('001', 'admin', '123456', null, null, null); ``` 实体类: ``` @Entity @Table(name="USER") public class User { private String userid;// private String user_name;// private String user_password;// private String user_status;// private String user_create_time;// private String user_update_time;// @Id @Column(name="userId") public String getUserid() { return userid; } public void setUserid(String userid) { this.userid = userid; } @Column(name="userName") public String getUser_name() { return user_name; } public void setUser_name(String user_name) { this.user_name = user_name; } @Column(name="userPassword") public String getUser_password() { return user_password; } public void setUser_password(String user_password) { this.user_password = user_password; } @Column(name="userStatus") public String getUser_status() { return user_status; } public void setUser_status(String user_status) { this.user_status = user_status; } @Column(name="userCreateTime") public String getUser_create_time() { return user_create_time; } public void setUser_create_time(String user_create_time) { this.user_create_time = user_create_time; } @Column(name="userUpdateTime") public String getUser_update_time() { return user_update_time; } public void setUser_update_time(String user_update_time) { this.user_update_time = user_update_time; } ``` 用的ssh框架,查询时打印的sql语句正常,但报错, 错误代码如下: ``` Hibernate: select user0_.userId as userId1_7_, user0_.userCreateTime as userCrea2_7_, user0_.userName as userName3_7_, user0_.userPassword as userPass4_7_, user0_.userStatus as userStat5_7_, user0_.userUpdateTime as userUpda6_7_ from user user0_ where user0_.userName='admin' 2017-09-01 12:03:34,397 [http-nio-8080-exec-28] WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] - SQL Error: 1054, SQLState: 42S22 2017-09-01 12:03:34,397 [http-nio-8080-exec-28] ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] - Unknown column 'user0_.userId' in 'field list' 2017-09-01 12:03:34,578 [http-nio-8080-exec-28] WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] - SQL Warning Code: 1054, SQLState: 42S22 2017-09-01 12:03:34,578 [http-nio-8080-exec-28] WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] - Unknown column 'user0_.userId' in 'field list' ```

将0000-00-00 00:00:00 datetime从mysql插入postgresql

<div class="post-text" itemprop="text"> <p>I'm trying to go from a mysql database to a postgresql database. I created a script with this query</p> <pre><code> if ($result-&gt;num_rows &gt; 0) { while($row = $result-&gt;fetch_assoc()) { $psql = "INSERT INTO subscriptions_sub (sub_id,cust_id,tarrif_id,des,datetime_created,datetime_modified,credit,credit_limit,status,date_start,date_end,backoffice_userref,backoffice_deleted,backoffice_createdon,backoffice_createdby, backoffice_updatedon,backoffice_updatedby,backoffice_administration,backoffice_readonly,backoffice_order,backoffice_dummy) VALUES('" .(int) $row["sub_id"] . "','" . (int) $row["cust_id"] . "','" . (int) $row["tarrif_id"] . "','" . $row["des"] . "','" . $row["datetime_created"] . "','" . $row["datetime_modified"] . "','" . $row["credit"] . "','" . $row["credit_limit"] . "','" . $row["status"] . "','" . $row["date_start"] . "','" . $row["date_end"] . "','" . $row["backoffice_userref"] . "','" . $row["backoffice_deleted"] . "','" . $row["backoffice_createdon"] . "','" . $row["backoffice_createdby"] . "','" . $row["backoffice_updatedon"] . "','" . (int) $row["backoffice_updatedby"] . "','" . (int) $row["backoffice_administration"] . "','" . $row["backoffice_readonly"] . "','" . (int)$row["backoffice_order"] . "','" . $row["backoffice_dummy"] . "'); "; print_r($row); $ret = pg_query($db, $psql); if(!$ret){ echo pg_last_error($db); } else { echo "Records created succesfully "; } } </code></pre> <p>this is my subscription.sub</p> <pre><code> _columns = { 'sub_id': fields.integer('Subscription ID', size=10), 'cust_id': fields.many2one('res.partner','customer_id', 'Customer ID'), 'tarrif_id': fields.integer('Tariefplan ID', size=10, required=True), 'des': fields.char('Description', size=64), 'datetime_created': fields.datetime('Created', default='0'), 'datetime_modified': fields.datetime('Modified', default='0'), 'credit': fields.float('Credit', digits=(10,4)), 'credit_limit': fields.float('Credit limit', digits=(10,4)), 'status': fields.selection([('active','Active'),('inactive','Inactive'),('ended','Ended'),('deleted','Deleted'),('disabled','Disabled')], 'Status', default='active', required=True), 'date_start': fields.date('Date start'), 'date_end': fields.date('Date end'), 'backoffice_userref': fields.integer('Backoffice_userref', size=10), 'backoffice_deleted': fields.boolean('Backoffice_deleted', size=1, default='0', required=True), 'backoffice_createdon': fields.datetime('Backoffice_createdon', default='0'), 'backoffice_createdby': fields.integer('Backoffice_createdby', size=10, default='0', required=True), 'backoffice_updatedon': fields.datetime('Backoffice_updatedon', default='0'), 'backoffice_updatedby': fields.integer('Backoffice_updatedby', size=10, default='0', required=True), 'backoffice_administration': fields.integer('Backoffice_administration', size=10, default='1', required=True), 'backoffice_readonly': fields.boolean('Backoffice_readonly', size=1, default='0', required=True), 'backoffice_order': fields.integer('Backoffice_order', size=20, default='-1', required=True), 'backoffice_dummy': fields.boolean('Backoffice_dummy', size=1, default='0', required=True), #'qty_available': fields.related('customer_id','subscription_id',type='char', relation="partner.res", string="subscription", store=True) } </code></pre> <p>for example: the datetime_created field has the value '0000-00-00 00:00:00' in the mysql database with type TIMESTAMP.<br> When I execute my script is shows the error:</p> <p>ERROR: date/time field value out of range: "0000-00-00 00:00:00".</p> <p>Is it possible to convert the datetime from mysql to postgresql?</p> </div>

使用sqoop从mariadb里面导数据到hive报错

RT 执行代码如下 ``` sqoop import --connect jdbc:mysql://localhost:3306/test --username root --password 1 --table exit_tran --hive-import --hive-table exit_tran -m 1 --hive-overwrite ``` 导出数据总是报错 ``` 20/03/03 17:35:40 INFO mapreduce.Job: Task Id : attempt_1583223426401_0007_m_000000_2, Status : FAILED Error: java.io.IOException: SQLException in nextKeyValue at org.apache.sqoop.mapreduce.db.DBRecordReader.nextKeyValue(DBRecordReader.java:277) at org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.nextKeyValue(MapTask.java:556) at org.apache.hadoop.mapreduce.task.MapContextImpl.nextKeyValue(MapContextImpl.java:80) at org.apache.hadoop.mapreduce.lib.map.WrappedMapper$Context.nextKeyValue(WrappedMapper.java:91) at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:145) at org.apache.sqoop.mapreduce.AutoProgressMapper.run(AutoProgressMapper.java:64) at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:787) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341) at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:164) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:422) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1762) at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158) Caused by: java.sql.SQLException: HOUR_OF_DAY: 2 -> 3 at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:85) at com.mysql.cj.jdbc.result.ResultSetImpl.getTimestamp(ResultSetImpl.java:903) at org.apache.sqoop.lib.JdbcWritableBridge.readTimestamp(JdbcWritableBridge.java:111) at com.cloudera.sqoop.lib.JdbcWritableBridge.readTimestamp(JdbcWritableBridge.java:83) at exit_tran.readFields(exit_tran.java:229) at org.apache.sqoop.mapreduce.db.DBRecordReader.nextKeyValue(DBRecordReader.java:244) ... 12 more Caused by: com.mysql.cj.exceptions.WrongArgumentException: HOUR_OF_DAY: 2 -> 3 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105) at com.mysql.cj.result.SqlTimestampValueFactory.localCreateFromTimestamp(SqlTimestampValueFactory.java:112) at com.mysql.cj.result.SqlTimestampValueFactory.localCreateFromTimestamp(SqlTimestampValueFactory.java:50) at com.mysql.cj.result.AbstractDateTimeValueFactory.createFromTimestamp(AbstractDateTimeValueFactory.java:87) at com.mysql.cj.protocol.a.MysqlTextValueDecoder.decodeTimestamp(MysqlTextValueDecoder.java:79) at com.mysql.cj.protocol.result.AbstractResultsetRow.decodeAndCreateReturnValue(AbstractResultsetRow.java:87) at com.mysql.cj.protocol.result.AbstractResultsetRow.getValueFromBytes(AbstractResultsetRow.java:241) at com.mysql.cj.protocol.a.result.TextBufferRow.getValue(TextBufferRow.java:132) ... 17 more Caused by: java.lang.IllegalArgumentException: HOUR_OF_DAY: 2 -> 3 at java.util.GregorianCalendar.computeTime(GregorianCalendar.java:2829) at java.util.Calendar.updateTime(Calendar.java:3393) at java.util.Calendar.getTimeInMillis(Calendar.java:1782) at com.mysql.cj.result.SqlTimestampValueFactory.localCreateFromTimestamp(SqlTimestampValueFactory.java:108) ... 23 more Container killed by the ApplicationMaster. Container killed on request. Exit code is 143 Container exited with a non-zero exit code 143 ``` 求指导~

hive连接mysql 报错 readonly server

各位大侠,我搭建了一个hadoop环境,用hive做数据仓库,mysql做hive的元数据仓库,用于定时分析用户数据中的日志文件,但在hive访问mysql的过程中,不定时的报如下错误: java.sql.SQLException: Query returned non-zero code: 1, cause: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:javax.jdo.JDODataStoreException: Could not retrieve transation read-only status server at org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:451) at org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:732) at org.datanucleus.api.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:752) at org.apache.hadoop.hive.metastore.ObjectStore.createTable(ObjectStore.java:784) at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.hadoop.hive.metastore.RawStoreProxy.invoke(RawStoreProxy.java:98) at com.sun.proxy.$Proxy0.createTable(Unknown Source) at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.create_table_core(HiveMetaStore.java:1374) at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.create_table_with_environment_context(HiveMetaStore.java:1407) at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invoke(RetryingHMSHandler.java:102) at com.sun.proxy.$Proxy10.create_table_with_environment_context(Unknown Source) at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.create_table_with_environment_context(HiveMetaStoreClient.java:1884) at org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient.create_table_with_environment_context(SessionHiveMetaStoreClient.java:96) at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.createTable(HiveMetaStoreClient.java:607) at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.createTable(HiveMetaStoreClient.java:595) at sun.reflect.GeneratedMethodAccessor38.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.invoke(RetryingMetaStoreClient.java:90) at com.sun.proxy.$Proxy11.createTable(Unknown Source) at org.apache.hadoop.hive.ql.metadata.Hive.createTable(Hive.java:670) at org.apache.hadoop.hive.ql.exec.DDLTask.createTable(DDLTask.java:3959) at org.apache.hadoop.hive.ql.exec.DDLTask.execute(DDLTask.java:295) at org.apache.hadoop.hive.ql.exec.Task.executeTask(Task.java:160) at org.apache.hadoop.hive.ql.exec.TaskRunner.runSequential(TaskRunner.java:85) at org.apache.hadoop.hive.ql.Driver.launchTask(Driver.java:1604) at org.apache.hadoop.hive.ql.Driver.execute(Driver.java:1364) at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1177) at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1004) at org.apache.hadoop.hive.ql.Driver.run(Driver.java:994) at org.apache.hadoop.hive.service.HiveServer$HiveServerHandler.execute(HiveServer.java:197) at org.apache.hadoop.hive.service.ThriftHive$Processor$execute.getResult(ThriftHive.java:644) at org.apache.hadoop.hive.service.ThriftHive$Processor$execute.getResult(ThriftHive.java:628) at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39) at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39) at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:206) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) NestedThrowablesStackTrace: java.sql.SQLException: Could not retrieve transation read-only status server at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1094) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:997) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:983) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:928) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:959) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:949) at com.mysql.jdbc.ConnectionImpl.isReadOnly(ConnectionImpl.java:3967) at com.mysql.jdbc.ConnectionImpl.isReadOnly(ConnectionImpl.java:3938) at com.jolbox.bonecp.ConnectionHandle.isReadOnly(ConnectionHandle.java:867) at org.datanucleus.store.rdbms.ConnectionFactoryImpl$ManagedConnectionImpl.getConnection(ConnectionFactoryImpl.java:422) at org.datanucleus.store.rdbms.valuegenerator.TableGenerator.createRepository(TableGenerator.java:270) at org.datanucleus.store.rdbms.valuegenerator.AbstractRDBMSGenerator.obtainGenerationBlock(AbstractRDBMSGenerator.java:162) at org.datanucleus.store.valuegenerator.AbstractGenerator.obtainGenerationBlock(AbstractGenerator.java:197) at org.datanucleus.store.valuegenerator.AbstractGenerator.next(AbstractGenerator.java:105) at org.datanucleus.store.rdbms.RDBMSStoreManager.getStrategyValueForGenerator(RDBMSStoreManager.java:2005) at org.datanucleus.store.AbstractStoreManager.getStrategyValue(AbstractStoreManager.java:1386) at org.datanucleus.ExecutionContextImpl.newObjectId(ExecutionContextImpl.java:3827) at org.datanucleus.state.JDOStateManager.setIdentity(JDOStateManager.java:2571) at org.datanucleus.state.JDOStateManager.initialiseForPersistentNew(JDOStateManager.java:513) at org.datanucleus.state.ObjectProviderFactoryImpl.newForPersistentNew(ObjectProviderFactoryImpl.java:232) at org.datanucleus.ExecutionContextImpl.newObjectProviderForPersistentNew(ExecutionContextImpl.java:1414) at org.datanucleus.ExecutionContextImpl.persistObjectInternal(ExecutionContextImpl.java:2218) at org.datanucleus.ExecutionContextImpl.persistObjectWork(ExecutionContextImpl.java:2065) at org.datanucleus.ExecutionContextImpl.persistObject(ExecutionContextImpl.java:1913) at org.datanucleus.ExecutionContextThreadedImpl.persistObject(ExecutionContextThreadedImpl.java:217) at org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:727) at org.datanucleus.api.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:752) at org.apache.hadoop.hive.metastore.ObjectStore.createTable(ObjectStore.java:784) at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.hadoop.hive.metastore.RawStoreProxy.invoke(RawStoreProxy.java:98) at com.sun.proxy.$Proxy0.createTable(Unknown Source) at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.create_table_core(HiveMetaStore.java:1374) at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.create_table_with_environment_context(HiveMetaStore.java:1407) at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invoke(RetryingHMSHandler.java:102) at com.sun.proxy.$Proxy10.create_table_with_environment_context(Unknown Source) at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.create_table_with_environment_context(HiveMetaStoreClient.java:1884) at org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient.create_table_with_environment_context(SessionHiveMetaStoreClient.java:96) at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.createTable(HiveMetaStoreClient.java:607) at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.createTable(HiveMetaStoreClient.java:595) at sun.reflect.GeneratedMethodAccessor38.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.invoke(RetryingMetaStoreClient.java:90) at com.sun.proxy.$Proxy11.createTable(Unknown Source) at org.apache.hadoop.hive.ql.metadata.Hive.createTable(Hive.java:670) at org.apache.hadoop.hive.ql.exec.DDLTask.createTable(DDLTask.java:3959) at org.apache.hadoop.hive.ql.exec.DDLTask.execute(DDLTask.java:295) at org.apache.hadoop.hive.ql.exec.Task.executeTask(Task.java:160) at org.apache.hadoop.hive.ql.exec.TaskRunner.runSequential(TaskRunner.java:85) at org.apache.hadoop.hive.ql.Driver.launchTask(Driver.java:1604) at org.apache.hadoop.hive.ql.Driver.execute(Driver.java:1364) at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1177) at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1004) at org.apache.hadoop.hive.ql.Driver.run(Driver.java:994) at org.apache.hadoop.hive.service.HiveServer$HiveServerHandler.execute(HiveServer.java:197) at org.apache.hadoop.hive.service.ThriftHive$Processor$execute.getResult(ThriftHive.java:644) at org.apache.hadoop.hive.service.ThriftHive$Processor$execute.getResult(ThriftHive.java:628) at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39) at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39) at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:206) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure 在网上查询说是mysql驱动包的问题,但更新了mysql驱动之后,依然还是会报这个错误, 有时候能执行成功,有时候执行不成功,不知道各位大侠谁遇到过类似的问题!

JSON错误:java.lang.String无法转换为JSONObject

<div class="post-text" itemprop="text"> <p>I'm developing an android app and I'm trying to use <strong><em>Volley Library</em></strong>. The problem that I can't solve is about the JSON. I checked my php file, the result and the Java code but I'm still getting the same error. </p> <p>The interesting part is that <strong><em>VolleyLog</em></strong> doesn't show an error message but, <strong><em>Log</em></strong>, does. </p> <pre><code>E/Volley﹕ [1] 2.onErrorResponse: VOLLEY_ERROR </code></pre> <p>and </p> <pre><code>E/LOG﹕ Error: org.json.JSONException: Value You of type java.lang.String cannot be converted to JSONObject </code></pre> <p>That's my PHP code:</p> <pre><code>&lt;?php # Inform which carachters type will be used. header('Content-Type: text/html; charset=utf-8'); // array for JSON response $response = array(); // include db connect class require_once ('../conn.php'); require_once('pClass.php'); error_reporting( E_ALL ); // connecting to db $db = new DB_CONNECT(); //Setting to UTF8 mysql_query("SET NAMES 'utf8_general_ci'"); mysql_query('SET character_set_connection=utf8_general_ci'); mysql_query('SET character_set_client=utf8_general_ci'); mysql_query('SET character_set_results=utf8_general_ci'); mysql_query('SET CHARACTER SET utf8'); $ff_error = "ERROR"; $arrPOI["arrPOI"] = array(); $poi=new POI(); if (isset($_REQUEST["ff_01"])) { //Execute the query $ff_01 = $_REQUEST['ff_01']; $return = mysql_query($ff_01) or die(mysql_error()); // check for empty result if (mysql_num_rows($return) &gt; 0) { while ($row = mysql_fetch_array($return)) { $poi-&gt;setPOIId($row["intPointId"]); $poi-&gt;setPOIName($row["vchPointName"]); $poi-&gt;setPOIImage($row["vchAwesomeFont"]); $poi-&gt;setStatusId($row["intStatusId"]); $poi-&gt;setLanguageId($row["intLanguageId"]); // push single category into final response array array_push($arrPOI["arrPOI"], $poi-&gt;getPOIData()); } // echoing JSON response header('Content-Type: application/json'); echo json_encode($arrPOI, JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK | JSON_NUMERIC_CHECK); } else { //No data found array_push($arrPOI["arrPOI"], $poi-&gt;getPOIData()); // echo no users JSON header('Content-Type: application/json'); echo json_encode($arrPOI); } } else { //ERROR array_push($arrPOI["arrPOI"], $poi-&gt;getPOIData()); //Echo header('Content-Type: application/json'); echo json_encode($arrPOI); } ?&gt; </code></pre> <p>The PHP result:</p> <pre><code>{"arrPOI":[{"intPOIId":1,"strPOIName":"Cinema","strPOIImage":"fa-film","intStatusId":1,"intLanguageId":1},{"intPOIId":2,"strPOIName":"Teatro","strPOIImage":"fa-smile-o|fa-frown-o","intStatusId":1,"intLanguageId":1},{"intPOIId":3,"strPOIName":"Restaurante","strPOIImage":"fa-cutlery","intStatusId":1,"intLanguageId":1},{"intPOIId":4,"strPOIName":"Bar","strPOIImage":"fa-beer","intStatusId":1,"intLanguageId":1},{"intPOIId":5,"strPOIName":"Pontos Turísticos","strPOIImage":"fa-map-marker","intStatusId":1,"intLanguageId":1},{"intPOIId":6,"strPOIName":"Cafeteria","strPOIImage":"fa-coffee","intStatusId":1,"intLanguageId":1},{"intPOIId":7,"strPOIName":"Shopping","strPOIImage":"fa-diamond","intStatusId":1,"intLanguageId":1},{"intPOIId":8,"strPOIName":"Livraria","strPOIImage":"fa-book","intStatusId":1,"intLanguageId":1},{"intPOIId":9,"strPOIName":"Show","strPOIImage":"fa-microphone","intStatusId":1,"intLanguageId":1},{"intPOIId":10,"strPOIName":"Boates","strPOIImage":"fa-glass","intStatusId":1,"intLanguageId":1},{"intPOIId":11,"strPOIName":"Lanchonete","strPOIImage":"fa-cutlery","intStatusId":1,"intLanguageId":1},{"intPOIId":12,"strPOIName":"Hotéis","strPOIImage":"fa-building","intStatusId":1,"intLanguageId":1},{"intPOIId":13,"strPOIName":"Pub","strPOIImage":"fa-beer","intStatusId":1,"intLanguageId":1},{"intPOIId":14,"strPOIName":"Pizzaria","strPOIImage":"fa-pie-chart","intStatusId":1,"intLanguageId":1},{"intPOIId":15,"strPOIName":"Univesidade","strPOIImage":"fa-university","intStatusId":1,"intLanguageId":1},{"intPOIId":16,"strPOIName":"Hospital","strPOIImage":"fa-plus-square","intStatusId":1,"intLanguageId":1}]} </code></pre> <p>And my Java Code:</p> <pre><code>import com.android.volley.NoConnectionError; import com.android.volley.ServerError; import com.game.code.guide44.adapter.POIAdapter; import com.game.code.guide44.app.AppController; import com.game.code.guide44.data.PointOfInterest; import java.util.ArrayList; import java.util.List; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import com.android.volley.Request.Method; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.VolleyLog; import com.android.volley.toolbox.JsonObjectRequest; import android.app.Activity; import android.app.ProgressDialog; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.ListView; import android.widget.Toast; public class POIChoose extends Activity { private ListView lVwPOI; private POIAdapter adapterPOI; private ProgressDialog pDialog; private List&lt;PointOfInterest&gt; POIList; private String url; private StringBuilder stbCheckedPOI; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_poi_choose); //Initialize with ListView object from activity_poi_choose by id lVwPOI = (ListView)findViewById(R.id.lvwPOI); //Initialize the list of POI POIList = new ArrayList&lt;PointOfInterest&gt;(); //initialize with POI List adapterPOI = new POIAdapter(this, POIList); //Fill the LiistView with POIAdapter content lVwPOI.setAdapter(adapterPOI); stbCheckedPOI = new StringBuilder(); //Base url //Change "1" to dynamic user language url = getString(R.string.urlBase)+getString(R.string.urlGetPOI)+"?ff_01="+String.format(getString(R.string.sqlSelectPOI), "1"); //Initialize the ProgressDialog pDialog = new ProgressDialog(POIChoose.this); //Show the progress bar befores making HTTP request pDialog.setMessage(getString(R.string.txtMsgPleaseWait)); pDialog.show(); // making fresh volley request and getting json JsonObjectRequest jsonReq = new JsonObjectRequest(Method.GET, url, null, new Response.Listener&lt;JSONObject&gt;() { @Override public void onResponse(JSONObject response) { VolleyLog.v("VOLLEY", "Response: " + response.toString()); if (response != null) { parseJsonFeed(response); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { if(error instanceof NoConnectionError) Toast.makeText(POIChoose.this, "No internet available", Toast.LENGTH_SHORT).show(); else if(error instanceof ServerError) Toast.makeText(POIChoose.this, "Server Error", Toast.LENGTH_SHORT).show(); VolleyLog.e("VOLLEY_ERROR", "Error: " + error.getMessage()); Log.e("LOG", "Error: " + error.getMessage()); pDialog.dismiss(); } }); // Adding request to volley request queue AppController.getInstance().addToRequestQueue(jsonReq); } @Override public void onDestroy() { super.onDestroy(); hidePDialog(); } private void hidePDialog() { if (pDialog != null) { pDialog.dismiss(); pDialog = null; } } private void parseJsonFeed(JSONObject response){ try{ JSONArray jsonArray = response.getJSONArray("arrPOI"); for (int i = 0; i &lt; response.length(); i++) { JSONObject jsonObject = (JSONObject) jsonArray.get(i); PointOfInterest Poi = new PointOfInterest(); Poi.setPOIId(jsonObject.getInt("intPointId")); Poi.setPOIName(jsonObject.getString("vchPointName")); Poi.setPOIPicture(jsonObject.getString("vchAwesomeFont")); Poi.setStatusId(jsonObject.getInt("intStatusId")); Poi.setLanguageId(jsonObject.getInt("intLanguageId")); // adding movie to movies array POIList.add(Poi); } } catch(JSONException e){ e.printStackTrace(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_first_choose, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } public void performSelectPOI(View view){ for(int i = 0; i &lt; POIList.size(); i++) { if(adapterPOI.mCheckStates.get(i)==true) { stbCheckedPOI.append(POIList.get(i).toString()); stbCheckedPOI.append(" "); } else { } } Toast.makeText(AppController.getContext(), stbCheckedPOI, Toast.LENGTH_LONG).show(); } } </code></pre> <p>I also heard about <strong><em>GSON</em></strong>. Is it the solution? Can anyone help me? Thanks in advance!!</p> </div>

java.lang.NullPointerException--at com.alibaba.druid.pool.DruidPooledConnection.prepareStatement

使用druid封装了一下,传入数据库连接信息和sql语句进行执行,但偶尔报错,没找到规律,请大神们帮看看是什么原因? 相关网上的资料也按照配置过,问题还没没有得到解决 druid 连接池 close connection error问题通过配置testOnBorrow=true暂未重现 以下是报错信息,这个问题一直没得到解决 ``` 返回结果-------------:1 系统异常了CONN:com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@1b4197e1 系统异常了SQL:insert into ZFGL.BILLS_DETAIL ( f_timestamp , BCODE , BILLNO , BILLSDETAILGUID , BNAME , ECODE , ECONOMYGUID , ENAME , ENTERPRISEGUID , FUNCTIONGUID , GOVECOGUID , GOVKCODE , GOVKNAME , GUID , INAME , KCODE , KNAME , PAYMODCODE , PAYMODID , PAYMODNAME , PROGRAMCODE , PROGRAMGUID , PROGRAMTYPECODE , PROGRAMTYPEID , PROGRAMTYPENAME , RELAID , RESOURCECODE , RESOURCEGUID , TOTALMONEY , TZMC , YEAR) values ( to_timestamp('2019-03-12 11:43:16.637953','yyyy-mm-dd hh24:mi:ss.ff6') ,'2040601' ,'2019010001000004' ,'' ,'行XXXXX' ,'010001' ,'C3146047304548D1AAD0066E62595F52' ,'克XXXX' ,'037A71055FCD4FF882F7E575120FEEBD' ,'' ,'' ,'' ,'' ,'ED494B52F7B249C5B6E24F52D92E12E7' ,'公用支出' ,'30XXXX' ,'福XXXX' ,'12' ,'870517B306F94DFF84305120BCDC26B6' ,'财政授权支付' ,'00019992' ,'34772B4128B14606982C532BCAB0316D' ,'01' ,'2F0DF49684EE465CBC28FD1CC908F140' ,'基本支XX 76651498380024E0530A2CA82B62C8' ,'11' ,'7EF59F8C9FF7424989F4E3ED61254B4F' ,'802.811223般公共XXXX' 19' ) java.lang.NullPointerException at com.alibaba.druid.pool.DruidPooledConnection.prepareStatement(DruidPooledConnection.java:350) at com.yicaida.dal.serviceimpl.DynamicConnServiceImpl.execSql(DynamicConnServiceImpl.java:295) at com.yicaida.dx.serviceimpl.DxServiceImpl.runApiNow(DxServiceImpl.java:332) at com.alibaba.dubbo.common.bytecode.Wrapper7.invokeMethod(Wrapper7.java) at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:46) at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:72) at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:53) at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:64) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:42) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:78) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:60) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:112) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:38) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:108) at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:84) at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:170) at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:52) at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:82) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) ``` 源代码如下 ``` public Integer execSql(DBInfoBean dbinfo, String sqlstr) { int result; PreparedStatement ps = null; try { conn = getConn(dbinfo); if (conn.isClosed() || conn == null) { conn = getConn(dbinfo); } ps = conn.prepareStatement(sqlstr); result = ps.executeUpdate(); } catch (Exception err) { System.out.println("系统异常了CONN:" + conn); System.out.println("系统异常了SQL:" + sqlstr); err.printStackTrace(); result = -1; } finally { if (ps != null) { try { ps.close(); } catch (SQLException e) { e.printStackTrace(); result = -1; } } close(); } System.out.println("返回结果-------------:" + result); return result; } ```

SyntaxError:JSON.parse:尝试inser到mysql时JSON数据的第1行第1列的意外字符

<div class="post-text" itemprop="text"> <p>I am using new to using AJAX and PHP I am trying to send a post request to a file called insertvalue.php. I already created the table and database. I am trying to grab the value from a jquery slider through ajax and then insert that value into the mysql table. After that, I want to return the results from the mysql table. </p> <p>When I try running the script I get the error "SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data". I checked, and I am not sure what I did wrong. Any assistance would be appreciated. Thanks!</p> <p>db_connect.php</p> <pre><code>$connect = mysqli_connect("localhost", "private", "private", "private"); // fake credentials for posting if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $createTable = " CREATE TABLE IF NOT EXISTS ClassValues ( question VARCHAR(40) NOT NULL, slider_value INT(50) NOT NULL ) "; if ($connect-&gt;query($createTable) === TRUE) { // echo "Table ClassValues created successfully"; } else { echo "Error creating table: " . $connect-&gt;error; } </code></pre> <p>js file with ajax to send js to php</p> <pre><code> $.ajax({ url: 'php/insertvalue.php', data: { 'one': value }, // slider value type: 'post', dataType: 'json', success: function(x) { alert(x.one); }, error: function(request, status, error) { alert(error); } }); </code></pre> <p>insertvalue.php</p> <pre><code>include 'db_connect.php'; // database connection $one = $_POST['one']; $array = array('one'=&gt;$one); echo json_encode($array); $query = "INSERT INTO ClassValues (question, slider_value) VALUES('Question 1', $one)"; mysql_query($query); $selection = "SELECT slider_value FROM ClassValues"; $result = $conn-&gt;query($selection); if ($result-&gt;num_rows &gt; 0) { while ($row = $result-&gt;fetch_assoc()) { echo "slider_value" . $row["slider_value"] . "&lt;br/&gt;"; } } else { echo "0 results"; } $conn-&gt;close(); </code></pre> </div>

如何解决这个问题org.json.JSONException:java.lang.String类型的值数据库无法转换为JSONObject

<div class="post-text" itemprop="text"> <p>i am using Volley library php mysql to build login system and i am facing this problem </p> <p><b> Registration Error= 156 org.json.JSONException: Value Database of type java.lang.String cannot be converted to JSONObject</b> </p> <p>and when i check my <b> database user details inserted successfully </b> </p> <p><b> i already tried these ways </b></p> <pre><code>&lt;?php $result = array(); $allValues = array(); $values = array(); if (mysqli_query($connection, $sql)) { $values['status'] = 'true'; $values['message'] = 'successful'; } else { $values['status'] = 'false'; $values['message'] = 'failed'; } $allValues[] = $values; $result['result'] = $allValues; echo json_encode($result); ?&gt; </code></pre> <p><b> change my java codes </b></p> <pre><code>JSONArray jsonArray =response.getJSONArray("result"); for(int i = 0 ; i&lt;jsonArray.length(); i++){ JSONObject jsonObject = jsonArray.getJSONObject(i); Log.i("jsonsingleImage",jsonObject.toString()); String status = jsonObject.getString("status"); String message = jsonObject.getString("message"); JSONObject jo = new JSONObject(success.substring(1, success.length()-1)); new JSONObject(success.substring(success.indexOf("{"), success.lastIndexOf("}") + 1)); </code></pre> <p></p><hr> <b> My Registration.php Codes </b> <pre><code>&lt;?php if ($_SERVER['REQUEST_METHOD'] == "POST") { require_once("connection.php"); $first_name = $_POST['firstName']; $first_name = strip_tags($first_name); $first_name = ucfirst(strtolower($first_name)); // uppercase first letter $first_name = str_replace(' ', '', $first_name); // remove spaces $last_name = $_POST['lastName']; $last_name = strip_tags($last_name); $last_name = ucfirst(strtolower($last_name)); // uppercase first letter $last_name = str_replace(' ', '', $last_name); // remove spaces $email = $_POST['email']; $email = strip_tags($email); $email = str_replace(' ', '', $email); // remove spaces $password = $_POST['password']; $password = mysqli_real_escape_string($password); $password = strip_tags($password); $password = str_replace(' ', '', $password); // remove spaces $password = password_hash($_POST['password'], PASSWORD_BCRYPT); $sql = "INSERT INTO users (firstName, lastName, email, password) VALUES ('$first_name', '$last_name', '$email', '$password')"; if (mysqli_query($connection, $sql)) { $result['success'] = "True"; $result['message'] = "Successfully"; echo json_encode($result); mysqli_close($connection); } else { $result['success'] = "False"; $result['message'] = "Failed"; echo json_encode($result); mysqli_close($connection); } } ?&gt; </code></pre> <hr> <p><b>SignActivity.java Codes </b></p> <pre><code> StringRequest stringRequest = new StringRequest(Request.Method.POST, URLS.SIGNUP_API, new Response.Listener&lt;String&gt;() { @Override public void onResponse(String response) { try { JSONObject jsonObject = new JSONObject(response); String success = jsonObject.getString("success"); if (success.equals("True")) { Toast.makeText(SignupActivity.this, "Registration successfully", Toast.LENGTH_LONG).show(); Log.i("Registration ======= ", "Registration successfully"); } } } catch (JSONException e) { e.printStackTrace(); Toast.makeText(SignupActivity.this, "Registration Error= 156 " + e.toString(), Toast.LENGTH_LONG).show(); Log.i("Catch error 156 ======", e.toString()); } } }, ''' </code></pre> </div>

mysql数据库报如下错误,跪求解决

--- The error happened while setting a property on the result object. --- Cause: com.ibatis.common.beans.ProbeException: Could not get property 'dynamicFields' from com.aspire.ess.domain.Accounts. Cause: java.lang.ClassCastException: [B cannot be cast to [Ljava.lang.Object; org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0]; --- The error occurred in com/aspire/ess/dao/maps/AccountsSQL.xml. --- The error occurred while applying a result map. --- Check the Accounts.accounts_one. --- The error happened while setting a property on the result object. --- Cause: com.ibatis.common.beans.ProbeException: Could not get property 'dynamicFields' from com.aspire.ess.domain.Accounts. Cause: java.lang.ClassCastException: [B cannot be cast to [Ljava.lang.Object;; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in com/aspire/ess/dao/maps/AccountsSQL.xml. --- The error occurred while applying a result map. --- Check the Accounts.accounts_one. --- The error happened while setting a property on the result object. --- Cause: com.ibatis.common.beans.ProbeException: Could not get property 'dynamicFields' from com.aspire.ess.domain.Accounts. Cause: java.lang.ClassCastException: [B cannot be cast to [Ljava.lang.Object; at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.translate(SQLStateSQLExceptionTranslator.java:120) at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.translate(SQLErrorCodeSQLExceptionTranslator.java:276) at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:197) at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject(SqlMapClientTemplate.java:242) at com.aspire.ess.dao.impl.AccountsDaoImpl.findAccountsOne(AccountsDaoImpl.java:25) at sun.reflect.GeneratedMethodAccessor41.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at com.sun.proxy.$Proxy4.findAccountsOne(Unknown Source) at com.aspire.ess.service.impl.AccountsServiceImpl.queryAccountsOneByUserName(AccountsServiceImpl.java:62) at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at com.sun.proxy.$Proxy10.queryAccountsOneByUserName(Unknown Source) at com.aspire.ess.interf.epms.GetToken.verifyUserName(GetToken.java:147) at com.aspire.ess.interf.epms.GetToken.verifyData(GetToken.java:136) at com.aspire.ess.interf.epms.GetToken.service(GetToken.java:81) at javax.servlet.http.HttpServlet.service(HttpServlet.java:723) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:102) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:83) 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:103) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:620) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:744) Caused by: com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in com/aspire/ess/dao/maps/AccountsSQL.xml. --- The error occurred while applying a result map. --- Check the Accounts.accounts_one. --- The error happened while setting a property on the result object. --- Cause: com.ibatis.common.beans.ProbeException: Could not get property 'dynamicFields' from com.aspire.ess.domain.Accounts. Cause: java.lang.ClassCastException: [B cannot be cast to [Ljava.lang.Object; at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:188) at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject(GeneralStatement.java:104) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:566) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:541) at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:106) at org.springframework.orm.ibatis.SqlMapClientTemplate$1.doInSqlMapClient(SqlMapClientTemplate.java:244) at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:194) ... 46 more Caused by: com.ibatis.common.beans.ProbeException: Could not get property 'dynamicFields' from com.aspire.ess.domain.Accounts. Cause: java.lang.ClassCastException: [B cannot be cast to [Ljava.lang.Object; at com.ibatis.common.beans.ComplexBeanProbe.getProperty(ComplexBeanProbe.java:322) at com.ibatis.common.beans.ComplexBeanProbe.setObject(ComplexBeanProbe.java:218) at com.ibatis.common.beans.GenericProbe.setObject(GenericProbe.java:90) at com.ibatis.sqlmap.engine.accessplan.ComplexAccessPlan.setProperties(ComplexAccessPlan.java:34) at com.ibatis.sqlmap.engine.exchange.JavaBeanDataExchange.setData(JavaBeanDataExchange.java:112) at com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.setResultObjectValues(BasicResultMap.java:373) at com.ibatis.sqlmap.engine.mapping.statement.RowHandlerCallback.handleResultObject(RowHandlerCallback.java:64) at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:382) at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults(SqlExecutor.java:301) at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:190) at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery(GeneralStatement.java:205) at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173) ... 52 more Caused by: java.lang.ClassCastException: [B cannot be cast to [Ljava.lang.Object; at com.aspire.ess.domain.BaseDomain.getDynamicFields(BaseDomain.java:128) at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.ibatis.common.beans.ComplexBeanProbe.getProperty(ComplexBeanProbe.java:309) ... 63 more

大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了

大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

Java基础知识面试题(2020最新版)

文章目录Java概述何为编程什么是Javajdk1.5之后的三大版本JVM、JRE和JDK的关系什么是跨平台性?原理是什么Java语言有哪些特点什么是字节码?采用字节码的最大好处是什么什么是Java程序的主类?应用程序和小程序的主类有何不同?Java应用程序与小程序之间有那些差别?Java和C++的区别Oracle JDK 和 OpenJDK 的对比基础语法数据类型Java有哪些数据类型switc...

我以为我学懂了数据结构,直到看了这个导图才发现,我错了

数据结构与算法思维导图

String s = new String(" a ") 到底产生几个对象?

老生常谈的一个梗,到2020了还在争论,你们一天天的,哎哎哎,我不是针对你一个,我是说在座的各位都是人才! 上图红色的这3个箭头,对于通过new产生一个字符串(”宜春”)时,会先去常量池中查找是否已经有了”宜春”对象,如果没有则在常量池中创建一个此字符串对象,然后堆中再创建一个常量池中此”宜春”对象的拷贝对象。 也就是说准确答案是产生了一个或两个对象,如果常量池中原来没有 ”宜春” ,就是两个。...

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

Linux面试题(2020最新版)

文章目录Linux 概述什么是LinuxUnix和Linux有什么区别?什么是 Linux 内核?Linux的基本组件是什么?Linux 的体系结构BASH和DOS之间的基本区别是什么?Linux 开机启动过程?Linux系统缺省的运行级别?Linux 使用的进程间通信方式?Linux 有哪些系统日志文件?Linux系统安装多个桌面环境有帮助吗?什么是交换空间?什么是root帐户什么是LILO?什...

Linux命令学习神器!命令看不懂直接给你解释!

大家都知道,Linux 系统有非常多的命令,而且每个命令又有非常多的用法,想要全部记住所有命令的所有用法,恐怕是一件不可能完成的任务。 一般情况下,我们学习一个命令时,要么直接百度去搜索它的用法,要么就直接用 man 命令去查看守冗长的帮助手册。这两个都可以实现我们的目标,但有没有更简便的方式呢? 答案是必须有的!今天给大家推荐一款有趣而实用学习神器 — kmdr,让你解锁 Linux 学习新姿势...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

史上最全的 python 基础知识汇总篇,没有比这再全面的了,建议收藏

网友们有福了,小编终于把基础篇的内容全部涉略了一遍,这是一篇关于基础知识的汇总的文章,请朋友们收下,不用客气,不过文章篇幅肯能会有点长,耐心阅读吧爬虫(七十)多进程multiproces...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

85后蒋凡:28岁实现财务自由、34岁成为阿里万亿电商帝国双掌门,他的人生底层逻辑是什么?...

蒋凡是何许人也? 2017年12月27日,在入职4年时间里,蒋凡开挂般坐上了淘宝总裁位置。 为此,时任阿里CEO张勇在任命书中力赞: 蒋凡加入阿里,始终保持创业者的冲劲,有敏锐的...

总结了 150 余个神奇网站,你不来瞅瞅吗?

原博客再更新,可能就没了,之后将持续更新本篇博客。

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

新一代神器STM32CubeMonitor介绍、下载、安装和使用教程

关注、星标公众号,不错过精彩内容作者:黄工公众号:strongerHuang最近ST官网悄悄新上线了一款比较强大的工具:STM32CubeMonitor V1.0.0。经过我研究和使用之...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

大学一路走来,学习互联网全靠这几个网站,最终拿下了一把offer

大佬原来都是这样炼成的

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

为什么你不想学习?只想玩?人是如何一步一步废掉的

不知道是不是只有我这样子,还是你们也有过类似的经历。 上学的时候总有很多光辉历史,学年名列前茅,或者单科目大佬,但是虽然慢慢地长大了,你开始懈怠了,开始废掉了。。。 什么?你说不知道具体的情况是怎么样的? 我来告诉你: 你常常潜意识里或者心理觉得,自己真正的生活或者奋斗还没有开始。总是幻想着自己还拥有大把时间,还有无限的可能,自己还能逆风翻盘,只不是自己还没开始罢了,自己以后肯定会变得特别厉害...

什么时候跳槽,为什么离职,你想好了么?

都是出来打工的,多为自己着想

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

你期望月薪4万,出门右拐,不送,这几个点,你也就是个初级的水平

先来看几个问题通过注解的方式注入依赖对象,介绍一下你知道的几种方式@Autowired和@Resource有何区别说一下@Autowired查找候选者的...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

立即提问
相关内容推荐