Tag Archives: java

Spring jacjson version conflict “nosuchme” thodError:com.fasterxml.jackson.databind.ObjectMapper.canSerialize “

The error message is as follows:
The display cannot find the method

03-Jan-2017 21:05:43.236 SEVERE [http-apr-8081-exec-2] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [springMVC] in context with path [] threw exception [Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.ObjectMapper.canSerialize(Ljava/lang/Class;Ljava/util/concurrent/atomic/AtomicReference;)Z] with root cause
 java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.ObjectMapper.canSerialize(Ljava/lang/Class;Ljava/util/concurrent/atomic/AtomicReference;)Z
    at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.canWrite(AbstractJackson2HttpMessageConverter.java:166)
    at org.springframework.http.converter.AbstractGenericHttpMessageConverter.canWrite(AbstractGenericHttpMessageConverter.java:68)
    at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.getProducibleMediaTypes(AbstractMessageConverterMethodProcessor.java:314)
    at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:185)
    at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.handleReturnValue(RequestResponseBodyMethodProcessor.java:173)
    at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:81)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:130)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.hzwellgood.base.DispatcherFilter.doFilter(DispatcherFilter.java:42)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:217)
    at org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:106)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2503)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2492)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)

Reason:
spring and Jackson versions are not compatible
Solution:
Jackson version changed from 2.1.0 to 2.7.0

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>2.7.0</version>
</dependency>
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-annotations</artifactId>
    <version>2.7.0</version>
</dependency>

I used spring4.3.3+jackson2.1 conflict, not compatible jackson2.1, just adjust to jackson2.7
Also heard that these are not compatible:
Spring 4.2+ Jackson 2.7 version conflict, not compatible with Jackson2.7, Jackson 2.6 should be used
Spring 4.1.6+ Jackson 2.7 Conflict Knowing that Jackson2.7 had to use a higher Spring release, reduced Jackson to 2.6

Error loading in flex integration: Java / jdk1.6.0_ 35\jre\bin\server\ jvm.dll

Error loading: \ Java \ jdk1.6.0 _35 \ jre \ bin \ server \ JVM DLL

Error :
complie:
[exec] Error loading: D:\Program Files\Java\jdk1.6.0_35\jre\bin\server\ jvvm. DLL
[exec] Result: 6
Because flash builder is based on eclipse and eclipse is using Java technology and Java needs jre
to run and flash builder needs to run on a 32-bit jre if we have Java installed on 64 then this error will occur

solution
1. Download and install 32 jre
2. Edit FLEX_HOME\bin\jvm.config file and set java.home
for example :
#java.home=
java.home=D:/Program Files/Java/jre6-32

note :FLEX_HOME refers to flex SDK directory, such as D:\Program Files\Adobe Flash Builder 4.6\ SDKS \4.6.0

After compiling. Java, the following appears: Note:checkUser.java uses unchecked or unsafe operations.Note :Recompile with -Xlint :unchecked for details.

 

If it is shown in Chinese, it means:
Note: A.java USES unchecked or unsafe operations.
Note: For details, use -Xlint: Unchecked recompile.
JAVA5.0 generics are used, but the 5.0 generics do not do type checking. For example, ArrayList a =new ArrayList();
a.add(“hello”); There are several solutions to this warning:
1) Prefix a method with @Suppresswarnings (“unchecked”)
2) declare generic types, such as ArrayList< Object> A = new ArrayList< Object> (a);
3) Compile with 1.4 COMPATIBLE JDK, Javac-Source 1.4 test.java
4) You can also view warning messages like Javac Xlint: Unchecked test.java. This will display the detailed warning information

Was import certificate — error prompt: java.security.cert .CertPathValidatorException: Certificate chaining error

When sending MQ using an application of WAS, you encounter the following error:
The certificate issued by CN=DigiCert High Assurance EV Root CA, OU=www.digicert.com, O=DigiCert Inc, C=US is not trusted; internal cause is:
Java. Security. Cert. CertPathValidatorException: Certificate chaining the error
This means that a pilot entry certificate is required to WAS:
Import steps:
1: Click the WAS menu security-& GT; SSL Certificate and Key Management see the following page:

Click Key Stores and Certificates on the page and click after entering the page

3 click NodeDefaultTrustStore

Click Signer Certificates from the appear page

5. Click the Add button in the display page:

6. First upload the file to /opt/root.cert, then enter a certificate name: MyRootCert. Click the Aplly button, and then click the Ok button.
Certificate import is complete.

After trying to send MQ, success.

java.sql.SQLException : IO exception: socket read timed out

