顯示具有 Weblogic 標籤的文章。 顯示所有文章
顯示具有 Weblogic 標籤的文章。 顯示所有文章

2013年7月31日 星期三

WebLogic: Setup log4j for your Java Application

This is from: "http://phillips4jc.blogspot.com/2012/01/configuring-web-logic-1035-and-log4j.html"

I recently spent several days trying to track this down why Apache log4j for my Java application was working when deployed to Oracle WebLogic Server 10.3.5. I am posting my findings here in the hopes of saving others some time. I found several blogs that talked about this, but the end result was that log4j was still not working correctly. There was always one step missing. A co-worker and I finally figured it out for both Linux and Windows.

1. Copy wllog4j.jar from your WebLogic server/lib directory and place it in your domain_root/lib folder.
2. Copy your version of log4j.jar to your domain_root/lib folder.
3. Copy your log4j.xml to your domain_root folder. 
4. Log in to the your WebLogic admin server console. Click on Servers -> Admin Server -> Logging. Click on advanced mode, and change the logging implementation from JDK to Log4J. Save your changes.

Most of the blogs had these items, but the one critical piece that was missing:
5. (Linux)Edit the setDomainEnv.sh file in the domain_root/bin directory. and find the following code:

if [ "${LOG4J_CONFIG_FILE}" != "" ] ; then
       JAVA_PROPERTIES="${JAVA_PROPERTIES} -Dlog4j.configuration=file:${LOG4J_CONFIG_FILE}"
       export JAVA_PROPERTIES
fi

