Home > Java > javaTutorial > body text

How to solve problems when deploying weblogic?

零下一度
Release: 2017-07-17 13:33:12
Original
2530 people have browsed it

As a commercial middleware (EJB, jndi data source, log management, memory management, resource configuration management...), weblogic is beyond the reach of some open source free small containers.

weblogic was first developed by weblogic Inc. and later merged into BEA. Finally, BEA was merged into Oracle.

weblogic is a Java application server used to develop, integrate, deploy and manage large-scale distributed web applications, network applications and database applications.

Therefore, weblogic is generally used as the server for online release and deployment of projects, and Tomcat/Jetty.... small containers are mostly used for local research and development.

This will inevitably cause problems. A web program that runs well locally will have problems of one kind or another when deployed in weblogic.

Most of the problems are caused by the conflict between the jars that weblogic depends on and the jars in the project (the same jar but different versions) or because weblogic does not support the project jar.

When there is a problem with deploying weblogic (summarize three things by yourself):

1. Confirm the weblogic version used by the company and read the official website for the corresponding weblogic Standards supported by the version;

2. Check the weblogic error log to determine the conflicting jar or determine the jar that is not supported by the webloigc;

3. For conflicting jars, add the weblogic.xml configuration file in the project WEB-INFO directory, which declares the project jars to be preloaded;

4. For jars that are not supported by the webloigc version jar, upgrade the weblogic version, or reduce the jar version used by the project.

1. Determine the weblogic version and check the corresponding supported standards

Only by knowing the enemy can you be invincible, because there are many small versions of weblogic and the versions are different. There is a big difference between them.

There are many ways to check the weblogic version. The most direct way is to ask a colleague who installed weblogic, or log in to linux as shown below.

After learning the deployed version, go to the oracle weblogic official website. The documentation there is the most comprehensive and authoritative. of.

Find the corresponding version and click view Library to jump in. This is an overview of the entire version. Our focus should be on the standards supported by this weblogic version.

It contains detailed java, web service, and some miscellaneous standards supported by weblogic, such as JDK, EL, Servlet, JAX-RS, JAX-WS....

2. Check the deployment error log to determine the problem and solve it

With the above Specific support standards, combined with specific classes and methods for deploying error reports, can provide the right solution.

The following is a list of several common error exceptions when deploying weblogic (there are many more to be added):

java. lang.UnsupportedClassVersionError: Unsupported major.minor version 51.0 (weblogic Jdk version is inconsistent with project jdk version)

request.getRealPath() is null (servlet-api. There are differences between jar local and weblogic. Use class loading Thread.currentThread().getContextClassLoader() to get the relative path)

##ClassNotFoundException: org.hibernate.hql.ast .HqlToken (weblogic already relies on an earlier version of antlr.jar)

There are generally three ways to solve such problems. You can also practice them yourself when you encounter deployment problems. .

a. Delete the conflicting jar folder under weblogic:

(1) Delete the conflicting jar in /bea/weblogic12.1.3/server/lib/weblogic.jar Folder;

(2) Copy the conflicting XXX.jar to /bea/weblogic12.1.3/server/lib, and restart weblogic.

#b. Modify the startup script to load certain jars first

(1) Copy the conflicting jar package to ${DOMAIN_HOME} /lib directory.

(2) Find the startWeblogic.sh file under ${DOMAIN_HOME}/bin, open it with a text editor, and add the following content to it:

export first_classpath=${DOMAIN_HOME}/lib/xxxx.jar  
SAVE_CLASSPATH="${first_classpath}:${CLASSPATH}"
Copy after login

c. Through the configuration of weblogic .xml in the application, the application jar is loaded first

Because the weblogic version is not used, the weblogic configuration items will be If there are differences, do not blindly copy from the Internet.

Official website version description (for other versions, just change 1213):

Pay attention to prefer-application-resources/prefer-application -packages (pre-load the jar corresponding to the application) Node configuration:

<?xml version="1.0" encoding="UTF-8"?><weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app"><container-descriptor><prefer-web-inf-classes>false</prefer-web-inf-classes><prefer-application-packages><package-name>预先加载项目 lib 中的包名,支持通配符</package-name><package-name>com.sun.faces.*</package-name><package-name>com.bea.faces.*</package-name></prefer-application-packages></container-descriptor></weblogic-web-app>
Copy after login

Among solutions a/b/c, solution c is the optimal solution. As a production environment, weblogic may deploy multiple applications, and it is unlikely that you can restart them at will.

Solutions a and b will destroy the integrity of weblogic and may cause problems in other applications deployed on weblogic.

The above is the detailed content of How to solve problems when deploying weblogic?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!