[Con.err] Java.sqlexception: [con.err] Socket read timed out
the 2010-07-20 12:02:23 error [con. Err] at oracle.. JDBC driver. DatabaseError. ThrowSqlException (DatabaseError. Java: 112)
[con. Err] at the 2010-07-20 12:02:23 mistake Oracle, the JDBC driver. DatabaseError. ThrowSqlException (DatabaseError. Java: 146)
[con. Err] at the 2010-07-20 12:02:23 mistake Oracle, the JDBC driver. DatabaseError. ThrowSqlException (DatabaseError. Java: 255)
[con. Err] at the 2010-07-20 12:02:23 mistake Oracle, the JDBC driver. T4CStatement. ExecuteForDescribe (T4CStatement. Java: 806)
[con. Err] at the 2010-07-20 12:02:23 mistake Oracle, the JDBC driver. OracleStatement. ExecuteMaybeDescribe (OracleStatement. Java: 1031)
[con. Err] at the 2010-07-20 12:02:23 mistake Oracle, the JDBC driver. T4CStatement. ExecuteMaybeDescribe (T4CStatement. Java: 830)
[con. Err] at the 2010-07-20 12:02:23 mistake Oracle, the JDBC driver. OracleStatement. DoExecuteWithTimeout (OracleStatement. Java: 1124)
[con. Err] at the 2010-07-20 12:02:23 mistake Oracle, the JDBC driver. OracleStatement. ExecuteQuery (OracleStatement. Java: 1264)
the 2010-07-20 12:02:23 error [con. Err] at com. Apusic. JDBC. Adapter. StatementHandle. ExecuteQuery (Unknown Source)
.
.
.
Solutions:
Socket connection timeout try small file

Reproduced in: https://blog.51cto.com/8231017/1395064

XAException occurred. Error code is: XAER_RMERR


Problem: IBM Portal USES the built-in DB2 database by default. After performing the migration operation to Oracle, the portal process cannot be stopped normally. The following error message is reported:
[12/18/09 19:18:39:289 CST] 00000028 InternalOracl I DSRA8203I: Database product name : Oracle
[12/18/09 19:18:39:289 CST] 00000028 InternalOracl I DSRA8204I: Database product version : Oracle Database 10g Enterprise Edition Release 10.2.0.4.0- 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options
[12/18/09 19:18:39:289 CST] 00000028 InternalOracl I DSRA8205I: JDBC driver name : Oracle JDBC driver
[12/18/09 19:18:39:290 CST] 00000028 InternalOracl I DSRA8206I: JDBC driver version : 10.2.0.1.0
[12/18/09 19:18:39:290 CST] 00000028 InternalOracl I DATA_STORE_HELPER_NAME
[12/18/09 19:18:39:290 CST] 00000028 WSRdbDataSour I DSRA8208I: JDBC driver type: “”
[12/18/09 19:18:39:294 CST] 00000028 WSRdbXaResour E DSRA0304E: XAException occurred. XAException contents and details are: The cause is : null.
[12/18/09 19:18:39:294 CST] 00000028 WSRdbXaResour E DSRA0302E: XAException occurred. Error code is: XAER_RMERR (-3). Exception is:
[12/18/09 19:18:39:295 CST] 00000028 XARminst E WTRN0037W: The transaction service encountered an error on an xa_recover operation. The resource was com.ibm.ws.rsadapter.spi.WSRdbXaResourceImpl@15d2dc71. The error code was XAER_RMERR. The exception stack trace follows: javax.transaction.xa.XAException at oracle.jdbc.xa.OracleXAResource.recover(OracleXAResource.java:526)
at com.ibm.ws.rsadapter.spi.WSRdbXaResourceImpl.recover(WSRdbXaResourceImpl.java:992)
at com.ibm.ws.Transaction.JTA.XARminst.recover(XARminst.java:137)
at com.ibm.ws.Transaction.JTA.XARecoveryData.recover(XARecoveryData.java:690)
at com.ibm.ws.Transaction.JTA.PartnerLogTable.recover(PartnerLogTable.java:514)
at com.ibm.ws.Transaction.JTA.RecoveryManager.resync(RecoveryManager.java:1896)
at com.ibm.ws.Transaction.JTA.RecoveryManager.run(RecoveryManager.java:2608)
at java.lang.Thread.run(Thread.java:571)
Solutions:
Grant select on dba_pending_transactions to; –USER is the name of the USER you want to connect to Oracle DB
Method 2: Update the JDBC driver to 10.2.0.4
 
 
 

From “ITPUB blog” link: http://blog.itpub.net/10537377/viewspace-623219/, if you want to reprint, please indicate the source, otherwise will be investigated for legal responsibility.

Reproduced in: http://blog.itpub.net/10537377/viewspace-623219/

Error: Could not find or load main class ***

