錯誤日志(小測試): javax.mail.Session@37a1c887 1 ???????1 δ???????1 ????????0 ???????0 DEBUG: setDebug: JavaMail version 1.4ea DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc] DEBUG POP3: connecting to host "pop.263xmail.com", port 110, isSSL false S: +OK Welcome to XMAIL POP3 Server Version 0.0.1 C: USER XXXXXXX S: +OK XMAIL POP3 C: PASS XXXXX S: +OK XMAIL POP3 C: STAT S: +OK 1 30944 C: NOOP S: +OK XMAIL POP3 ------------------??????1?????-------------------- C: TOP 1 0 S: +OK Received: from smtp.263xmail.com (localhost.localdomain [127.0.0.1]) by smtp.263xmail.com (Postfix) with ESMTP id A30201F546 for ; Wed, 1 May 2013 19:45:05 +0800 (CST) X-263anti-spam:KSV:0;
線上日志 2013-05-02 07:41:49,123 INFO [com.dhgate.logistics.mail.ReceiveMail] mail session==javax.mail.Session@17f7be7b Loading javamail.default.providers from jar:file:/usr/local/project/dhgate-logistics-service/dhgate-logistics-impl-1.0-SNAPSHOT/lib/mail-1.4.jar!/META-INF/javamail.default.providers DEBUG: loading new provider protocol=imap, className=com.sun.mail.imap.IMAPStore, vendor=Sun Microsystems, Inc, version=null DEBUG: loading new provider protocol=imaps, className=com.sun.mail.imap.IMAPSSLStore, vendor=Sun Microsystems, Inc, version=null DEBUG: loading new provider protocol=smtp, className=com.sun.mail.smtp.SMTPTransport, vendor=Sun Microsystems, Inc, version=null DEBUG: loading new provider protocol=smtps, className=com.sun.mail.smtp.SMTPSSLTransport, vendor=Sun Microsystems, Inc, version=null DEBUG: loading new provider protocol=pop3, className=com.sun.mail.pop3.POP3Store, vendor=Sun Microsystems, Inc, version=null DEBUG: loading new provider protocol=pop3s, className=com.sun.mail.pop3.POP3SSLStore, vendor=Sun Microsystems, Inc, version=null DEBUG: getProvider() returning provider protocol=pop3; type=javax.mail.Provider$Type@21e30857; class=com.sun.mail.pop3.POP3Store; vendor=Sun Microsystems, Inc DEBUG POP3: connecting to host "pop.263xmail.com", port 110, isSSL false S: +OK Welcome to XMAIL POP3 Server Version 0.0.1 C: USER XXXXX@XXXXX S: +OK XMAIL POP3 C: PASS XXXXXX S: +OK XMAIL POP3 C: STAT S: +OK 1 30944 2013-05-02 07:41:49,328 INFO [com.dhgate.logistics.mail.ReceiveMail] 1 2013-05-02 07:41:49,329 INFO [com.dhgate.logistics.mail.ReceiveMail] null 2013-05-02 07:41:49,330 INFO [com.dhgate.logistics.mail.ReceiveMail] ------------------解析第1封郵件-------------------- 2013-05-02 07:41:49,330 INFO [com.dhgate.logistics.mail.ReceiveMail] C: QUIT S: +OK XMAIL POP3 java.lang.NullPointerException at javax.mail.internet.MimeUtility.decodeText(MimeUtility.java:124) at com.dhgate.logistics.mail.ReceiveMail.getSubject(ReceiveMail.java:467) at com.dhgate.logistics.mail.ReceiveMail.parseMessages(ReceiveMail.java:170) at com.dhgate.logistics.mail.ReceiveMail.receive(ReceiveMail.java:132) at com.dhgate.logistics.job.MailJob.receiveMail(MailJob.java:268) at com.dhgate.logistics.impl.MailJobServiceImpl.doJob(MailJobServiceImpl.java:26) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.dhgate.apsaras.rpc.jbossremoting.JBossRemotingRPCServer$WrapperHandler.invoke(JBossRemotingRPCServer.java:188) at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:809) at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:608) at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:406) at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:173) 2013-05-02 07:41:49,358 INFO [com.dhgate.logistics.impl.MailJobServiceImpl] remote invoke ReceiveMailJob end
HDC調(diào)試需求開發(fā)(15萬預(yù)算),能者速來!>>> 目前使用的是 1.55的android-javamail,登陸是IMAP,調(diào)用的是Folder的AddMessageCountListener,下面上代碼 final IdleManager idleManager = new IdleManager(mSession, mEs); Folder folder = mStore.getFolder("INBOX"); folder.open(Folder.READ_WRITE); folder.addMessageCountListener(new MessageCountAdapter() { public void messagesAdded(MessageCountEvent ev) { Folder folder = (Folder)ev.getSource(); Message[] msgs = ev.getMessages(); System.out.println("Folder: " + folder + " got " + msgs.length + " new messages"); try { // process new messages idleManager.watch(folder); // keep watching for new messages } catch (MessagingException mex) { // handle exception related to the Folder } } }); idleManager.watch(folder);
然后在log中會看到這些log W/System.err: javax.mail.MessagingException: Folder is not using SocketChannels W/System.err: at com.sun.mail.imap.IdleManager.watch(IdleManager.java:203) W/System.err: at com.ram.testdemo.mail.RMail.listenerFolder(RMail.java:411) W/System.err: at com.ram.testdemo.MailActivity$6.run(MailActivity.java:174) W/System.err: at java.lang.Thread.run(Thread.java:818) 報錯的地方是,這一句 idleManager.watch(folder);
HDC調(diào)試需求開發(fā)(15萬預(yù)算),能者速來!>>> 寫了一個工具類mail,在Test類中的main方法中測試通過,郵件發(fā)送完全ok,但是在項目中用,代碼報錯: Unable to locate provider for protocol: smtp,說是jar包沖突的問題,但是我測試沒問題的啊,哪位高手碰到過這種問題來幫忙解決下啊
HDC調(diào)試需求開發(fā)(15萬預(yù)算),能者速來!>>> exception is com.fasterxml.jackson.core.JsonParseException: Unexpected character ('i' (code 105)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') 無論我提交的是雙引號,如下,還是單引號都報上面的異常 var params = {"id":"123","name":"zj"}; 然后我改了配置 application/json;charset=UTF-8
public class CustomObjectMapper extends ObjectMapper{ public CustomObjectMapper(){ super(); this.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES,true); } } 就算我換成默認(rèn)的
HDC調(diào)試需求開發(fā)(15萬預(yù)算),能者速來!>>> 開發(fā)服務(wù)器上的數(shù)據(jù)庫由原來的SQL SERVER 2008 切換到了SQL SERVER 2014 發(fā)現(xiàn)后臺的查詢比較慢。日志中打印出查詢語句,返回結(jié)果都需要7-8秒左右等待。 從哪個方面入手去查看這個問題。
HDC調(diào)試需求開發(fā)(15萬預(yù)算),能者速來!>>> 代碼如下: import java.sql.*; public class ShowSql { public static void main(String[] args) { String url = "jdbc:sqlserver://localhost:1433;DatabaseName=hah"; Connection conn=null; Statement st = null; ResultSet rs = null; try { Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); System.out.println("loading success!"); conn = DriverManager.getConnection(url,"sa","admin"); System.out.println("conn success!"); st = conn.createStatement(); rs=st.executeQuery("select top 10 * from Group2"); while(rs.next()){ System.out.println(rs.getString("name")); } } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } } } 報錯如下:
"C:\Program Files\Java\jdk-9.0.1\bin\java" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2017.2.5\lib\idea_rt.jar=11045:C:\Program Files\JetBrains\IntelliJ IDEA 2017.2.5\bin" -Dfile.encoding=UTF-8 -classpath "D:\Iproject\TestWeb\web\WEB-INF\classes;D:\JAVA\apache-tomcat-9.0.2\lib\servlet-api.jar;E:\SQL\jdbc\Microsoft JDBC Driver 6.0 for SQL Server\sqljdbc_6.0\chs\jre8\sqljdbc42.jar" ShowSql loading success! Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:4098) at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:3160) at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$100(SQLServerConnection.java:43) at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:3123) at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7505) at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2445) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1981) at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:1628) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1459) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:773) at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1168) at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:678) at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:229) at ShowSql.main(ShowSql.java:12) Caused by: java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496) ... 14 more Process finished with exit code 1
環(huán)境沒問題,都能運(yùn)行:用戶、組、Task 都能操作,我嘗試部署流程的時候數(shù)據(jù)庫插入出錯 意思好像是參數(shù)設(shè)置出錯,為什么呀,要怎么辦,是數(shù)據(jù)庫不支持嗎,還是mybatis版本問題,或者是activiti版本太新了。 DEBUG - ==> Preparing: INSERT INTO ACT_GE_BYTEARRAY(ID_, REV_, NAME_, BYTES_, DEPLOYMENT_ID_, GENERATED_) VALUES (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) DEBUG - ==> Parameters: 27502(String), repository/TestProcess.png(String), java.io.ByteArrayInputStream@7ffc6e23(ByteArrayInputStream), 27501(String), false(Boolean), 27503(String), repository/TestProcess.bpmn(String), java.io.ByteArrayInputStream@15a2fd7a(ByteArrayInputStream), 27501(String), false(Boolean) DEBUG - Error while closing command context org.apache.ibatis.exceptions.PersistenceException: ### Error updating database. Cause: com.microsoft.sqlserver.jdbc.SQLServerException: ',' 附近有語法錯誤。 ### The error may involve org.activiti.engine.impl.persistence.entity.ResourceEntity.bulkInsertResource-Inline ### The error occurred while setting parameters ### SQL: INSERT INTO ACT_GE_BYTEARRAY(ID_, REV_, NAME_, BYTES_, DEPLOYMENT_ID_, GENERATED_) VALUES (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) ### Cause: com.microsoft.sqlserver.jdbc.SQLServerException: ',' 附近有語法錯誤。 at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:154) at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:141) at org.activiti.engine.impl.db.DbSqlSession.flushBulkInsert(DbSqlSession.java:850) at org.activiti.engine.impl.db.DbSqlSession.flushPersistentObjects(DbSqlSession.java:820) at org.activiti.engine.impl.db.DbSqlSession.flushInserts(DbSqlSession.java:797) at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:618) at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:212) at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:138) at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:66) at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45) at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:37) at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40) at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35) at org.activiti.engine.impl.RepositoryServiceImpl.deploy(RepositoryServiceImpl.java:79) at org.activiti.engine.impl.repository.DeploymentBuilderImpl.deploy(DeploymentBuilderImpl.java:156) at test.Test.test(Test.java:36) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.junit.runner.JUnitCore.run(JUnitCore.java:160) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: ',' 附近有語法錯誤。 at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216) at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1515) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:404) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:350) at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696) at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:180) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:155) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.execute(SQLServerPreparedStatement.java:332) at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:169) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:62) at com.sun.proxy.$Proxy32.execute(Unknown Source) at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:44) at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:69) at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:48) at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:105) at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:71) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:152) … 44 more
HDC調(diào)試需求開發(fā)(15萬預(yù)算),能者速來!>>> 對于sql, 多個表進(jìn)行連接(外連接和內(nèi)連接), 是先進(jìn)行篩選出每個表中需要的內(nèi)容, 再將這些篩選出的表進(jìn)行外連接比較好,還是先直接將幾個表進(jìn)行連接,最后在where里面進(jìn)行條件篩選比較好呢? 舉例A selet a.*,b.* from tab1 a,tab2 b where a.Id = b.ReferenceID a.name = "apple" andb.name="banana" 舉例B select a.* ,b.* from ( select * from tab1 where name='apple' ) a, (select * from tab2 where name='banana') b on a.ID = b.referenceID