weblogic整理
这两天研究了下weblogic部署web项目,当然了解的还是皮毛不够深入,仅在此做下记录,为以后的工作和学习提供参考。
首先我从oracle上下载了一个oracle的简单的版本来做下简单的学习(可以在开发上用) fmw_12.2.1.0.0_wls_quick_Disk1_1of1.zip解压之后实际上只有一个jar包和txt文件。当然这个测试版本要求的jdk是1.8以上,如果用低于1.8的版本的话,会有问题导致启动不成功。因此在这里如果使用jdk的版本较低,下载些低版本的压缩包来进行测试。
在readme.txt文件中有相关的操作步骤,具体参考如下:
Oracle WebLogic Server 12.2.1 Quick Installer
==========================================================================================
The Oracle WebLogic Server 12.2.1 Quick Installer is a lightweight installer that contains all the necessary artifacts to develop and test applications on Oracle WebLogic Server 12.2.1. The Quick Installer does not have a user interface and is run directly from command line. The Quick Installer is supported on Windows, Linux and Mac OS X systems. Installations performed with the Quick Installer can be patched using standard Oracle Patching tool, OPatch.
An optional supplemental quick installer (fmw_12.2.1.0.0_wls_supplemental_quick.jar) is available as a separate download and contains additional, non essential components such as the sample set, the Http Pub-Sub server and L10N console help files.
This version of Oracle WebLogic Server and the Quick Installer require the use of JDK 1.8. Ensure that you have the proper JDK version installed and ready for use before starting.
QUICKSTART
1. Setup JAVA_HOME for the target platform.
2. If running on Windows you will need to run as Administrator.
3. Run the Quick Installer jar file and specify values are desired to define where the installation will be performed. Some examples of running the Quick Installer are:
$ java -jar fmw_12.2.1.0.0_wls_quick.jar
This will use the current working directory as the ORACLE_HOME in which to install WebLogic Server. You must make sure that the current working directory (ORACLE_HOME) does not contain an existing wls12210 directory.
$ java -jar fmw_12.2.1.0.0_wls_quick.jar ORACLE_HOME=<location>
This will use the specified ORACLE_HOME as the directory in which to install WebLogic Server.
4. To see the full set of options available to run the Quick Installer specify the -help command when running it:
$ java -jar fmw_12.2.1.0.0_wls_quick.jar -help
CONFIGURE AN ORACLE WEBLOGIC SERVER DOMAIN
Once the Quick Install has completed and installed Oracle WebLogic Server, a domain will need to be manually created. A domain can be created directly from the command line or it can be created using the Configuration Wizard.
CREATING A DOMAIN WITH THE CONFIGURATION WIZARD
Launch the Configuration Wizard
Linux $ . <ORACLE_HOME>/oracle_common/common/bin/config.sh
Mac $ . <ORACLE_HOME>/oracle_common/common/bin/config.sh
Windows > <ORACLE_HOME>\oracle_common\common\bin\config.cmd
CREATING A DOMAIN FROM THE COMMAND LINE
1. Setup WebLogic Server environment in the current shell.
Linux $ . <ORACLE_HOME>/wlserver/server/bin/setWLSEnv.sh
Mac $ . <ORACLE_HOME>/wlserver/server/bin/setWLSEnv.sh
Windows > <ORACLE_HOME>\wlserver\server\bin\setWLSEnv.cmd
2. Create a new directory to store the domain and start the server.
Linux
$ mkdir domain
$ cd domain
$ JAVA_HOME/bin/java weblogic.Server
Mac
$ mkdir domain
$ cd domain
$ $JAVA_HOME/bin/java weblogic.Server
Windows
> mkdir domain
> cd domain
> %JAVA_HOME%\bin\java.exe weblogic.Server
Once the domain is created, you should shutdown the server and restart it with the scripts provided in the newly created domain. This will start the associated Derby database instance that is provided to make development easier with the Java EE 7 default datasource definition and operate as a default Job Repository for the Batch API.
REMOVE INSTALLATION
Delete the ORACLE_HOME directory. If you have created domains or extracted Supplemental Quick Install, those files will be removed as well.
WHAT IS NOT INCLUDED IN THE QUICK INSTALLER
- Native JNI libraries for unsupported platforms.
- Samples, non-english console help (can be added by using the WLS supplemental Quick Install)
- Oracle Configuration Manager (OCM) is not included in the Quick installer
- SCA is not included in the Quick Installer
做完一个简单的安装之后,我们尝试下来部署项目。因为我们安装的这个版本和真正的安装到生产环境中的版本还是有区别的,因此启动的时候我们只需找到启动脚本就可以。
找到安装目录下的startWebLogic.cmd来双击启动。启动过程中会要求输入用户名/密码(安装的时候事先设置好的)。
之后在浏览器中输入相关地址,出现登录界面,输入用户名/密码(同上一致)
这一次我们在界面上部署一个web项目来测试一下
1)点击部署,此时定制列表中没有任何已经部署的项目
2)点击锁定并编辑,我们来部署一个项目
3)点击部署下面的"安装"按钮,来选择war包的路径,前提是我们已经事先准备好了一个war包,然后点击下一步
4)安装完成
此时已经完成了部署,但是我们要访问我们的项目还需要先将项目启动
5)点击控制一栏,出现已经部署完成的项目列表
6)选中项目然后,选择相应的启动项。
7)如果启动成功,健康状况一栏会显示“正常”。
8)此时我们就可以在浏览器中访问我们的项目了,如:访问fileuploadanddownload
http://localhost:7001/fileuploadanddownload/jsp/multifile_upload.jsp
然后简单的操作一下看下是否成功,就ok了。
备注:在启动的时候可能遇到的问题及方案,如果遇不到最好。
java.lang.ClassCastException: com.sun.faces.application.WebAppLifecycleListener cannot be cast to java.util.EventListener
解决方案:
Web工程的lib目录下找到jsf-api.jar、jsf-impl.jar将其删除,即可。
如若还有问题再试着删除jstl-1.2.jar文件。
重新启动weblogic成功。