Insert the following above those lines of code(replacing the path with the one for your system's domain_root directory:

LOG4J_CONFIG_FILE=”/u01/app/oracle/middleware/user_projects/domains/base_domain/log4j.xml”
Export LOG4J_CONFIG_FILE

5. (Windows)
Edit the setDomainEnv.cmd file in the domain_root/bin directory. and find the following code:

if NOT "%LOG4J_CONFIG_FILE%"=="" (                                                          
            set JAVA_PROPERTIES=%JAVA_PROPERTIES% -Dlog4j.configuration=file:%LOG4J_CONFIG_FILE%
)

Insert the following above those lines of code(replacing the path with the one for your system's domain_root directory:

set LOG4J_CONFIG_FILE=”C:\Oracle\Middleware\user_projects\domains\base_domain\log4j.xml”


6. Activate the changes and restart the admin server.

Here is a sample log4j.xml file. Obviously, you will need to update it for a valid location for your file appender, and replace yourcompany and yourproject with valid values.





   
   
   
    
        
        
            
            
        
    

    
        
        
        
            
        
    

    
    

    
      
    

    
        
    

    
        
    

    
    
    
        
        
    

Weblogic: Properties and xml files under WEB-INF/classes disappear after deployment

on WebLogic 10, all the Properties files and xml files will be on the _wls_cls_gen.jar file after deployment.
_wls_cls_gen.jar file will save under _WL_user/[application]... /lib folders.

zip:C:/bea103/user_projects/domains/Test_Domain/servers/AdminServer/tmp/_WL_user/testWebApp/8j5e1y/war/WEB-INF/lib/_wl_cls_gen.jar!/test.properties 

Now if we write the following code inside out application like Servlet then it won’t work and will fail while reading the Properties file: 

Note: Many frameworks uses the Following techinques and Sometimes WebLogic Code causes this issue..(http://forums.oracle.com/forums/thread.jspa?messageID=4217650#4217650)…which may cause our applications to fail while reading jar Archieved resources. because they uses the following techinque to read the resources available inside a JAR file: 

Change code:
  1. InputStream stream = null;  
  2.   
  3. try {  
  4.   
  5. Properties p = new Properties();  
  6.   
  7. String path=Thread.currentThread().getContextClassLoader().getResource(“Info.properties”).getPath();  
  8.   
  9. System.out.println(“—————-PATH: “+path);  
  10.   
  11. p.load(new java.io.FileInputStream(path));  
  12.   
  13. Host = p.getProperty(“Host”);  
  14.   
  15. Pot = p.getProperty(“Port”);  
  16.   
  17. User = p.getProperty(“User”);  
  18.   
  19. Passwd = p.getProperty(“Passwd”);  
  20.   
  21. System.out.println(“Property Key-Values:” +”\n”+ Host +”\n”+ Pot + “\n”+User+ “\n”+Passwd);  
  22.   
  23. } catch (Exception e) {  
  24.   
  25. e.printStackTrace();  
  26.   
  27. }  


To:

  1. InputStream stream = null;  
  2.   
  3. System.out.println(“————————————”);  
  4.   
  5. try {  
  6.   
  7. Properties p = new Properties();  
  8.   
  9. stream=this.getClass().getClassLoader().getResourceAsStream(“Info.properties”);  
  10.   
  11. p.load(stream);  
  12.   
  13. Host = p.getProperty(“Host”);  
  14.   
  15. Pot = p.getProperty(“Port”);  
  16.   
  17. User = p.getProperty(“User”);  
  18.   
  19. Passwd = p.getProperty(“Passwd”);  
  20.   
  21. System.out.println(“Property Key-Values:” +”\n”+ Host +”\n”+ Pot + “\n”+User+ “\n”+Passwd);  
  22.   
  23. } catch (Exception e) {  
  24.   
  25. e.printStackTrace();  
  26.   
  27. }  


2012年3月28日 星期三

Oracle connection drop repeatedly on Weblogic/WebCenter


If Oracle connection is dropped repeatedly for unknown reason. Try to do this:

sqlplus sys/welcome1@XE as sysdba
show parameter session
show parameter processes
alter system reset sessions scope=spfile sid='*';
alter system set processes=200 scope=spfile;
shutdown immediate

exit
net stop OracleServiceXE
net start OracleServiceXE
sqlplus sys/welcome1@XE as sysdba
show parameter session
show parameter processes
exit

2011年9月12日 星期一

Weblogic: Create new and start up Managed Server


Create a new managed Server
1. Go to console.
2. Click Environment => Servers => New
3. Give a new name and use different port from other servers.
4. Save

Add library into new managed Server:
1. Go to console
2. Click on Deployment => adf.oracle.domain(1.0,11.1.1.0.0) => Target
3. Choose new managed server
4. Save
5. Repeat the 1-4 actions on library:

  • adf.oracle.domain.webapp(1.0,11.1.1.1.0)
  • jsf(1.2,1.2.9.0)
  • jstl(1.2,1.2.0.1)
  • ohw-rcf(5,5.0)
  • ohw-uix(5,5.0)
  • UIX(11,11.1.1.1.0)
  • oracle.adf.dconfigbeans(1.0,11.1.1.0.0)
  • oracle.adf.management(1.0,11.1.1.1.0)
  • oracle.dconfig-infra
  • oracle.jrf.system.filter
  • oracle.jsp.next(11.1.1,11.1.1)
  • oracle.sdp.client(11.1.1,11.1.1)
  • oracle.soa.workflow.wc(11.1.1,11.1.1)
  • oracle.webcenter.framework(11.1.1,11.1.1)
  • oracle.webcenter.framework.view(11.1.1,11.1.1)
  • oracle.webcenter.jive.dependency(11.1.1,11.1.1)
  • oracle.webcenter.skin(11.1.1,11.1.1)
  • oracle.wsm.seedpolicies(11.1.1,11.1.1) – only if you have installed Oracle Webservices Manager.
  • oracle.portlet-producer.jpdk(11.1.1,11.1.1)
  • oracle.portlet-producer.wsrp(11.1.1,11.1.1)
  • DMS application
  • wsm-pm

6. Go to console => Environment/Startup and Shutdown Classes:
7. Choose each item and add target to new managed server.



Start up new server on Windows:
1. Start up the domain
2. Go to %oracle_home%/user_projects/domains/[your domain]/bin
3. Create a shortcut on startManagedWebLogic.cmd on Desktop
4. Go to properties on the shortcut => Shortcut tab
5. Add [manage server name] & into target like C:/..../startmanagedWebLogic.cmd newManagedServer &
6. Double click on Shortcut.


Following is from 

Oracle recommends creating a separate  schema to store custom Webcenter application metadata. Using existing  schemas may corrupt seeded repositories.
  1. Run rcu from RCU_HOME/bin folder. Skip the first screen.
  2. Specify Database connection parameters in the next step.
  3. From “Select Components” screen, specify “ORAFMWSCHOOL” for “Create a new Prefix”. Select Oracle AS Repository Components –> AS Common Schemas –> Metadata Services. Click Next.
  4. Enter schema password and confirm the same.
  5. Click Next and then Finish.
This creates ORAFMWSCHOOL_MDS schema in the database.
Login to Enterprise Manager console using http://localhost:7001/em
Click on “Metadata Repositories” link from left sidebar.
image
Click on “mds-soa” to bring up SOA MDS repository detail screen. From “Metadata Repository” menu under mds-soa, select Administration –> Register/Deregister.
image
From Database Repositories section, click on “Register…”. Enter database details and click on Query.
image
Select ORAFMWSCHOOL_MDS from the list of displayed Metadata Repositories. Enter a Repository Name and Schema password we created in Step 2.
This completes registration of repository with Oracle Weblogic server domain.



2010年8月19日 星期四

Error: ORA-01005: null password given; logon denied

In your JDeveloper
Click on Module.xml
Click on Configurations
Select ModuleLocal
Click on the Edit button
Change the Connection Type to JDBC DataSource
Redeploy your application to the WLS

2010年7月15日 星期四

Weblogic: heap size

Change file setting on C:\Oracle\Middleware\jdeveloper\jdev\bin\jdev.conf
Or just find the file in JDeveloper folder.

2010年7月8日 星期四

Connect EJB from other client to Weblogic

Please include following JAR file:
Creating a wlfullclient.jar for JDK 1.6 client applications
Use the following steps to create a wlfullclient.jar file for a JDK 1.6 client application:

Change directories to the server/lib directory.
cd WL_HOME/server/lib
Use the following command to create wlfullclient.jar in the server/lib directory:
java -jar wljarbuilder.jar
You can now copy and bundle the wlfullclient.jar with client applications.
Add the wlfullclient.jar to the client application’s classpath.

Creating a wlfullclient5.jar for JDK 1.5 client applications
Change directories to the server/lib directory.
cd WL_HOME/server/lib
Use the following command to create wlfullclient.jar in the server/lib directory:
java -jar wljarbuilder.jar -profile wlfullclient5
You can now copy and bundle the wlfullclient5.jar with client applications.
Add the wlfullclient5.jar to the client application’s classpath..
(REMEMBER: USE JDK1.5 to generate the jar file)

Refer from http://download.oracle.com/docs/cd/E12840_01/wls/docs103/client/jarbuilder.html#wp1077742

Default URL and username for JDeveloper Integrated Weblogic Server

Here it is:
URL: http://localhost:7101/console
username: weblogic
password: weblogic1