Problems with deploying applications in Weblogic and Oracle Linux

Source: Internet
Author: User

My blog on javaeye (http://mr-caochong.iteye.com/blog/1013949)

 

 

There's no table here. You'll see it later.

 

 

A company project is going to be launched in the past few days. After a server running environment is set up on the user site, our main task is to transplant the application to the new environment.

 

 

 

 

 

Deployment Environment

Development Environment

Operating System

Oracle Enterprise-R5-U5-Server-x86_6

Windows 7/Windows XP

Middleware

WebLogic Server 10.3

Tomcat 6

JDK

Jdk1.6

Jdk1.6

J2EE SDK

5.0

5.0

Database

Oracle

Oracle

 

 

We have encountered various problems when porting applications developed in the Tomcat environment to WebLogic, which is recorded here.

 

 

I. At the beginning, I was prepared to compress the web application into a war package and use the Weblogic Management Server for installation. I encountered the first problem.

 

 

Error 1:

An unexpected exception occurs when processing the request.

Message:

Stack tracing: Java. Lang. nullpointerexception

At com. Bea. Console. Actions. App. Install. flow. uploadapp (flow. Java: 256)

At sun. Reflect. nativemethodaccessorimpl. invoke0 (native method)

At sun. Reflect. nativemethodaccessorimpl. Invoke (nativemethodaccessorimpl. Java: 39)

Thousands of characters are omitted ...............

Error 2:

Java. Lang. outofmemoryerror: Unable to create new Native thread

 

 

 


 

Problem Analysis:

These errors occur during File Upload because of our large project and insufficient virtual swap memory. The problem is solved after the virtual memory of Weblogic is modified to a greater value.

Solution:

Find the Weblogic Startup File startweblogic. sh, because the file actually calls bin/setdomainenv. sh file, so the real change is setdomainenv. sh (in my case, this file is located in/middleware/user_projects/domains/base_domains/bin)

Adjust permsize and maxpermsize to 256 and 512 (based on actual needs)

 

2. At this time, we will be able to solve this problem. Who knows that the second problem is coming?

 

 

Error:

Java. Lang. illegalstateexception: cannot set web app root system property when war file is not expanded

 


Problem Analysis:

This is because the war package is used during deployment. the Weblogic deployment application is started directly instead of extracting the war from tomcat. Because we use this in many JSP and Servlet files. servletcontext. getrealpath ("/") is similar in writing. Because there is no real path in the war file, getrealpath ("/") is not an intended value, for example, null.

Solution:

Because there are many places to use this method to obtain the Web server path, it is obviously not a good way to change one by one, and using war to deploy directly will be troublesome for subsequent application updates, therefore, another deployment method is file directory deployment.

 

 

3. File directory deployment

 

Deploying with a file directory means installing with the Weblogic Management Server, directly specifying the local application folder, as long as there is a WEB-INF/Web. xml under the folder, can be selected for the installation.

So the next step is to create the installation directory of the application.

Different from the Weblogic domain management directory path, we created a directory in the root path.

/Deploy/applications/APP

/Deploy/applications/plan

APP: Prepare to store the app. After the folder is created, copy the entire folder of our app (such as wzfy) to the app.

Plan: After the Weblogic Management Server has installed the applications under the app, the app deployment plan file is automatically created here.

On the Management Server, find the directory/deploy/applications/APP and select wzfy to start installation. Third problem

 

 

You cannot access the selected application.

Exception in appmerge flows 'sssion

Exception in appmerge flows 'sssion

[J2EE: 160111] error: APPC can not write to the working directory, '/deploy/applications/APP/wzfy '. please ensure that you have write permission for this directory and try again.

 

 

In terms of text meaning,/deploy/applications/APP/wzfy is not writable for users.

It's strange that we can only create directories manually? How can I use WebLogic Server to install it.

For example, if we create a root user for the user, the directory operation will be fine, and the user logged on to WebLogic Server will definitely not have this permission if it is not authorized. As a result, WebLogic Server user Weblogic is granted the access permission to the directory/deploy/applications.

 

The authorization method is as follows:

 

Chown-RF WebLogic: WebLogic/deploy/Applications

 

After authorization, install and deploy, and go all the way down until wzfy is started. The fourth problem occurs.

 

4. failed to create sessionfactory

 

 

Weblogic. application. moduleexception:

[Http: 101216] servlet: "context" failed to preload on startup in Web Application: "wzfy ". org. springframework. beans. factory. beancreationexception: Error creating bean with name 'sessionfactory 'defined in servletcontext resource [/WEB-INF/applicationcontext. XML]: initialization of bean failed;

Nested exception is org. hibernate. hibernateexception:

Errors in named queries: queryviewbymoduleid, querysecparentownerbyid,

Thousands of characters are omitted .................................................................................

At org. hibernate. impl. sessionfactoryimpl. <init> (sessionfactoryimpl. Java: 364)

 

 

Problem Analysis:

After encountering this problem, I am confused. How can this problem be solved? The first idea is that we may use the name queries (name query) method in the hibernate ing file, will WebLogic not recognize it? I used a lot of materials through Google and Baidu, tried a lot of methods and ended up failing. Finally, I found a piece of content that my buddy summarized in the blog and solved the problem.

 

 

5. Deployment of hibernate3 and axis

Hibernate in hibernate3. query. the default value of factory_class is Org. hibernate. hql. ast. astquerytranslatorfactory, which throws Org. hibernate. queryexception: classnotfoundexception: Org. hibernate. hql. ast. the hqltoken is abnormal.

This problem online said a lot, the solution is also a variety of, in fact, very simple, WebLogic system by default to load the EJB-QL parser, there is a duplicate class, so the use of classnotfoundexception will appear. Generally, the modification method on the Internet is to modify the startweblogic running script, the antlr-2.7.5H3.jar file is preferentially loaded. However, this method may cause some other problems, so it is not recommended. The best way is,

Create a weblogic. xml file in the WEB-INF directory and write the following code into the file:

<? XML version = "1.0" encoding = "UTF-8"?>

<! Doctype Weblogic-web-app public "-// BEA Systems, Inc. // DTD web application 8.1 //" http://www.bea.com/servers/wls810/dtd/weblogic810-web-jar.dtd ">

<Weblogic-web-app>

<Container-Descriptor>

<Prefer-web-INF-classes> true </prefer-web-INF-classes>

</Container-Descriptor>

</Weblogic-web-app>

(Prefer-web-INF-classes = true is Weblogic's classloader in the cognominal class, priority load web application in the WEB-INF class.

The same is true for Axis deployment.

 

 

 

At this point, the problem has been completely solved. I would like to thank many enthusiastic netizens for writing their own solutions to the problem and contributing them to the masses of working people. So I am also ready to summarize the problems solved today, put it in the blog, hoping to provide some help to friends who encounter the same problem.

 

 

 

 

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.