Thinking about the problem of Java Complier compliance level

Source: Internet
Author: User
Tags jboss jboss server

http://blog.csdn.net/shan9liang/article/details/17266519

**********************************************

Problem Origin:
Today again in the ESB call WebService test, need to deploy an EJB project on JBoss (EJB release webservice), in the past to deploy good code, this time the deployment went wrong, the log record error is as Follows:
[org.jboss.detailed.classloader.ClassLoaderManager] (hdscanner) Unexpected error during load Of: Com.jialin.ejb.usermanagerbeanjava.lang.unsupportedclassversionerror:com/jialin/ejb/usermanagerbean: Unsupported Major.minor version 51.0 ......... ......... 2013-12-11 14:48:34,329 error [org.jboss.kernel.plugins.dependency.AbstractKernelController] (hdscanner) error Installing to Postclassloader:name=vfszip:/f:/jboss-5.1.0.ga/server/default/deploy/ejb_webservice1.jar/state= ClassLoader mode=manual Requiredstate=postclassloaderorg.jboss.deployers.spi.deploymentexception:cannot Process Metadata ......... .........
Start looking for solutions:
Environment: JDK 1.6;jboss 5.1.0.GAeclipse 4.2


Here you can configure the jdk, there is also a Java compiler can be configured compiler level (in Red box). These two things are the key to this Problem.
At the time of development in eclipse, the JDK in Build path compiles the class library (that is, you are not using the class in this jdk), and the Java compiler compliance level is the compilation of the syntax of the project (that is, the correctness of the syntax in your project). You can also think of the role of the compiled version number configured in Java compiler compliance level as the running version of the JDK on the server that you want to run on the server after the project is completed in the Future.
And my problem is in the build path, configure 1.6 in Jdk,java compiler compliance level 1.7 (because I used to spend a period of time 1.7)


The 1.6 jdk on the JBoss server reported the error, saying that the JDK used for compiling (1.7) was higher than the JDK (1.6) used to run it, which was wrong. On other People's machines, the reason for not having an error is that the JDK he uses for JBoss is exactly 1.7. This version is backwards Compatible.
Take another example that has been lifted if JDK1.4 cannot use Generics. And the Java compiler compliance level is set by the Java code you have written, according to what JDK version is compiled, For example: set is 1.4, the compiled class file can be run on more than 1.4 jre, if the use of 5-level compilation, you can not run in the environment of 1.4, will be prompted version too high.

Summary: 1, in the development and deployment process, The safest approach is the build path, Java complier Compliance level,jboss Server Configuration of the JDK are consistent, there will be no problem. 2, we often focus on the JDK version of Build path and the JDK version of jboss, but they are connected through the Java complier compliance level. Sometimes we can't just follow the online steps to solve the problem, even if it's all Over. I have to admit that this is the shortest way to solve the problem, but from the shortcut, we should analyze and summarize the context of the problem, really understand the nature of it, it is a kind of accumulation, because the online solution is always for the outdated technology, the problem of new technology exposure will still make you unprepared, but fortunately the essence of technology is not easy to change , so, to grasp the essence, is the way to always win.

Do not know from when to start, is no longer satisfied with the solution of the problem is good, Hehe.

Thinking about the problem of Java Complier compliance level

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

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

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