Question:
Javac compiles the source code and executes the Java Mainclassname Error: Could not find or Load main class *** Error
The reason:
The runtime cannot find the main class, either because it did not write the full name of the main class (it requires the full package name) or because it wrote the wrong name of the main class (not the name of the main class, but the file name of the main class), or because it did not specify a directory with the classpath.
Solution 1:
Java classpath – [classpath directory] package1, package2. Mainclassname
Such as:
Run the command as in ***/target/classes/hello directory
java -cp ../hello/HelloWorld
or
java -cp ../hello. The HelloWorld
(-classpath here can also be -cp.)
Note that the path after 1: -classpath is in the directory of the top-level package name (package1) and in the directory of the package1 folder (if the source program does not start with any packages, that is the current compiled directory, -cp./ The current path can be without specifying the -cp parameter), or.. Relative or absolute paths to /target/classes/
Note 2: run the file must be full name, to add all the package name (if you have any package program starts packagename) until the main class name, such as: packagename. Mainclassname (note that there is the main class name for the file name is not the main class, also is not generated by the * * *. The class files, is the main method in the name of the class)
Solution 2
The directory from CD to the classpath, if there is a package name (the directory where the top-level package name package1 folder is located, or.. If the source program does not have a package at the beginning, run the following command in the path of the ***.class file after compilation.
Java package1. Package2. Mainclassname
Such as:
Run the following command in the ***/target/classes directory where the package name hello resides
Java hello/HelloWorld
or
Java hello. The HelloWorld
Conclusion:
The problem is that the main class cannot be found, it must run with the full main class name including the package name, and it needs to specify the directory of the class path.
Appendix:
Java usage methods and parameters table after running Java-help
Usage: java [-options] class [args…]
(to execute a class)
or Java [-options] -jar jarfile [args…]
(to execute a jar file)
where options include:
-d32 use a 32-bit data model if available
-d64 use a 64-bit data model if available
-server to Select the “server” VM
the default VM is server.
– cp & lt; class search path of directories and zip/jar files>
– the classpath & lt; class search path of directories and zip/jar files>
A: separated list of directories, JAR archives,
and ZIP archives to search for class files. name> =< value>
set a system property
-verbose :[class|gc|jni]
enable verbose output
-version print product version and exit
-version :< value>
Warning: This feature is deprecated and will be removed
in a future release.
requires the specified version to run
-showversion print product version and Restrict-search continue
-re-search restricb-no-re-search
Warning: continue
-re-search restricb-search Removed
in a future release.
include/exclude user private JREs in the version search
-?-help print this help message
-x print help on non-standard options
-ea [:<packagename>…|:<classname> classname>] [: & lt;
– enableassertions packagename>… | : & lt; classname>]
enable assertions with specified granularity
-da [:<packagename>…|:<classname>] [: & lt;
the -disableassertions packagename>… | : & lt; classname>]
disable assertions with specified coverage
-esa | -enablesystemassertions
enablesystem enabling
-dsa |-disablesystemassertions
Disable the system assertions
– agentlib: & lt; libname> [=<options>]
load native agent library < libname> -agentlib:hprof
see also, -agentlib: JDWP =help and -agentlib:hprof=help
-agentpath :< pathname> [=<options>]
load native agent library by full pathname
-javaagent :< jarpath> [=<options>]
load Java programming language agent, see java.lang. Instrument
-splash :< imagepath>
show splash screen with the specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
Helloworld.java :(notice the package name)

package hello;

public class HelloWorld {
    public static void main(String[] args) {
        Greeter greeter = new Greeter();
        System.out.println(greeter.sayHello());
    }
}

Greeter.java

package hello;

public class Greeter {
    public String sayHello() {
        return "Hello world!";
    }
}

Reference:
https://stackoverflow.com/questions/18093928/what-does-could-not-find-or-load-main-class-mean

Flex Error #2032 Stream Error

Question:
The machine in CCBN exhibition visited the PAGE of OSS system, Error #2032 Stream Error occurred, and the SWF file could not be viewed.

Environment:
The biggest difference is that the second way of compiling the files that depend on the Flex framework is Merged into the SWF of the source. It is much larger than the first SWF file that is compiled using the RSL.
Compiling with the RSL requires the Flex framework file to be placed in the same directory as the source SWF.
Flex frame files are divided into two types: framework_swz (for example, framework_4.0.0.14159.swz) at compile time and frame_swf (for example, framework_4.0.0.14159.swf) at run time. According to analysis, framework_4.0.0.14159.SWz is priority to load framework_4.0.0.14159.SWz when client machine access, it will be put into the Flash Player’s cache directory after successful loading. Flash Player automatically downloads framework _4.0.0.14159.swF (either of these files can be downloaded and displayed properly).

Problem analysis:
In the flash directory of the OSs_system_web_page project of our current OSS system, there are only Flex framework related SWF files (6 in total), and no related SWZ files. When the machine of the exhibition visited the system, the SWZ file of the frame could not be found, and the SWF file of the frame was not found automatically, so the access error occurred. In our company, the desktop machine automatically finds the SWF file of the frame, so there is no problem.

Solutions:
SWZ, OSMF_flex. 4.0.0.13495.SWz, RPC_4.0.0.14159.SWz, SPARk_4.0.0.14159.SWz, SPARkskins_4.0.0.14159.SWz, SPARkskins_4.0.0.14159.SWz, SPARkskins_4.0.14159.SWz, SPARkskins_4.0.14159.SWz, SPARkskins_4.0.14159.SWz, SPARkskins_4.0.14159.SWz, Textlayout_1.0.0.595.swz) in the FLASH directory of the OSs_system_web_page project, and then configure the web.xml file of the project, so that the Tomcat server can recognize the SWZ file:

<mime-mapping>

  <extension>swz</extension>

  <mime-type>application/octet-stream</mime-type>

</mime-mapping>

This way, when the exhibition machine accesses the system, it will find the Flex frame-related SWZ files and will be able to access the system SWF files correctly. Problem solving.

Refer to http://blog.csdn.net/hanxing0/article/details/5556042
http://www.blogjava.net/aiaiwoo/articles/338454.html

Error: a JNI error has occurred

The first time I ran testNG, I found an Error: Error: A JNI Error has occurred. Please check your installation and try again.

To get to the bottom of this, the JAR package is incomplete. After importing the JCommander -1.48.jar package to run, no more prompt for this error.
Download way: http://download.csdn.net/detail/u010340178/9782044

In addition, in the testNG will often use to another jar package, testNG – 6.8.21. Jar, contains org.testng.Com mandLineArgs, org. TestNG. Annotations. * classes, such as can join together.
Download way: http://download.csdn.net/detail/u010340178/9782050

Error: current transaction is aborted, commands ignored until end of transaction blockp

In normal database programming, we encountered errors from time to time: Current Transaction is aborted, commands ignored until the end of transaction BlockP. How to solve it?We usually look it up on the Internet. If you’re a little bit better at English you can tell from the error message that there’s probably something wrong there. But if the experience is not very rich, or the Internet to find more convenient. The most basic error message can see from the official documentation (http://www.postgresql.org/docs/8.4/interactive/errcodes-appendix.html).
The error above is the cause of improper transaction control, which can be written as follows.
Improper writing 1:
Connection OPEN.
Try {
Try {
Database operation A.
} Catch (Exception e) {
The log. The error (” do something “);
}
 
Database operation B. // The above error may occur during this data operation.
The transaction commits commit.
} Catch (Exception ex) {
Transaction rollback rollback.
} the finally {
Close the connection.
}
 
Improper writing method 2:
Connection OPEN.
Try {
Database operation A.
Database operation B.
The transaction commits commit.
} Catch (Exception ex) {
Database operation C. // The above error may occur during this data operation.
The transaction commits commit.
} the finally {
Close the connection.
}
 
In a Postgres database, if there is an error in a database operation in the same transaction, all subsequent databases in that transaction will fail.
If there is an error in database operation A, the same database operation B will report an error when it is executed. If there is an error in database operation A or database operation B, the same database operation C will report an error.
To avoid errors, someone is using the re-open method, which in effect throws away all previous operations (not in the case of auto-commit) and adds overhead by re-opening, which is not recommended.
Depending on the cause of the error, we can treat the processing before the possible error as a transaction. The processing after the error is then treated as a transaction, depending on the specific logic. That way you can avoid making mistakes.
In this way, we can change the improper 1 to
Try {
Database operation A.
} Catch (Exception e) {
Transaction rollback or commit;
The log. The error (” do something “);
}
Database operation B.  
 
In this way we can change the improper notation 2 to
} Catch (Exception ex) {
Transaction rollback or commit;
Database operation C.   
The transaction commits commit.
} the finally {
Close the connection.
}
 
 
 

Failed to execute goal org.apache.maven . plugins:maven-surefire-plugin :2.12.4:test

Today and yesterday, when I was doing the project and making progress, I found that MVN install could not succeed
always reported the following error:

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.698 s
[INFO] Finished at: 2020-11-15T16:58:47+08:00
[INFO] Final Memory: 11M/217M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project CRMSystem: There are test failures.
[ERROR] 
[ERROR] Please refer to G:\Language Proctice\java\pro\20201109\CRMSystem\target\surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.

some puzzled, looked up the information on the Internet but no result

Fortunately, the problem was finally solved and the solution was as follows:
2. In this case, add a method to the current test class and use the @test annotation