tag:blogger.com,1999:blog-70217956471057176392024-03-15T05:42:26.421-05:00Tech CafeThis blog covers configuration, build, development, deployment issues, work arounds & tips in weblogic, websphere application & portal servers.Ananthhttp://www.blogger.com/profile/01014064398352414331noreply@blogger.comBlogger40125tag:blogger.com,1999:blog-7021795647105717639.post-70867652900907080482011-06-14T11:39:00.000-05:002011-06-14T11:39:52.067-05:00Difference between JSR 168 and JSR 286 portletsJava Portlet spefication168 (v1.0) has very basic portlet porgramming model and had lot of limitations for portlet development. Java Portlet spefication286 (v2.0) was developed to overcome the shortcomings on v1.0 specs(JSR 168) such as:<br />
<br />
1. Inter portlet communicaiton (IPC) - IPC through events and public render parameters<br />
2. Support for WSRP 2.0<br />
3. Public render paremeters - Allows portlets to share parameters with other portlets.<br />
4. Portlet filters and listeners.<br />
5. Resource serving - Provide ability for portlets to server a resource<br />
6. AJAX supportAnanthhttp://www.blogger.com/profile/01014064398352414331noreply@blogger.com15tag:blogger.com,1999:blog-7021795647105717639.post-38259071021026488512011-05-26T10:03:00.002-05:002011-05-26T10:04:04.795-05:00Weblogic Portal Interview Questions IIIAnswers to follow:..<br />
1. What is the difference between JSR 168 and JSR 286 specs?<br />
2. What is managed bean?<br />
3. What is the difference between managed bean and backing bean?<br />
4. If you have two same portlet instances in a single page, what are the things you need to consider in using java script?<br />
5. How did you handle security in WSRP?<br />
6. What are the performance issues you had in WSRP?Ananthhttp://www.blogger.com/profile/01014064398352414331noreply@blogger.com8tag:blogger.com,1999:blog-7021795647105717639.post-61661248728246331592011-05-26T07:37:00.000-05:002011-05-26T07:37:12.875-05:00Why SOA?SOA helps create greater alignment between IT and line of business while generating more flexibility - IT flexibility to support greater business flexibility. Your business processes are changing faster and faster and global competition requires the flexibility that SOA can provide.<br />
- SOA can help you get better reuse out of your existing IT investments as well as the new services you're developing today.<br />
- SOA makes integration of your IT investments easier by making use of well-defined interfaces between services.<br />
- SOA also provides an architectural model for integrating business partners’, customers’ and suppliers’ services into an enterprise’s business processes. This reduces cost and improves customer satisfaction.Ananthhttp://www.blogger.com/profile/01014064398352414331noreply@blogger.com4tag:blogger.com,1999:blog-7021795647105717639.post-19456779447787478142010-02-11T12:05:00.001-06:002010-02-11T12:10:02.886-06:00Set session timeout in WeblogicThere are two ways user's HTTP session timeout can be set for your web application.<br />
1. Web.xml<br />
2. Weblogic.xml<br />
<br />
<b><i><u>Web.xml</u></i></b><br />
<session-config><br />
<session-timeout>60</session-timeout><br />
</session-config><br />
Please note in web.xml the <i><b>session timeout is set in minutes.</b></i><br />
<br />
<b><i><u>Weblogic.xml</u></i></b><br />
<session-descriptor><br />
<session-param><br />
<param-name>TimeoutSecs</param-name><br />
<param-value>3600</param-value><br />
</session-param><br />
</session-descriptor> <br />
In weblogic.xml the <b><i>session timeout is set in seconds.</i></b><br />
<br />
More importantly the timeout value set in web.xml takes precedence over weblogic.xml. If you don't set any values in web.xml, weblogic.xml takes over. I think it is better to handle session timeout in web.xml itself since web.xml takes precedence over application server’s deployment descriptors.Ananthhttp://www.blogger.com/profile/01014064398352414331noreply@blogger.com28tag:blogger.com,1999:blog-7021795647105717639.post-65244260774235910192010-02-09T21:30:00.001-06:002010-02-10T13:43:32.178-06:00Drawbacks of AjaxWe all know how Ajax is important in today's world. Thanks to google. You can develop rich and interactive web/portal applications by using combination of Ajax, Java script, REST APIs. I am not against Ajax but I honestly think one should know when to use it and when NOT to use it. Here are some known limitations of using Ajax.<br />
<br />
1. Not all browsers supports Ajax. Though IE 5.x, 6.x, Mozilla 1.x, Firefox still supports. <br />
2. XMLHttpRequest is not supported in older version. No standardization of XMLHttpRequest yet.<br />
3. Java Script code could be visible to a hacker. <br />
4. UI developers must have JavaScript skills.<br />
5. Ajax based applications are difficult to debug, test and maintain.<br />
6. Toolkit/Frameworks are still maturing.<br />
7. Lack of design patterns or best practices guidelines yet. <br />
8. Server side developers need to understand, presentation logic is required both at client & server side as well.<br />
9. Namespace collision is possible.Ananthhttp://www.blogger.com/profile/01014064398352414331noreply@blogger.com8tag:blogger.com,1999:blog-7021795647105717639.post-83541546859776716132010-02-09T20:57:00.000-06:002010-02-09T20:57:18.360-06:00How to implement breadcrumb in Weblogic PortalBreadcrumbs is one of the cool features of weblogic portal framework for UI navigation. We have successfully implemented this functionality for one our portal applications. The JSP is given below which is based on weblogic portal 10.2 version. I think it should work with weblogic portal 10.3 as well. Let me know if you are running into any issues with this JSP. This jsp should be included as part of page.jsp.<br />
<br />
<b><u>Breadcrumb.jsp:</u></b><br />
<%@ page language="java" contentType="text/html;charset=UTF-8"%><br />
<%@ page import="com.bea.netuix.servlets.controls.window.WindowPresentationContext,<br />
com.bea.netuix.servlets.controls.window.TitlebarPresentationContext,<br />
java.util.ArrayList,<br />
java.util.Iterator,<br />
com.bea.portlet.PageURL,<br />
com.bea.netuix.servlets.controls.page.BookPresentationContext,<br />
com.bea.netuix.servlets.controls.page.PagePresentationContext,<br />
com.bea.netuix.servlets.controls.window.WindowCapabilities"<br />
%><br />
<%@ page session="false"%><br />
<%@ taglib uri="http://www.bea.com/servers/portal/tags/netuix/render" prefix="render" %><br />
<br />
<%--<br />
This is the JSP for the showing breadcrumbs in XYZ Eagle portal.<br />
It is part of the skeleton file page.jsp.<br />
<br />
Implementation based on WebLogic Portal 10.2.<br />
<br />
Author :: Ananth Kannan<br />
--%><br />
<br />
<%<br />
ArrayList breadcrumbTitles = new ArrayList(); <br />
ArrayList breadcrumbURLs = new ArrayList(); <br />
boolean isHidden = false;<br />
<br />
BookPresentationContext book = BookPresentationContext.getBookPresentationContext(request);<br />
PagePresentationContext pageCtx = PagePresentationContext.getPagePresentationContext(request);<br />
<br />
if (!(book.getDefaultPage().equals(pageCtx.getDefinitionLabel()))) <br />
{ <br />
breadcrumbTitles.add(book.getTitle()); <br />
breadcrumbURLs.add(PageURL.createPageURL(request,response,book.getDefaultPage()).toString()); <br />
} <br />
<br />
PagePresentationContext parentPage = book.getParentPagePresentationContext(); <br />
while (parentPage != null) <br />
{ <br />
breadcrumbTitles.add(parentPage.getTitle()); <br />
<br />
if (parentPage instanceof BookPresentationContext) <br />
{ <br />
BookPresentationContext parentBook = (BookPresentationContext)parentPage; <br />
breadcrumbURLs.add(PageURL.createPageURL(request, response, parentBook.getDefaultPage()).toString()); <br />
}<br />
else <br />
{ <br />
breadcrumbURLs.add(PageURL.createPageURL(request, response, parentPage.getDefinitionLabel()).toString()); <br />
} <br />
<br />
parentPage = parentPage.getParentPagePresentationContext(); <br />
}<br />
%><br />
<br />
<br />
<% <br />
//DO NOT SHOW BREADCRUMBS IN MAIN HOME PAGE and also in hidden page<br />
if (pageCtx.isHidden()) <br />
{ <br />
} <br />
else <br />
{ <br />
%> <br />
<ul class="breadcrumbs"><br />
<%<br />
for (int i = breadcrumbTitles.size() - 1; i >= 0; i--) <br />
{ <br />
if (((String)breadcrumbTitles.get(i)).equalsIgnoreCase("My Main Book")) { <br />
breadcrumbTitles.set(i, "My Home"); <br />
}<br />
<br />
%> <br />
<li class="first"><a href="<%=breadcrumbURLs.get(i) %>" ><%=breadcrumbTitles.get(i)%></a></li> <img src="<render:getSkinPath imageName="/arrow_right.gif" />" />&nbsp; <%<br />
} <br />
%> <br />
<% <br />
} <br />
%> <br />
</ul>Ananthhttp://www.blogger.com/profile/01014064398352414331noreply@blogger.com1tag:blogger.com,1999:blog-7021795647105717639.post-51721771597344002392010-01-28T20:48:00.013-06:002010-02-12T10:25:48.317-06:00Weblogic Portal Interview Questions - LatestAs the economy getting better day by day so is the job market. I am getting number of requests from fellow readers and job seekers to put more interview questions in weblogic portal. Let's get into business straightaway. Some are simple, some are tricky and few are, you got it! <br />
<br />
1. How do you integrate existing legacy applications, non-portal web applications into portal?<br />
2. How can you show/hide portlets in your applications at run time?<br />
3. What are the different ways to implement SSO in Weblogic portal?<br />
4. What are the different ways to create portlet preferences in weblogic portal?<br />
5. Have you used any iframe portlets?<br />
6. What are the limitations of IFrame portlets from portal perspective?<br />
7. Have you used AJAX in your portal ? What are the limitations?<br />
8. Have you used WSRP? What are the limitations of WSRP?<br />
9. How session handling is done in WSRP between consumer and producer? what are the different ways?<br />
10. Have use used domain templates? How do you create them? What are the advantages of domain templates?<br />
11. Different strategies of content propagation in weblogic portal?<br />
12. How do you offer books, pages and portlets as remote in weblogic portal 10.3?<br />
13. How do you do IPC (inter-portlet communication) between producer and consumer?<br />
14. How do you expose Weblogic portlets as a URL?<br />
15. How to show different look-and-feel for different users?<br />
16. How to create custom layouts in weblogic portal?<br />
<br />
<u><i><b>Useful Links:</b></i></u><br />
<div style="color: blue;"><a href="http://ananthkannan.blogspot.com/2009/08/weblogic-portal-interview-questions_29.html">More Weblogic Portal Interview questions with answers</a></div><div style="color: blue;"><a href="http://ananthkannan.blogspot.com/search/label/Weblogic%20Portal">More articles in Weblogic Portal</a></div>Ananthhttp://www.blogger.com/profile/01014064398352414331noreply@blogger.com132tag:blogger.com,1999:blog-7021795647105717639.post-27015328452744224282010-01-27T17:43:00.007-06:002010-01-29T01:02:11.601-06:00How to change from development mode to production mode in Weblogic 10.3Some of you have requested how to change Weblogic start up mode from DEV to production or vice versa. Actually it is very simple. One way to change it is, by simply editing <b>setDomainEnv.cmd </b>which resides in <b>$root_domain/bin</b> folder.<br />
<br />
1. Look for the line that sets the <code class="cCode">PRODUCTION_MODE</code> script variable: set PRODUCTION_MODE<br />
Add <b>false</b> to the value of the <code class="cCode">PRODUCTION_MODE</code> variable to ensure the server starts in development mode:<br />
Set <b>true</b> for starting in prod mode.<br />
<br />
set PRODUCTION_MODE=false<br />
<br />
2. Save your changes and exit the text editor.<br />
<br />
<b><i><u>Useful links:</u></i></b><br />
<a href="http://ananthkannan.blogspot.com/2009/10/how-to-create-domain-using-weblogic.html" style="color: blue;">How to create weblogic domain templates?</a><br />
<a href="http://ananthkannan.blogspot.com/2009/06/difference-between-domain-dev-mode-and.html"><span style="color: blue;">Difference between Dev mode and Prod mode</span></a>Ananthhttp://www.blogger.com/profile/01014064398352414331noreply@blogger.com34tag:blogger.com,1999:blog-7021795647105717639.post-37732353346953995762010-01-23T19:50:00.006-06:002011-06-10T16:30:18.445-05:00Federated Portal Vs Enterprise PortalWhat is a federated portal?<br />
A federated portal is a portal that consumes resources such as remote portlets, books, and pages. These remote resources are collected and brought together at run time to a portal application called a <b>consumer</b>, which presents the federated portal to end users. So in federated portal, portal application and portlets will be running in different containers where as in local portal, both will be running in a single portal container.<br />
<br />
A federated portal reflects a true <b>Service Oriented Architecture</b>(SOA). These individual remote parts basically called <b>producers</b> of a federated portal that can be maintained, updated, and released independently without redeploying the consumer portal in which they are surfaced. Lets say your organization has depts like sales, marketing, human resources and finance. Every department has its own budget, needs and resources. Sales dept doesn't need to worry about how finance portlets will look like though both portlets will be running under a portal consumer. Instead of building all portlets into a single portal applications, you can develop portlets for each dept separately and deploy portlets as seperate web applications running on remote servers while portal consumes them using WSRP. You can have producer for each department if you want to which will be easy to maintain. Federated portal uses <b>WSRP</b>(Web Services for Remote Portlets (WSRP) for decoupling portlets from portal. <br />
<br />
Enterprise or (Local) portals are the one where all portlets will be developed, maintained and deployed in a single container. So small changes to the portal, you need to perform whole life cycle - design, development, testing, deployment and propagation to development to staging to production. This may be OK for small sized portal but as the portal grows maintenance becomes very difficult. For many organizations, the cost of such maintenance is significant and can include portal downtime. Federation simplifies portal maintenance.<br />
<br />
<b><i><u>P.S:</u></i></b> All WebLogic Portal applications are, by default, both consumers and producers. This means that every WebLogic Portal application is capable of hosting remote portlets and consuming them. With a federated portal architecture, separate development teams, perhaps in separate business units, operating in different geographical locations, can focus on and develop their respective portlets. These development teams can update, test, and release their portlets independently from one another. You do not need to redeploy a federated portal every time a portlet deployed in aproducer changes. When a remote portlet is updated in a producer, all of the consumers of that portlet receive the change immediately and automatically.Ananthhttp://www.blogger.com/profile/01014064398352414331noreply@blogger.com8tag:blogger.com,1999:blog-7021795647105717639.post-44111645472725047952010-01-20T20:44:00.014-06:002010-02-09T21:17:29.937-06:00How to Integrate web applications into Weblogic PortalIf you are a portal developer or portal architect working at client site for providing portal solutions, you will come across these questions. How will I integrate my existing web applications into portal? Or How do I bring all web applications into single user interface? How to provide a single point of access to existing applications so user just login only once? Well, there are many ways to do that. Lets take the simple approach first.<br />
<br />
<b><i><u>1. Links</u></i></b><br />
Links portlets are one of the quickest ways to integrate with existing applications, though providing just links is not actual integration. Trust me, we have developed many links portlets for integration as it is quick to develop and not much coding is needed. But there is some disadvantage too as we are making users to jump into another applications.<br />
<br />
<b><i><u>2.IFrame portlet </u></i></b><br />
Believe me we have developed iframe portlets as well. This is second most common way to quickly integrate an application into a portal. By using <iframe> html tag in a portlet we can reference the application. When we do so, application will be displayed under portal with portal banner and portal navigation. But there are some downsides to it too. Timesouts can be tricky because either the Iframes or portal can timeout before the other. There could be an issue with look-and-feel as well. The iframe tag can introduce scroll bars.<br />
<br />
<b><i><u>3. Web clipper portlets:</u></i></b><br />
This is another option for integrating any web application with portal. Web Clipping enables the clipping of an entire web page or a portion of it and reusing it as a portlet. Basic and HTML-form-based sites may be clipped. Use web clipping when you want to copy content from an existing web page and expose it in your portal application as a portlet.<br />
<br />
<b><i><u>4. WSRP portlets:</u></i></b><br />
Another approach is using WSRP - Web Services for Remote portlets. These portlets provide both presentation and business logic which is slightly different than standard web service which provides only business logic no presentation so every client had to implement on their own. To understand better, compare with HTTP where user interacts with remote servers by using browser and doing operation like form submitting. He gets his response as HTML in the browser. WSRP is a similar protocol between server and client. In WSRP terminology, the server is called a producer. It hosts services, typically portlets, that clients, or consumers, communicate with. Consumers uses WSRP which defines a common, well defined interface that defines how a portal(consumer) should interact with producer. WSRP is built upon existing Web services standards like SOAP, WSDL, and UDD. WSRP can aggregate portlets from more than one producers into single page and can apply consumer specific look-and-feel to that page.<br />
<br />
<b><i><u>5. Struts portlets:</u></i></b><br />
Lets say you have existing struts application up and running some where obviously outside portal and you would like to host in the portal. Weblogic portal provides struts portlets by which you can integrate with existing struts applications.Ananthhttp://www.blogger.com/profile/01014064398352414331noreply@blogger.com2tag:blogger.com,1999:blog-7021795647105717639.post-57685763839903815082010-01-19T13:13:00.005-06:002010-01-25T14:08:29.663-06:00Error code 413 in WeblogicSometimes if you have MaxPostSize set in Apache configuration(httpd.conf) to lower number such as 2048 bytes, you may get into error 413 when you perform operations such as file upload, data transfer from the browser. I had this issue for some of my applications deployed in weblogic server 10.3 with Apache proxying the requests.<br />
<br />
You might want either increase the size or remove it completely. if you don't mention it will take default integer which is -1. this means unlimited size.<br />
<Location /app1><br />
SetHandler weblogic-handler<br />
WebLogicHost localhost<br />
WebLogicPort 7001<br />
WLCookieName cookie1<br />
DynamicServerList OFF<br />
<b> MaxPostSize 2048</b><br />
Debug ALL<br />
WLLogFile logs/proxy.log<br />
</Location><br />
<br />
<b><i><u>Useful links:</u></i></b><br />
<br />
If you would like to know how to integrate Apache with Weblogic, please <a href="http://ananthkannan.blogspot.com/2009/05/how-to-configure-apache-plug-in-in.html">visit</a> this blog.Ananthhttp://www.blogger.com/profile/01014064398352414331noreply@blogger.com4tag:blogger.com,1999:blog-7021795647105717639.post-59643732090584036662009-12-30T17:04:00.003-06:002009-12-30T23:51:59.654-06:00Weblogic WAR Deployment ErrorIt looks like weblogic throws this error when web application is deployed only as WAR. But it doesn't throw any exception when deployed as exploded.<br />
weblogic.management.DeploymentException: <b><i>Cannot set web app root system property when WAR file is not expanded - with nested exception: [java.lang.IllegalStateException: Cannot set web app root system property when WAR file is not expanded]. <br />
</i></b><br />
There are two ways we can fix this issue when you still want to deploy as WAR. <br />
1. Go to server admin console->Domain-> Web applications. Click the checkbox of Archived Real Path Enabled<b>. </b>This should make an entry into domain config.xml as below. or you can directly edit your domain config.xml and add the below entry.<br />
<web-app-container><br />
<show-archived-real-path-enabled>true</show-archived-real-path-enabled><br />
</web-app-container><br />
2. Second option is at webapp level by updating weblogic.xml as below:<br />
<container-descriptor><br />
<show-archived-real-path-enabled>true</show-archived-real-path-enabled><br />
</container-descriptor><br />
The value of <show-archived-real-path-enabled> set in the web app has precedence over the value set at the domain level. The default value of this property is false. <b><i> </i></b>Ananthhttp://www.blogger.com/profile/01014064398352414331noreply@blogger.com4tag:blogger.com,1999:blog-7021795647105717639.post-28868881288192965582009-12-17T12:51:00.004-06:002009-12-22T06:57:52.014-06:00ServletContext.getRealPath returns nullAnother weird behavior from weblogic when webapp is deployed as WAR. ServletContext.getRealPath() returns null when deployed as WAR but it works ok when deployed as exploded. There are two ways we can fix this issue when you still want to deploy as WAR but would like to get over with this issue: <br />
1. Go to server admin console->Domain-> Web applications. Click the checkbox of Archived Real Path Enabled<b>. </b>This should make an entry into domain config.xml as below.<br />
<web-app-container><br />
<show-archived-real-path-enabled>true</show-archived-real-path-enabled><br />
</web-app-container><br />
<br />
2. Second option is at webapp level by updating weblogic.xml as below:<br />
<container-descriptor><br />
<show-archived-real-path-enabled>true</show-archived-real-path-enabled><br />
</container-descriptor><br />
The value of <show-archived-real-path-enabled> set in the web app has precedence over the value set at the domain level. The default value of this property is false.Ananthhttp://www.blogger.com/profile/01014064398352414331noreply@blogger.com59tag:blogger.com,1999:blog-7021795647105717639.post-10594782876848431152009-12-17T10:45:00.002-06:002009-12-17T10:46:13.944-06:00Java exception unknown sourceSometimes when debugging application we may run into this exception - <b>Java Exception unknown source.</b><br />
The possible reason could be when compiling the application, javac ant tasks omits debug option by defaut. So we will have to explicity set debug flag to true. See the <a href="http://ant.apache.org/manual/CoreTasks/javac.html">javac ant task</a> documentation for more info. You can mention some thing like below:<br />
<pre><target name="compile">
<javac srcdir="${src.dir}" destdir="{dest.dir}." debug="on" debuglevel="lines,vars,source" />
</target></pre><pre></pre><pre></pre><pre>Hope this helps.</pre>Ananthhttp://www.blogger.com/profile/01014064398352414331noreply@blogger.com2tag:blogger.com,1999:blog-7021795647105717639.post-18706924593749260652009-12-16T19:42:00.008-06:002010-01-26T14:24:41.364-06:00Log4jConfigListener Deployment IssueIt looks like Spring framework's Log4jConfigListener is having an issue when webapp is deployed as WAR. Log4jConfigListener is defined in web.xml. I got the below error while deploying the application in weblogic 10.3. <br />
<b>weblogic.management.DeploymentException: Cannot set web app root system property when WAR file is not expanded - with nested exception: [java.lang.IllegalStateException: Cannot set web app root system property when WAR file is not expanded].</b><br />
<br />
The solution is deploy the WAR as exploded or don't use Log4jConfigListener. The spring framework <a href="http://static.springsource.org/spring/docs/2.0.x/api/org/springframework/web/util/Log4jConfigListener.html">documentation</a> also says the WAR should be exploded.<br />
<br />
There is some update here. There is a solution available to this without any code change. We just need to set "Archived Real Path Enabled" option checked. Please <a href="http://ananthkannan.blogspot.com/2009/12/servletcontextgetrealpath-returns-null.html">check this blog entry</a> on how to enable.<br />
<br />
<b><i><u>Useful Links:</u></i></b><br />
<br />
To read more articles on Weblogic, please <a href="http://ananthkannan.blogspot.com/search/label/Weblogic">click </a>here.Ananthhttp://www.blogger.com/profile/01014064398352414331noreply@blogger.com6tag:blogger.com,1999:blog-7021795647105717639.post-60670190452298123482009-12-10T10:26:00.007-06:002009-12-10T16:45:27.961-06:00ResourceUtils.getFile() bug in Spring Framework 2.0.8 with weblogic10.3I cam across this weird problem which gave me really hard time for about 2-3 weeks. The issue is as below:<br />
We use spring framework in one of our web applications. One of the java classes loads XMLs which reside in web-inf/classes folder. It uses ResourceUtils.getFile() method as below:<br />
File file = ResourceUtils.getFile("classpath://data-values.xml");<br />
This method works fine when we deploy as exploded WAR in weblogic 10.3 but when we deploy as WAR, it gives FileNotFoundException. What weblogic does during WAR deployment(obviously it internally explodes) is, it puts all the files reside in web-inf/classes folder into jar called _wl_cls_gen.jar file and copies into web-inf/lib directory. This is where the problem during deployment as the java class was unable to read the xml and throwing <a class="api" href="http://java.sun.com/javase/6/docs/api/java/io/FileNotFoundException.html" rel="nofollow" target="_new" title="Java API">FileNotFoundException</a>.<br />
The exact error message is as below:<br />
<a class="api" href="http://java.sun.com/javase/6/docs/api/java/io/FileNotFoundException.html" rel="nofollow" target="_new" title="Java API">java.io.FileNotFoundException</a>: class path resource [//data-values.xml] cannot be resolved to absolute file path because it does not reside in the file system: zip:C:/domains/devDomain/servers/AdminServer/tmp/_WL_user/testWebApp/8j5e1y/war/WEB-INF/lib/_wl_cls_gen.jar!/data-values.xml<br />
So I was looking to see if there is a way to tell weblogic to avoid generating this jar as my java classes were unable to load XMLs which resides in that jar file now. It looks like as for as my knowledge there may not be a way. Even I have asked the same question in oracle forums itself but that didn't help. Also when we googled we came across this issue in number of search results. Some say it is spring issue with ResourceUtils.getFile().<br />
Some suggested use different approach to load xmls. So one of our team members tried using org.springframework.core.io.ClassPathResource which fixed the issue. The code snippet is as below:<br />
<span style="color: blue; font-family: "Calibri","sans-serif"; font-size: 11pt;"></span><br />
String xmlFile = "classpath://data-values.xml";<br />
<span style="color: blue; font-family: "Calibri","sans-serif"; font-size: 11pt;"></span><br />
final int index = StringUtils.lastIndexOf(xmlFile, "/") == -1 ? 0 : StringUtils.lastIndexOf(xmlFile, "/");<br />
final Resource resource = new ClassPathResource(StringUtils.substring(xmlFile, index, xmlFile.length()));<br />
final InputStream is = resource.getInputStream();<br />
try {<br />
final InputStreamReader reader = new InputStreamReader(is);<br />
try {<br />
final Document headerDoc = new SAXBuilder().build(reader);<br />
} finally {<br />
reader.close();<br />
}<br />
} finally {<br />
is.close();<br />
}<br />
<span style="color: blue; font-family: "Calibri","sans-serif"; font-size: 11pt;"></span><br />
It looks like Spring's 2.0.8 version ResourceUtils.getFile() method is having a bug while loading xmls when you deploy as WAR in weblogic. But no issues when you deploy as exploded. But ClasspathResource seems to be working fine.Ananthhttp://www.blogger.com/profile/01014064398352414331noreply@blogger.com6tag:blogger.com,1999:blog-7021795647105717639.post-63668008542067003492009-11-22T08:34:00.004-06:002009-12-10T17:26:27.701-06:00Weblogic portal content propagation using Ant tasksContent propagation is the process of moving portal artifacts from from one domain environment to other usually from staging to production. This moving basically involves the contents from database & ldap.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTTISOoXsiWi0_xyB1ebEVvKZqa67O3uU5pc4K_hc03Fjc7G2mZJFIhhDLqTft7pxY1ZoYJQ7v-ZKc1gYU3hb4_XXRr4XF8wSTejhHPOVsx2nP-yTNE_cXbfljRmqDgzyx_bjSjsLzW8Y/s1600-h/environments.gif" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTTISOoXsiWi0_xyB1ebEVvKZqa67O3uU5pc4K_hc03Fjc7G2mZJFIhhDLqTft7pxY1ZoYJQ7v-ZKc1gYU3hb4_XXRr4XF8wSTejhHPOVsx2nP-yTNE_cXbfljRmqDgzyx_bjSjsLzW8Y/s200/environments.gif" /></a><br />
</div><br />
<br />
<div style="text-align: left;"><br />
</div><br />
Weblogic offers three ways to do this:<br />
1. Using Weblogic workshop by creating propagation session.<br />
2. Customized Ant scripts<br />
3. Import/export utility.<br />
<br />
When you use weblogic workshop, it involves a lot of manual tasks. Those manual tasks are error prone. I thought ant scripts are more effective as you have a lot of control and it is automated process. I never tried the third option. This blog will cover how to do propagation using ant scripts.<br />
<br />
<b><i><u>Pre-requests:</u></i></b><br />
Both source & destination admin server should be running and should have same weblogic portal version. Ant environment variable needs to be set up.<br />
<br />
<b><i><u>How to set up Ant:</u></i></b><br />
1. Create environment variabale ANT_HOME in your local machine with value ${BEA_HOME}\modules\org.apache.ant_1.6.5. Eg: if you installed in C drive, value would be C:\bea\modules\org.apache.ant_1.6.5<br />
2. Create another variable called ANT_OPTS with value of -Xmx500M<br />
<br />
<b><i><u>Steps for propagation:</u></i></b><br />
1. Create a folder called propagation from you planned to run scripts<br />
<br />
2. Copy propagation.xml file from below into propagation folder.<br />
<br />
<span style="font-size: small;"><b><i><u>propagation.xml:</u></i></b></span><br />
<br />
<br />
<?xml version="1.0" ?><br />
<!-- ==================================================================== --><br />
<!-- Propagation Ant Script --><br />
<!-- Author : Ananth Kannan --><br />
<!-- Date : 05/30/2008 --><br />
<!-- Title: propagation.xml --><br />
<!-- --><br />
<!-- Usage Notes: --><br />
<!-- --><br />
<!-- The normal sequence of using this script is to invoke the targets in --><br />
<!-- the following order: --><br />
<!-- --><br />
<!-- ant pingSrc --><br />
<!-- ant pingDest --><br />
<!-- ant downloadSrc --><br />
<!-- ant validateSrc --><br />
<!-- ant downloadDest --><br />
<!-- ant validateDest --><br />
<!-- ant combine --><br />
<!-- ant commit --><br />
<!-- ant uploadCombined --><br />
<!-- --><br />
<!-- ======================================================================= --><br />
<br />
<project name="Portal Propagation Ant Tasks" basedir="." default="usage"><br />
<property environment="env"/><br />
<br />
<!-- Environment Settings --><br />
<br />
<!-- Runtime: this variable must point to your install directory. --><br />
<property name="deploy.dir" value="C:\bea\wlserver_10.0"/><br />
<br />
<!-- Runtime: this variable must indicate where the files will be read/written. --><br />
<property name="working.dir" value="C:\propagation"/><br />
<br />
<!-- Source: --><br />
<!-- Setup the variables that identify your source environment (staging, for example) --><br />
<!-- These variables are explained below, or consult the Propagation Ant Task documentation. --><br />
<property name="source.servlet.url" value="http://{src_admin_server}:7001/EAR_NamePropagation/inventorymanagement"/><br />
<property name="source.admin.username" value="weblogic"/><br />
<property name="source.admin.password" value="weblogic"/><br />
<property name="source.allow.http" value="true"/><br />
<br />
<!-- Destination: --><br />
<!-- Setup the variables that identify your destination environment (production, for example) --><br />
<!-- These variables are explained below, or consult the Propagation Ant Task documentation. --><br />
<property name="dest.servlet.url" value="http://{dest_admin_server}:7001/EAR_NamePropagation/inventorymanagement"/><br />
<property name="dest.admin.username" value="weblogic"/><br />
<property name="dest.admin.password" value="weblogic"/><br />
<property name="dest.allow.http" value="true"/><br />
<br />
<path id="onlineTask.classpath"><br />
<pathelement location="${deploy.dir}/platform/lib/p13n/p13n_common.jar"/><br />
<pathelement location="${deploy.dir}/portal/lib/propagation/propagation.jar"/><br />
<pathelement location="${deploy.dir}/portal/lib/propagation/propagation_ant.jar"/><br />
<pathelement location="${deploy.dir}/portal/lib/propagation/content_prop.jar"/><br />
<pathelement location="${deploy.dir}/portal/lib/propagation/netuix_prop.jar"/><br />
</path><br />
<br />
<path id="offlineTask.classpath"><br />
<pathelement location="${deploy.dir}/platform/lib/p13n/p13n_common.jar"/><br />
<pathelement location="${deploy.dir}/platform/lib/wlp/wsrp-common.jar"/><br />
<pathelement location="${deploy.dir}/portal/lib/propagation/propagation.jar"/><br />
<pathelement location="${deploy.dir}/portal/lib/propagation/propagation_ant.jar"/><br />
<pathelement location="${deploy.dir}/portal/lib/propagation/content_prop.jar"/><br />
<pathelement location="${deploy.dir}/portal/lib/propagation/netuix_prop.jar"/><br />
<pathelement location="${deploy.dir}/server/lib/api.jar"/><br />
<pathelement location="${deploy.dir}/../modules/com.bea.core.xml.beaxmlbeans_2.2.0.0.jar"/><br />
<pathelement location="${deploy.dir}/../modules/com.bea.core.weblogic.stax_1.0.1.0.jar"/><br />
<pathelement location="${deploy.dir}/../modules/com.bea.core.utils_1.0.1.0.jar"/> <br />
</path> <br />
<br />
<!-- <br />
SERVLET.URL:<br />
<br />
The online Propagation ant tasks require that the Propagation servlet be deployed in the <br />
application. By default, Portal applications will include the Propagation application library<br />
module which deploys the Propagation web application. Look for the following in the application's<br />
META-INF/weblogic-application.xml<br />
<br />
<library-ref><br />
<library-name>wlp-propagation-app-lib</library-name><br />
</library-ref><br />
<library-context-root-override><br />
<context-root>propagation</context-root><br />
<override-value>portalAppPropagation</override-value><br />
</library-context-root-override><br />
<br />
In this example, the Propagation application module has been included, and the Propagation <br />
web application which is normally at context root "propagation" has been overridden to listen<br />
to context path "portalAppPropagation". Therefore, the servletURL in this case would be:<br />
<br />
http://hostname:port/portalAppPropagation/inventorymanagement<br />
<br />
The Propagation servlet is deployed by default to map to "inventorymanagement".<br />
--><br />
<br />
<!-- ==================================================================== --><br />
<!-- Targets --><br />
<!-- ==================================================================== --><br />
<br />
<br />
<target name="usage" description="list of commands"><br />
<echo message="Usage Instructions:" /><br />
<echo message="Choose from this list of standard ant targets, or modify the build file to create your own." /><br />
<echo message="1. pingSrc and pingDest - pings the server and application to make sure it is alive" /><br />
<echo message="2. checkMutexSrc and checkMutexDest - determines if another user is working with the application" /><br />
<echo message="3. lockSrc and lockDest - prevents admin changes on the src and dest system." /><br />
<echo message="4. downloadSrc and downloadDest - creates src.zip and dest.zip files respectively" /><br />
<echo message="5. validateSrc and validateDest - makes sure the src.zip and dest.zip files are good" /><br />
<echo message="6. listScopes - lists the scopes in src.zip, for potential scoping of the differencing step" /><br />
<echo message="6a. listPolicies - lists the policies in src.zip, for potential polices for the differencing step" /><br />
<echo message="7. search - finds nodes with a specific string in their name, to help verify the wanted node was exported" /><br />
<echo message="8. diff - differences src.zip and dest.zip and writes the results to diff_cm.xml" /><br />
<echo message="9. combine - combines src.zip and dest.zip into a new inventory, combined.zip" /><br />
<echo message="10. validateCombined - makes sure combined.zip is a good file" /><br />
<echo message="11. extractCombined - extracts the working artifacts out of combined.zip for viewing" /><br />
<echo message="12. insertCombined - inserts updated working artifacts into combined.zip" /><br />
<echo message="13. checkManualElections - Test for the presence of manual elections. Used as condition to determine if continue to upload/commit or quit." /><br />
<echo message="14. uploadCombined - uploads combined.zip to the destination server" /><br />
<echo message="15. commit or commitOpt - commits uploaded inventory on dest, either pessimistically or optimistically" /><br />
<echo message="16. unlockSrc and unlockDest - allows admin changes on the src and dest system again." /><br />
<echo message="17. electionsAdd and electionsSubtract - allows for algebraic operations on two changemanifest files." /><br />
</target><br />
<br />
<br />
<!-- ONLINEPING TASK --><br />
<br />
<taskdef name="onlinePing" classname="com.bea.propagation.ant.taskdefs.OnlinePingTask"><br />
<classpath refid="onlineTask.classpath"/><br />
</taskdef><br />
<br />
<target name="pingSrc" description="ping the server"><br />
<echo message="****** Start: pingSrc ******" /><br />
<onlinePing<br />
servletURL="${source.servlet.url}" <br />
username="${source.admin.username}"<br />
password="${source.admin.password}"<br />
allowHttp="${source.allow.http}"<br />
/><br />
<echo message="****** Finish: pingSrc ******" /><br />
</target><br />
<br />
<target name="pingDest" description="ping the server"><br />
<echo message="****** Start: pingDest ******" /><br />
<onlinePing<br />
servletURL="${dest.servlet.url}" <br />
username="${dest.admin.username}"<br />
password="${dest.admin.password}"<br />
allowHttp="${dest.allow.http}"<br />
/><br />
<echo message="****** Finish: pingDest ******" /><br />
</target><br />
<br />
<!-- alternate method of pinging using Condition Ant construct --><br />
<target name="pingDestC1" description="ping the server"><br />
<echo message="****** Start: pingDestC1 ******" /><br />
<condition property="ping_success"><br />
<onlinePing<br />
servletURL="${dest.servlet.url}" <br />
username="${dest.admin.username}"<br />
password="${dest.admin.password}"<br />
allowHttp="${dest.allow.http}"<br />
/><br />
</condition><br />
<antcall target="ping_success" /><br />
<echo message="****** Finish: pingDestC1 ******" /><br />
</target><br />
<target name="ping_success" if="ping_success"><echo message="The server is available." /></target><br />
<br />
<br />
<!-- ONLINEMUTEX TASK --><br />
<br />
<taskdef name="onlineMutex" classname="com.bea.propagation.ant.taskdefs.OnlineCheckMutexTask"><br />
<classpath refid="onlineTask.classpath"/><br />
</taskdef><br />
<br />
<target name="checkMutexSrc" description="checks to see if the mutex is available"><br />
<echo message="****** Start: checkMutexSrc ******" /><br />
<onlineMutex<br />
servletURL="${source.servlet.url}" <br />
username="${source.admin.username}"<br />
password="${source.admin.password}"<br />
allowHttp="${source.allow.http}"<br />
failOnError="false"<br />
retryTimes="3"<br />
/><br />
<echo message="****** Finish: checkMutexSrc ******" /><br />
</target><br />
<br />
<target name="checkMutexDest" description="checks to see if the mutex is available"><br />
<echo message="****** Start: checkMutexDest ******" /><br />
<onlineMutex<br />
servletURL="${dest.servlet.url}" <br />
username="${dest.admin.username}"<br />
password="${dest.admin.password}"<br />
allowHttp="${dest.allow.http}"<br />
failOnError="false"<br />
retryTimes="10"<br />
/><br />
<echo message="****** Finish: checkMutexDest ******" /><br />
</target><br />
<br />
<!-- alternate method of checking the mutex using Condition Ant construct --><br />
<target name="checkMutexDestC1" description="checks to see if the mutex is available"><br />
<echo message="****** Start: checkMutexDestC1 ******" /><br />
<condition property="mutex_success"><br />
<onlineMutex<br />
servletURL="${dest.servlet.url}" <br />
username="${dest.admin.username}"<br />
password="${dest.admin.password}"<br />
allowHttp="${dest.allow.http}"<br />
failOnError="false"<br />
retryTimes="10"<br />
/><br />
</condition><br />
<antcall target="mutex_success" /><br />
<echo message="****** Finish: checkMutexDestC1 ******" /><br />
</target><br />
<target name="mutex_success" if="mutex_success"><echo message="The mutex is available." /></target><br />
<br />
<br />
<!-- onlineMaintenanceMode TASK --><br />
<br />
<taskdef name="onlineMaintenanceMode" classname="com.bea.propagation.ant.taskdefs.OnlineMaintenanceModeTask"><br />
<classpath refid="onlineTask.classpath"/><br />
</taskdef><br />
<br />
<target name="lockSrc" description="put the server into maintenance mode"><br />
<echo message="****** Start: lockSrc ******" /><br />
<onlineMaintenanceMode<br />
servletURL="${source.servlet.url}" <br />
username="${source.admin.username}"<br />
password="${source.admin.password}"<br />
allowHttp="${source.allow.http}"<br />
enable="true"<br />
/><br />
<echo message="****** Finish: lockSrc ******" /><br />
</target><br />
<br />
<target name="lockDest" description="put the server into maintenance mode"><br />
<echo message="****** Start: lockDest ******" /><br />
<onlineMaintenanceMode<br />
servletURL="${dest.servlet.url}" <br />
username="${dest.admin.username}"<br />
password="${dest.admin.password}"<br />
allowHttp="${dest.allow.http}"<br />
enable="true"<br />
/><br />
<echo message="****** Finish: lockDest ******" /><br />
</target><br />
<br />
<!-- alternate method of locking using Condition Ant construct --><br />
<target name="lockDestC1" description="put the server into maintenance mode"><br />
<condition property="lock_success"><br />
<onlineMaintenanceMode<br />
servletURL="${dest.servlet.url}" <br />
username="${dest.admin.username}"<br />
password="${dest.admin.password}"<br />
allowHttp="${dest.allow.http}"<br />
enable="true"<br />
/><br />
</condition><br />
<antcall target="lock_success" /><br />
</target><br />
<target name="lock_success" if="lock_success"><echo message="Maintenance mode has been toggled." /></target><br />
<br />
<br />
<!-- ONLINEDOWNLOAD TASK --><br />
<br />
<taskdef name="onlineDownload" classname="com.bea.propagation.ant.taskdefs.OnlineDownloadTask"><br />
<classpath refid="onlineTask.classpath"/><br />
</taskdef><br />
<br />
<target name="downloadSrc"><br />
<echo message="****** Start: downloadSrc ******" /><br />
<delete file="${working.dir}/src.zip" quiet="true" /><br />
<delete file="${working.dir}/downloadSrc.log" quiet="true" /><br />
<onlineDownload<br />
servletURL="${source.servlet.url}" <br />
username="${source.admin.username}"<br />
password="${source.admin.password}"<br />
allowHttp="${source.allow.http}"<br />
failOnError="true"<br />
outputInventoryFile="${working.dir}/src.zip"<br />
logFile="${working.dir}/downloadSrc.log"<br />
><br />
<modifier name="cm_exportPolicy" value="lastPublished" /><br />
<modifier name="allowMaintenanceModeDisabled" value="true"/><br />
<modifier name="allowSecurityOutOfSync" value="true"/> <br />
</onlineDownload><br />
<echo message="****** Finish: downloadSrc ******" /><br />
<echo message="****** Please check :: src.zip is downloaded into ******${working.dir}" /><br />
</target><br />
<br />
<target name="downloadSrcRemote"><br />
<echo message="****** Start: downloadSrcRemote ******" /><br />
<delete file="${working.dir}/src.zip" quiet="true" /><br />
<delete file="${working.dir}/downloadSrcRemote.log" quiet="true" /><br />
<onlineDownload<br />
servletURL="${source.servlet.url}" <br />
username="${source.admin.username}"<br />
password="${source.admin.password}"<br />
allowHttp="${source.allow.http}"<br />
failOnError="true"<br />
outputToServerFileSystem="true"<br />
outputInventoryFile="D:\TEMP\prop_test\src.zip"<br />
logFile="${working.dir}/downloadSrcRemote.log"<br />
><br />
<modifier name="allowMaintenanceModeDisabled" value="true"/><br />
</onlineDownload><br />
<echo message="****** Finish: downloadSrcRemote ******" /><br />
</target><br />
<br />
<target name="downloadDest"><br />
<echo message="****** Start: downloadDest ******" /><br />
<delete file="${working.dir}/dest.zip" quiet="true" /><br />
<delete file="${working.dir}/downloadDest.log" quiet="true" /><br />
<onlineDownload<br />
servletURL="${dest.servlet.url}" <br />
username="${dest.admin.username}"<br />
password="${dest.admin.password}"<br />
allowHttp="${dest.allow.http}"<br />
outputInventoryFile="${working.dir}/dest.zip"<br />
logFile="${working.dir}/downloadDest.log"<br />
><br />
<modifier name="allowMaintenanceModeDisabled" value="true"/><br />
<modifier name="allowSecurityOutOfSync" value="true"/> <br />
<br />
</onlineDownload><br />
<echo message="****** Finish: downloadDest ******" /><br />
</target><br />
<br />
<br />
<!-- OFFLINEVALIDATE TASK --><br />
<br />
<taskdef name="offlineValidate" classname="com.bea.propagation.ant.taskdefs.OfflineValidateTask"><br />
<classpath refid="offlineTask.classpath"/><br />
</taskdef><br />
<br />
<target name="validateSrc" description="valid inventory, with logging"><br />
<echo message="****** Start: validateSrc ******" /><br />
<delete file="${working.dir}/validateSrc_log.txt" quiet="true" /><br />
<delete file="${working.dir}/validateSrc_verboselog.txt" quiet="true" /><br />
<br />
<offlineValidate <br />
sourceFile="${working.dir}/src.zip" <br />
logFile="${working.dir}/validateSrc_log.txt"<br />
verboseLogFile="${working.dir}/validateSrc_verboselog.txt"<br />
/><br />
<echo message="****** Finish: validateSrc ******" /><br />
</target><br />
<br />
<target name="validateDest" description="validates to see if an inventory file is a valid inventory"><br />
<echo message="****** Start: validateDest ******" /><br />
<delete file="${working.dir}/validateDest_log.txt" quiet="true" /><br />
<delete file="${working.dir}/validateDest_verboselog.txt" quiet="true" /><br />
<br />
<offlineValidate <br />
sourceFile="${working.dir}/dest.zip" <br />
logFile="${working.dir}/validateDest_log.txt"<br />
verboseLogFile="${working.dir}/validateDest_verboselog.txt"<br />
/><br />
<echo message="****** Finish: validateDest ******" /><br />
</target><br />
<br />
<!-- alternate method of validating using Condition Ant construct --><br />
<target name="validateDestC1" description="validates to see if an inventory file is a valid inventory"><br />
<echo message="****** Start: validateC1 ******" /><br />
<condition property="validate_success"><br />
<offlineValidate <br />
sourceFile="${working.dir}/dest.zip" <br />
/><br />
</condition><br />
<br />
<antcall target="validate_success" /><br />
<br />
<echo message="****** Finish: validateC1 ******" /><br />
</target><br />
<target name="validate_success" if="validate_success"><echo message="The validation succeeded." /></target><br />
<br />
<br />
<!-- OFFLINELISTSCOPES TASK --><br />
<br />
<taskdef name="offlineListScopes" classname="com.bea.propagation.ant.taskdefs.OfflineListScopesTask"><br />
<classpath refid="offlineTask.classpath"/><br />
</taskdef><br />
<br />
<target name="listScopes" description="lists the scopes found in the source inventory"><br />
<echo message="****** Start: listScopes ******" /><br />
<delete file="${working.dir}/listScopes_scopes.properties" quiet="true" /><br />
<delete file="${working.dir}/listScopes_log.txt" quiet="true" /><br />
<delete file="${working.dir}/listScopes_verboselog.txt" quiet="true" /><br />
<mkdir dir="${working.dir}/scopes"/><br />
<br />
<offlineListScopes <br />
sourceFile="${working.dir}/src.zip" <br />
scopeFile="${working.dir}/scopes/listScopes_scopes.properties"<br />
logFile="${working.dir}/scopes/listScopes_log.txt"<br />
verboseLogFile="${working.dir}/scopes/listScopes_verboselog.txt"<br />
/><br />
<echo message="****** Finish: listScopes ****** under ${working.dir}/scopes" /><br />
</target><br />
<br />
<!-- OFFLINELISTPOLICIES TASK --><br />
<br />
<taskdef name="offlineListPolicies" classname="com.bea.propagation.ant.taskdefs.OfflineListPoliciesTask"><br />
<classpath refid="offlineTask.classpath"/><br />
</taskdef><br />
<br />
<target name="listPolicies" description="lists the scopes found in the source inventory"><br />
<echo message="****** Start: listPolicies ******" /><br />
<delete file="${working.dir}/listPolicies_policies.properties" quiet="true" /><br />
<delete file="${working.dir}/listPolicies_log.txt" quiet="true" /><br />
<delete file="${working.dir}/listPolicies_verboselog.txt" quiet="true" /><br />
<mkdir dir="${working.dir}/policies"/><br />
<br />
<offlineListPolicies <br />
sourceFile="${working.dir}/src.zip" <br />
policyFile="${working.dir}/policies/listPolicies_policies.properties"<br />
globalAddFlag="true"<br />
globalUpdateFlag="false"<br />
globalDeleteFlag="true"<br />
logFile="${working.dir}/policies/listPolicies_log.txt"<br />
verboseLogFile="${working.dir}/policies/listPolicies_verboselog.txt"<br />
/><br />
<echo message="****** Finish: listPolicies ****** under ${working.dir}/policies" /><br />
</target><br />
<br />
<!-- OFFLINESEARCH TASK --><br />
<br />
<taskdef name="offlineSearch" classname="com.bea.propagation.ant.taskdefs.OfflineSearchTask"><br />
<classpath refid="offlineTask.classpath"/><br />
</taskdef><br />
<br />
<target name="search" description="finds the nodes that contain the search string in the name"><br />
<echo message="****** Start: search ******" /><br />
<delete file="${working.dir}/search.txt" quiet="true" /><br />
<delete file="${working.dir}/search_log.txt" quiet="true" /><br />
<delete file="${working.dir}/search_verboselog.txt" quiet="true" /><br />
<br />
<offlineSearch <br />
searchString="Global" <br />
sourceFile="${working.dir}/src.zip" <br />
listFile="${working.dir}/search.txt"<br />
logFile="${working.dir}/search_log.txt"<br />
verboseLogFile="${working.dir}/search_verboselog.txt"<br />
/><br />
<echo message="****** Finish: search ******" /><br />
</target><br />
<br />
<!-- alternate method of searching using Condition Ant construct --><br />
<target name="searchC1" description="finds the nodes that contain the search string in the name"><br />
<echo message="****** Start: searchC1 ******" /><br />
<condition property="search_success"><br />
<offlineSearch <br />
searchString="Global" <br />
sourceFile="${working.dir}/src.zip" <br />
/><br />
</condition><br />
<br />
<antcall target="search_success" /><br />
<br />
<echo message="****** Finish: searchC1 ******" /><br />
</target><br />
<target name="search_success" if="search_success"><echo message="The search succeeded." /></target><br />
<br />
<br />
<!-- OFFLINEDIFF TASK --><br />
<br />
<taskdef name="offlineDiff" classname="com.bea.propagation.ant.taskdefs.OfflineDiffTask"><br />
<classpath refid="offlineTask.classpath"/><br />
</taskdef><br />
<br />
<target name="diff" description="compare two inventories with logging"><br />
<echo message="****** Start: diff ******" /><br />
<delete file="${working.dir}/diff_cm.xml" quiet="true" /><br />
<delete file="${working.dir}/diff_log.txt" quiet="true" /><br />
<delete file="${working.dir}/diff_verboselog.txt" quiet="true" /><br />
<br />
<offlineDiff <br />
sourceFile="${working.dir}/src.zip" <br />
destFile="${working.dir}/dest.zip"<br />
changeManifestFile="${working.dir}/diff_cm.xml"<br />
logFile="${working.dir}/diff_log.txt"<br />
verboseLogFile="${working.dir}/diff_verboselog.txt"<br />
/><br />
<echo message="****** Finish: diff ******" /><br />
</target><br />
<br />
<!-- alternate method of diffing using Condition Ant construct --><br />
<target name="diffC1" description="compare two inventories"><br />
<echo message="****** Start: diffC1 ******" /><br />
<delete file="${working.dir}/diffC1_cm.xml" quiet="true" /><br />
<condition property="diff_success"><br />
<offlineDiff <br />
sourceFile="${working.dir}/src.zip" <br />
destFile="${working.dir}/dest.zip"<br />
changeManifestFile="${working.dir}/diffC1_cm.xml"<br />
/><br />
</condition><br />
<antcall target="diff_success" /><br />
<br />
<echo message="****** Finish: diffC1 ******" /><br />
</target><br />
<target name="diff_success" if="diff_success"><echo message="The two inventories are different." /></target><br />
<br />
<br />
<!-- OFFLINECOMBINE TASK --><br />
<br />
<taskdef name="offlineCombine" classname="com.bea.propagation.ant.taskdefs.OfflineCombineTask"><br />
<classpath refid="offlineTask.classpath"/><br />
</taskdef><br />
<br />
<target name="combine" description="Combine two inventories with logging"><br />
<echo message="****** Start: combine ******" /><br />
<delete file="${working.dir}/combined.zip" quiet="true" /><br />
<delete file="${working.dir}/combine_cm.xml" quiet="true" /><br />
<delete file="${working.dir}/combine_log.txt" quiet="true" /><br />
<delete file="${working.dir}/combine_verboselog.txt" quiet="true" /><br />
<br />
<offlineCombine <br />
sourceFile="${working.dir}/src.zip" <br />
destFile="${working.dir}/dest.zip"<br />
combinedInventoryFile="${working.dir}/combined.zip"<br />
changeManifestFile="${working.dir}/combine_cm.xml"<br />
logFile="${working.dir}/combine_log.txt"<br />
verboseLogFile="${working.dir}/combine_verboselog.txt"<br />
/><br />
<echo message="****** Finish: combine ******" /><br />
</target><br />
<br />
<target name="combineWithPolicy" description="Combine two inventories using policy file"><br />
<echo message="****** Start: combine ******" /><br />
<delete file="${working.dir}/combined.zip" quiet="true" /><br />
<delete file="${working.dir}/combine_cm.xml" quiet="true" /><br />
<delete file="${working.dir}/combine_log.txt" quiet="true" /><br />
<delete file="${working.dir}/combine_verboselog.txt" quiet="true" /><br />
<br />
<offlineCombine <br />
sourceFile="${working.dir}/src.zip" <br />
destFile="${working.dir}/dest.zip"<br />
combinedInventoryFile="${working.dir}/combined.zip"<br />
policiesFile = "${working.dir}/policy.properties"<br />
changeManifestFile="${working.dir}/combine_cm.xml"<br />
logFile="${working.dir}/combine_log.txt"<br />
verboseLogFile="${working.dir}/combine_verboselog.txt"<br />
/><br />
<echo message="****** Finish: combine ******" /><br />
</target><br />
<br />
<target name="combineWithScope" description="Combine two inventories using scope file"><br />
<echo message="****** Start: combine ******" /><br />
<delete file="${working.dir}/combined.zip" quiet="true" /><br />
<delete file="${working.dir}/combine_cm.xml" quiet="true" /><br />
<delete file="${working.dir}/combine_log.txt" quiet="true" /><br />
<delete file="${working.dir}/combine_verboselog.txt" quiet="true" /><br />
<br />
<offlineCombine <br />
sourceFile="${working.dir}/src.zip" <br />
destFile="${working.dir}/dest.zip"<br />
combinedInventoryFile="${working.dir}/combined.zip"<br />
scopeFile = "${working.dir}/singlescope.properties"<br />
changeManifestFile="${working.dir}/combine_cm.xml"<br />
logFile="${working.dir}/combine_log.txt"<br />
verboseLogFile="${working.dir}/combine_verboselog.txt"<br />
/><br />
<echo message="****** Finish: combine ******" /><br />
</target><br />
<br />
<!-- OFFLINEVALIDATE TASK --><br />
<br />
<target name="validateCombined" description="valid inventory, with no logging"><br />
<echo message="****** Start: validateCombined ******" /><br />
<delete file="${working.dir}/validateCombined_log.txt" quiet="true" /><br />
<delete file="${working.dir}/validateCombined_verboselog.txt" quiet="true" /><br />
<br />
<offlineValidate <br />
sourceFile="${working.dir}/combined.zip" <br />
logFile="${working.dir}/validateCombined_log.txt"<br />
verboseLogFile="${working.dir}/validateCombined_verboselog.txt"<br />
/><br />
<echo message="****** Finish: validateCombined ******" /><br />
</target><br />
<br />
<br />
<!-- OFFLINEEXTRACT TASK --><br />
<br />
<taskdef name="offlineExtract" classname="com.bea.propagation.ant.taskdefs.OfflineExtractTask"><br />
<classpath refid="offlineTask.classpath"/><br />
</taskdef><br />
<br />
<target name="extractCombined" description="gather resources from the combined inventory"><br />
<echo message="****** Start: extractCombined ******" /><br />
<delete file="${working.dir}/extract/extractCombined_export.properties" quiet="true" /><br />
<delete file="${working.dir}/extract/extractCombined_scope.properties" quiet="true" /><br />
<delete file="${working.dir}/extract/extractCombined_policy.properties" quiet="true" /><br />
<delete file="${working.dir}/extract/extractCombined_change.xml" quiet="true" /><br />
<delete file="${working.dir}/extract/extractCombined_log.txt" quiet="true" /><br />
<delete file="${working.dir}/extract/extractCombined_verboselog.txt" quiet="true" /><br />
<mkdir dir="${working.dir}/extract"/><br />
<br />
<offlineExtract <br />
sourceFile="${working.dir}/combined.zip" <br />
exportFile="${working.dir}/extract/extractCombined_export.properties"<br />
policyFile="${working.dir}/extract/extractCombined_policy.properties"<br />
changeManifestFile="${working.dir}/extract/extractCombined_change.xml"<br />
logFile="${working.dir}/extract/extractCombined_log.txt"<br />
verboseLogFile="${working.dir}/extract/extractCombined_verboselog.txt"<br />
/><br />
<echo message="****** Finish: extractCombined ******" /><br />
</target><br />
<br />
<br />
<!-- OFFLINEALGEBRA TASK --><br />
<br />
<taskdef name="offlineAlgebra" classname="com.bea.propagation.ant.taskdefs.OfflineElectionAlgebraTask"><br />
<classpath refid="offlineTask.classpath"/><br />
</taskdef><br />
<br />
<target name="electionsAdd" description="add the two election lists"><br />
<echo message="****** Start: electionsAdd ******" /><br />
<delete file="${working.dir}/addedElections.xml" quiet="true" /><br />
<br />
<offlineAlgebra <br />
electionList1File="${working.dir}/elections1.xml" <br />
electionList2File="${working.dir}/elections2.xml" <br />
operation="add"<br />
outputFile="${working.dir}/addedElections.xml"<br />
/><br />
<echo message="****** Finish: electionsAdd ******" /><br />
</target><br />
<br />
<target name="electionsSubtract" description="subtract the two election lists"><br />
<echo message="****** Start: electionsSubtract ******" /><br />
<delete file="${working.dir}/subtractedElections.xml" quiet="true" /><br />
<br />
<offlineAlgebra <br />
electionList1File="${working.dir}/elections1.xml" <br />
electionList2File="${working.dir}/elections2.xml" <br />
operation="subtract"<br />
outputFile="${working.dir}/subtractedElections.xml"<br />
/><br />
<echo message="****** Finish: electionsSubtract ******" /><br />
</target><br />
<br />
<br />
<!-- OFFLINEINSERT TASK --><br />
<br />
<taskdef name="offlineInsert" classname="com.bea.propagation.ant.taskdefs.OfflineInsertTask"><br />
<classpath refid="offlineTask.classpath"/><br />
</taskdef><br />
<br />
<target name="insertCombined" description="insert resources into the combined inventory"><br />
<echo message="****** Start: insertCombined ******" /><br />
<delete file="${working.dir}/newCombined.zip" quiet="true" /><br />
<br />
<offlineInsert <br />
sourceFile="${working.dir}/combined.zip" <br />
policyFile="${working.dir}/extractCombined_policy.properties"<br />
changeManifestFile="${working.dir}/extractCombined_change.xml"<br />
outputFile="${working.dir}/newCombined.zip"<br />
/><br />
<echo message="****** Finish: insertCombined ******" /><br />
</target><br />
<br />
<!-- OFFLINE Check for manual elections --><br />
<br />
<taskdef name="offlineCheckForManualElections" classname="com.bea.propagation.ant.taskdefs.OfflineCheckManualElectionsTask"><br />
<classpath refid="offlineTask.classpath"/><br />
</taskdef><br />
<br />
<target name="checkManualElections" description="check if there is manual elections in combined inventory or change manifest XML"><br />
<echo message="****** Start: checkManualElections ******" /><br />
<offlineCheckForManualElections <br />
changeManifestFile="${working.dir}/combine_cm.xml"/><br />
<echo message="****** Finish: checkManualElections ******" /><br />
</target><br />
<br />
<target name="checkManualElectionsC1" description="check if there is manual elections in combined inventory or change manifest XML"><br />
<echo message="****** Start: checkManualElectionsC1 ******" /><br />
<condition property="hasManualElections"><br />
<offlineCheckForManualElections <br />
sourceFile="${working.dir}/combined.zip"/><br />
</condition><br />
<antcall target="continuePropagation" /><br />
<echo message="****** Finish: checkManualElectionsC1 ******" /><br />
</target><br />
<target name="continuePropagation" unless="hasManualElections"><br />
<echo message="We could continue propagation" /><br />
</target><br />
<br />
<!-- ONLINEUPLOAD TASK --><br />
<br />
<taskdef name="onlineUpload" classname="com.bea.propagation.ant.taskdefs.OnlineUploadTask"><br />
<classpath refid="onlineTask.classpath"/><br />
</taskdef><br />
<br />
<target name="uploadCombined"><br />
<echo message="****** Start: upload ******" /><br />
<onlineUpload<br />
servletURL="${dest.servlet.url}" <br />
username="${dest.admin.username}"<br />
password="${dest.admin.password}"<br />
allowHttp="${dest.allow.http}"<br />
sourceFile="${working.dir}/combined.zip"<br />
/><br />
<echo message="****** Finish: upload ******" /><br />
</target><br />
<br />
<target name="uploadRemote"><br />
<echo message="****** Start: uploadRemote ******" /><br />
<onlineUpload<br />
servletURL="${dest.servlet.url}" <br />
username="${dest.admin.username}"<br />
password="${dest.admin.password}"<br />
allowHttp="${dest.allow.http}"<br />
readFromServerFileSystem="true"<br />
sourceFile="D:\TEMP\prop_test\src.zip"<br />
/><br />
<echo message="****** Finish: uploadRemote ******" /><br />
</target><br />
<br />
<target name="uploadSrc"><br />
<echo message="****** Start: uploadSrc ******" /><br />
<onlineUpload<br />
servletURL="${dest.servlet.url}" <br />
username="${dest.admin.username}"<br />
password="${dest.admin.password}"<br />
allowHttp="${dest.allow.http}"<br />
sourceFile="${working.dir}/src.zip"<br />
/><br />
<echo message="****** Finish: uploadSrc ******" /><br />
</target><br />
<br />
<target name="uploadDest"><br />
<echo message="****** Start: uploadDest ******" /><br />
<onlineUpload<br />
servletURL="${dest.servlet.url}" <br />
username="${dest.admin.username}"<br />
password="${dest.admin.password}"<br />
allowHttp="${dest.allow.http}"<br />
sourceFile="${working.dir}/dest.zip"<br />
/><br />
<echo message="****** Finish: uploadDest ******" /><br />
</target><br />
<br />
<!-- ONLINECOMMIT TASK --><br />
<br />
<taskdef name="onlineCommit" classname="com.bea.propagation.ant.taskdefs.OnlineCommitTask"><br />
<classpath refid="onlineTask.classpath"/><br />
</taskdef><br />
<br />
<target name="commit"><br />
<echo message="****** Start: commit ******" /><br />
<delete file="${working.dir}/commit.log" quiet="true" /><br />
<onlineCommit<br />
servletURL="${dest.servlet.url}" <br />
username="${dest.admin.username}"<br />
password="${dest.admin.password}"<br />
allowHttp="${dest.allow.http}"<br />
logFile="${working.dir}/commit.log"<br />
><br />
<modifier name="differenceStrategy" value="pessimistic" /><br />
<modifier name="cm_checkinComment" value="My sample checkin comment." /><br />
<modifier name="allowMaintenanceModeDisabled" value="true"/><br />
<modifier name="allowSecurityOutOfSync" value="true"/> <br />
</onlineCommit><br />
<echo message="****** Finish: commit ******" /><br />
</target><br />
<br />
<target name="commitOpt"><br />
<echo message="****** Start: commitOpt ******" /><br />
<delete file="${working.dir}/commitOpt.log" quiet="true" /><br />
<onlineCommit<br />
servletURL="${dest.servlet.url}" <br />
username="${dest.admin.username}"<br />
password="${dest.admin.password}"<br />
allowHttp="${dest.allow.http}"<br />
logFile="${working.dir}/commitOpt.log"<br />
><br />
<modifier name="differenceStrategy" value="optimistic" /><br />
<modifier name="cm_checkinComment" value="My sample checkin comment." /><br />
<modifier name="allowMaintenanceModeDisabled" value="true"/><br />
</onlineCommit><br />
<echo message="****** Finish: commitOpt ******" /><br />
</target><br />
<br />
<!-- set scope file in commit task --><br />
<target name="commitWithScope"><br />
<echo message="****** Start: commitScope ******" /><br />
<delete file="${working.dir}/commitScope.log" quiet="true" /><br />
<onlineCommit<br />
servletURL="${dest.servlet.url}" <br />
username="${dest.admin.username}"<br />
password="${dest.admin.password}"<br />
allowHttp="${dest.allow.http}"<br />
scopeFile="${working.dir}/singlescope.properties"<br />
logFile="${working.dir}/commitScope.log"<br />
><br />
<modifier name="differenceStrategy" value="pessimistic" /><br />
<modifier name="cm_checkinComment" value="My sample checkin comment." /><br />
<modifier name="allowMaintenanceModeDisabled" value="true"/><br />
</onlineCommit><br />
<echo message="****** Finish: commitOpt ******" /><br />
</target><br />
<br />
<!-- ONLINEMAINTENANCEMODE TASK --><br />
<br />
<target name="unlockSrc" description="disable maintenance mode on the src server"><br />
<echo message="****** Start: unlockSrc ******" /><br />
<onlineMaintenanceMode<br />
servletURL="${source.servlet.url}" <br />
username="${source.admin.username}"<br />
password="${source.admin.password}"<br />
allowHttp="${source.allow.http}"<br />
enable="false"<br />
/><br />
<echo message="****** Finish: unlockSrc ******" /><br />
</target><br />
<br />
<target name="unlockDest" description="disable maintenance mode on the dest server"><br />
<echo message="****** Start: unlockDest ******" /><br />
<onlineMaintenanceMode<br />
servletURL="${dest.servlet.url}" <br />
username="${dest.admin.username}"<br />
password="${dest.admin.password}"<br />
allowHttp="${dest.allow.http}"<br />
enable="false"<br />
/><br />
<echo message="****** Finish: unlockDest ******" /><br />
</target><br />
<br />
<br />
<target name="startProp" <br />
description="Starts the propagation operation.." <br />
depends="pingSrc, pingDest, downloadSrc, validateSrc, downloadDest, validateDest, combine, uploadCombined, commit"><br />
<br />
<echo message="****** Start: startProp ******" /><br />
<echo message="****** Start: startProp ******" /><br />
<br />
<echo message="****** Finish: startProp ******" /><br />
<br />
</target><br />
<br />
</project><br />
<br />
3. Create a folder called scopes under propagation.<br />
<br />
4. In propagation.xml file. Make sure deploy.dir value is pointing to right BEA installation path on your local drive. For eg, C:\bea\wlserver_10.0"<br />
<br />
5. Working.dir should point to propagation dir.<br />
<br />
6. source.servlet.url is your source server. Where you copy the data from. For e.g, if you copy from INT box, then it should be http://source_server:7001/portlAppEARPropagation/inventorymanagement<br />
<br />
7. Once you have all set up, run the following command from your propagation folder:<br />
ant –f propagation.xml pingSrc<br />
If the above command fails, source server is not running. re-start it.<br />
<br />
8. Same thing goes with destination as well. try this command: <br />
ant –f propagation.xml pingDest<br />
<br />
9. Type to generate scopes file by generating sourcezip first: ant -f propagation.xml downloadSrc <br />
then run this command: ant -f propagation.xml listScopes<br />
This should create a file listScopes.properties under propagation/scopes folder. To know more about scopes, please visit BEA documentation.<br />
<br />
10. Once source and destination server running run the propagation command:<br />
ant –f propagation.xml startProp<br />
It should propagate the data from source to destination.<br />
<br />
Important links:<br />
<a href="http://download.oracle.com/docs/cd/E13155_01/wlp/docs103/prodOps/scripts.html">Propagation Ant Task Reference</a><br />
<a href="http://download.oracle.com/docs/cd/E13155_01/wlp/docs103/prodOps/bestPractices.html">Propagation Tips and Best Practices</a>Ananthhttp://www.blogger.com/profile/01014064398352414331noreply@blogger.com4tag:blogger.com,1999:blog-7021795647105717639.post-1800672676737476542009-11-09T09:15:00.003-06:002009-11-12T15:38:53.731-06:00What is the difference between streaming portal(desktop) and file based portal?I have come across this question many times while working at client site from co-workers, clients and infrastructure folks - what is the difference between streaming portal and file based portal? Well, during portal development process we create .portal file in workshop. This is basically just a template in which more books, pages, portlets can be added. The .portal file is XML based and rendered as "single file mode". This file is mainly for development purpose and should not be used in the production though you can access it in production as well. You can not apply any entitlements or user customization as no data base involved in .portal template.<br />
<br />
The streaming portal(desktop) is created out of .portal template using weblogic portal admin tool. A single portal template can have any number of desktops. A desktop contains all the portlets, content, shells, layouts, and look and feel elements necessary to create individual user views of a portal. For eg, assume I have a requirement from three different clients to show some functionality of a portal. I don't want to create a three .portal template though I could, but I would like to have three different desktops with similar functionality but with different "look-and-feel". So I go to weblogic portal admin tool create a desktop called sample1 for client 1. sample 2 for client 2 with different look-and-feel. sample 3 for client 3 again with different look & f. Oh yes! Look and feel can be applied at run time ie while creating desktop itself. Also I can add/remove portlets if I want to for any desktop. I can also add/remove any book/page at run time as well. So what I have done is created 3 different desktops but with a different look-and-feel per client.<br />
<br />
When I create a desktop from a <code class="cCode">.portal</code> template, the desktop is decoupled from the template, and modifications to the <code class="cCode">.portal</code> file do not affect the desktop, and vice versa. For example, when you change a desktop's look and feel in the WebLogic Portal Administration Console, the change is made only to the desktop, not to the original <code class="cCode">.portal</code> file. When you view a desktop with in a browser, the desktop is rendered in "streaming mode" from data base.<br />
<br />
<i><b><u>P.S: </u></b></i>If your portal application does not need any entitlements or personalizations and it is simple, static portal then file based portal is the best choice. File based portals give better peformance and propagation to other environments is also easy.Ananthhttp://www.blogger.com/profile/01014064398352414331noreply@blogger.com22tag:blogger.com,1999:blog-7021795647105717639.post-53176732986613024232009-10-23T12:02:00.012-05:002009-11-09T07:55:59.605-06:00Weblogic as windows service errorThere is a bug in BEA documentation for creating weblogic server instance as window service. The doumentation URL is <a href="http://download-llnw.oracle.com/docs/cd/E11035_01/wls100/server_start/winservice.html">here </a><br />
<br />
The example script (for creating weblogic as window service) in the documentation shows we need to have ADMIN_URL as below:<br />
<br />
set ADMIN_URL=http://adminserver:7501<br />
<br />
Actually we do NOT need to mention this url in the manual script. I had this URL mentioned and end up getting the error below.<br />
<br />
java.rmi.NoSuchObjectException: The object identified by: '31' could not be found. Either it was has not been exported or it has been collected by the distributed garbage collector.<br />
<br />
I removed this entry ran the script again. It worked.<br />
<br />
To know more info on creating or installing weblogic as a window service, please <a href="http://ananthkannan.blogspot.com/2009/10/how-to-create-weblogic-server-as.html">see this blog entry </a>Ananthhttp://www.blogger.com/profile/01014064398352414331noreply@blogger.com1tag:blogger.com,1999:blog-7021795647105717639.post-68331291390202446792009-10-21T15:54:00.007-05:002010-02-09T21:04:44.645-06:00How to implement breadcrumb in Weblogic PortalBreadcrumbs is one of the cool features of weblogic portal framework for UI navigation. We have successfully implemented this functionality in one our portal applications. That was based on weblogic portal 10.2 version. I think it should work with weblogic portal 10.3 as well. Let me know if you are running into any issues with the code. This jsp should be included as part of page.jsp.<br />
<br />
<b><u>Breadcrumbs.jsp:</u></b><br />
<%@ page language="java" contentType="text/html;charset=UTF-8"%><br />
<%@ page import="com.bea.netuix.servlets.controls.window.WindowPresentationContext,<br />
com.bea.netuix.servlets.controls.window.TitlebarPresentationContext,<br />
java.util.ArrayList,<br />
java.util.Iterator,<br />
com.bea.portlet.PageURL,<br />
com.bea.netuix.servlets.controls.page.BookPresentationContext,<br />
com.bea.netuix.servlets.controls.page.PagePresentationContext,<br />
com.bea.netuix.servlets.controls.window.WindowCapabilities"<br />
%><br />
<%@ page session="false"%><br />
<%@ taglib uri="http://www.bea.com/servers/portal/tags/netuix/render" prefix="render" %><br />
<br />
<%--<br />
This is the JSP for the showing breadcrumbs in XYZ Eagle portal.<br />
It is part of the skeleton file page.jsp.<br />
<br />
Implementation based on WebLogic Portal 10.2.<br />
<br />
Author :: Ananth Kannan<br />
--%><br />
<br />
<%<br />
ArrayList breadcrumbTitles = new ArrayList(); <br />
ArrayList breadcrumbURLs = new ArrayList(); <br />
boolean isHidden = false;<br />
<br />
BookPresentationContext book = BookPresentationContext.getBookPresentationContext(request);<br />
PagePresentationContext pageCtx = PagePresentationContext.getPagePresentationContext(request);<br />
<br />
if (!(book.getDefaultPage().equals(pageCtx.getDefinitionLabel()))) <br />
{ <br />
breadcrumbTitles.add(book.getTitle()); <br />
breadcrumbURLs.add(PageURL.createPageURL(request,response,book.getDefaultPage()).toString()); <br />
} <br />
<br />
PagePresentationContext parentPage = book.getParentPagePresentationContext(); <br />
while (parentPage != null) <br />
{ <br />
breadcrumbTitles.add(parentPage.getTitle()); <br />
<br />
if (parentPage instanceof BookPresentationContext) <br />
{ <br />
BookPresentationContext parentBook = (BookPresentationContext)parentPage; <br />
breadcrumbURLs.add(PageURL.createPageURL(request, response, parentBook.getDefaultPage()).toString()); <br />
}<br />
else <br />
{ <br />
breadcrumbURLs.add(PageURL.createPageURL(request, response, parentPage.getDefinitionLabel()).toString()); <br />
} <br />
<br />
parentPage = parentPage.getParentPagePresentationContext(); <br />
}<br />
%><br />
<br />
<br />
<% <br />
//DO NOT SHOW BREADCRUMBS IN MAIN HOME PAGE and also in hidden page<br />
if (pageCtx.isHidden()) <br />
{ <br />
} <br />
else <br />
{ <br />
%> <br />
<ul class="breadcrumbs"><br />
<%<br />
for (int i = breadcrumbTitles.size() - 1; i >= 0; i--) <br />
{ <br />
if (((String)breadcrumbTitles.get(i)).equalsIgnoreCase("My Main Book")) { <br />
breadcrumbTitles.set(i, "My Home"); <br />
}<br />
<br />
%> <br />
<li class="first"><a href="<%=breadcrumbURLs.get(i) %>" ><%=breadcrumbTitles.get(i)%></a></li> <img src="<render:getSkinPath imageName="/arrow_right.gif" />" />&nbsp; <%<br />
} <br />
%> <br />
<% <br />
} <br />
%> <br />
</ul>Ananthhttp://www.blogger.com/profile/01014064398352414331noreply@blogger.com1tag:blogger.com,1999:blog-7021795647105717639.post-9041651801461193452009-10-21T07:18:00.007-05:002009-10-29T14:48:17.162-05:00How to create weblogic domain template using weblogic template builder?Domain templates are used to create(or extend weblogic server domains) with pre-configured resources such as JDBC, security realms, external libraries, log4j components. So when you create new domain you do not need to go to server console and create resources such as data source, etc. While creating domain by using template you will have those resources configured already for you.<br />
<br />
Lets say, you have a team of 10 people and you like everybody to have same configuration, then create a template share with the team. Even it is very much useful if you have new member in the team.<br />
<br />
Domain templates can be built in many ways. This blog covers how to built using weblogic domain template builder.<br />
<br />
Lets get started.<br />
<br />
Step 1:<br />
<br />
Go to Start Menu->All programs->weblogic10gR3->Tools->Domain Template Builder<br />
or<br />
<br />
go to c:\bea\wlserver_10.3\common\bin in command prompt. and type config_builder.cmd<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEib-RSzvnbQ9P5u1dTk5XXaErEXhz5BU1ZRst133FvVzq57Fn33f9_49T2VXqSvLv0VTxgLdkNW2dyIV1OoxC6y91zKIJYKmeJYuk5emREnUq8Lhv7X42TwU2N9i2yy3uPMPnS3pWwcTAo/s1600-h/TemplateBuilder.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEib-RSzvnbQ9P5u1dTk5XXaErEXhz5BU1ZRst133FvVzq57Fn33f9_49T2VXqSvLv0VTxgLdkNW2dyIV1OoxC6y91zKIJYKmeJYuk5emREnUq8Lhv7X42TwU2N9i2yy3uPMPnS3pWwcTAo/s200/TemplateBuilder.jpg" /></a><br />
</div><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
Step 2:<br />
<br />
Select create a domain template. If you are creating template for the first time.<br />
Select create extension template if you are extending a existing template.<br />
<br />
We will go with create domain template.<br />
<br />
Step 3: Select a Template tab. Click on Basic Weblogic Server domain option. Click next<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfjPJrCFJUQFVM3zSRi7cM-rcVslQW8Zp-dRmFCGxpxVHMxxCeTFZ_jxdKbr-TQ9Bc84q5-pCK6VyjGTPrLTAPBRiRvpcPGeSZYH7HyQAU4xhtUxvEAwzYnfoqg4bkjDmgErMg7z8Sfp8/s1600-h/DT1.bmp" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfjPJrCFJUQFVM3zSRi7cM-rcVslQW8Zp-dRmFCGxpxVHMxxCeTFZ_jxdKbr-TQ9Bc84q5-pCK6VyjGTPrLTAPBRiRvpcPGeSZYH7HyQAU4xhtUxvEAwzYnfoqg4bkjDmgErMg7z8Sfp8/s200/DT1.bmp" /></a><br />
</div><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
Step 4: Enter the name of template and other info. Click next.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8daKT3p1Qu-Vn992U1upD9YEK2f4TtLIIRobHBS-GGOqLvrhaouiU3nQTtHoKSmlJ_jGC1JXeaLJAinmCCKObMW6Pw3uvHDY5CjU7I2LPkHsSZmtvcavg93zlL5HMFZXsmAkbcdKVYDk/s1600-h/DT4.bmp" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8daKT3p1Qu-Vn992U1upD9YEK2f4TtLIIRobHBS-GGOqLvrhaouiU3nQTtHoKSmlJ_jGC1JXeaLJAinmCCKObMW6Pw3uvHDY5CjU7I2LPkHsSZmtvcavg93zlL5HMFZXsmAkbcdKVYDk/s200/DT4.bmp" /></a><br />
</div><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
Step 5: Using Add Button, Select libraries you want to add under lib folder. copy jdbc data sources you would like to have under config/jdbc folder. If you want to have log4j configuration, copy log4j.xml under domain_root folder.<br />
<br />
Click next<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjL_aKkROUpMt6sp0mWaERxGDzLTgxCDmfX98l91LMCAbBXrWTIMrPCQ_18SukyWv-u9J5FQwMOwUEQ-Xu0F14Gk_tsx2QQO5VZMWujmupjAwlR-Bu8eId8p0mo6Cizs78Wap6bOhBBinc/s1600-h/DT5.bmp" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjL_aKkROUpMt6sp0mWaERxGDzLTgxCDmfX98l91LMCAbBXrWTIMrPCQ_18SukyWv-u9J5FQwMOwUEQ-Xu0F14Gk_tsx2QQO5VZMWujmupjAwlR-Bu8eId8p0mo6Cizs78Wap6bOhBBinc/s200/DT5.bmp" /></a><br />
</div><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
Step 6: Select data base for the domain and click next.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEioTYtgv9pYM3TMpr7yfh0BTUrLJmpTobPQxrIDXyBiNHZDz5HGpwV1DnfQEhtTLk74nMaaCfdZilZhDpJFmsUk0qhJLQdeARvtUXmWevvAuQq1u6KTC1NJiECX4cnpmk4IY8kaz2rC7kI/s1600-h/DB.bmp" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEioTYtgv9pYM3TMpr7yfh0BTUrLJmpTobPQxrIDXyBiNHZDz5HGpwV1DnfQEhtTLk74nMaaCfdZilZhDpJFmsUk0qhJLQdeARvtUXmWevvAuQq1u6KTC1NJiECX4cnpmk4IY8kaz2rC7kI/s200/DB.bmp" /></a><br />
</div><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
Step 7: Enter Admin Server Name and port numbers. Click next.<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9fsJzke-sOCkD9w4xZGg12cSzO8vdF-Tg-JFLoOgbJ-myZ5UogH54AJefP3EoG2V5T5kjEv5-v-2cPOAc6bNL4zkp6VPfShbM2iXtLZ1FnF0WCt9JhnQeiUb5HTJpS-9NJU4dn961OpE/s1600-h/server.bmp" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9fsJzke-sOCkD9w4xZGg12cSzO8vdF-Tg-JFLoOgbJ-myZ5UogH54AJefP3EoG2V5T5kjEv5-v-2cPOAc6bNL4zkp6VPfShbM2iXtLZ1FnF0WCt9JhnQeiUb5HTJpS-9NJU4dn961OpE/s200/server.bmp" /></a><br />
</div><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
Step 8: Enter username and password. Click next. Select No if you don want to add users/groups/roles<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhICAzGqcD4kQsHv0k_d2C6-RhSQBvIw7jSyIED89kFEyeNmW-zeKN4lvt65aesPrOWwNW4oncvWTiFRQZ-vi45UWg97RVGPznRoRs6U2kfs2RNCeNp8KI8jzpORJrndbQdDu5u6IH0aeI/s1600-h/user.bmp" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhICAzGqcD4kQsHv0k_d2C6-RhSQBvIw7jSyIED89kFEyeNmW-zeKN4lvt65aesPrOWwNW4oncvWTiFRQZ-vi45UWg97RVGPznRoRs6U2kfs2RNCeNp8KI8jzpORJrndbQdDu5u6IH0aeI/s200/user.bmp" /></a><br />
</div><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
Step 9: Click next<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_sOqTszArdoPaKnbiJpdyv6F1CSto9el9HQO5jPudotGftKygo7Otg7EFZsSwWibYB4MONY-lb452f4UtthwHASFyJD0rHnATrDStb7wDYafbS3hBVAm-kvYhuprkS5xC5xrX_kVodTk/s1600-h/domain.bmp" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_sOqTszArdoPaKnbiJpdyv6F1CSto9el9HQO5jPudotGftKygo7Otg7EFZsSwWibYB4MONY-lb452f4UtthwHASFyJD0rHnATrDStb7wDYafbS3hBVAm-kvYhuprkS5xC5xrX_kVodTk/s200/domain.bmp" /></a><br />
</div><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
Step 10: Click next<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOVWjoQ9bym-nteAgeTZexmc1JsLoAq1Ybv1GdFhPqiUdsNeGU_ZBGR6fxViO2N3vNTKdTlNLJ9GJKyNkLAAqSsF2H6P8dJG2JUsfTLSJHpWX6X46wEWubWhTESqB1aBsIPi_6gPxqJao/s1600-h/just.bmp" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOVWjoQ9bym-nteAgeTZexmc1JsLoAq1Ybv1GdFhPqiUdsNeGU_ZBGR6fxViO2N3vNTKdTlNLJ9GJKyNkLAAqSsF2H6P8dJG2JUsfTLSJHpWX6X46wEWubWhTESqB1aBsIPi_6gPxqJao/s200/just.bmp" /></a><br />
</div><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
Step 11: Click next<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHTtFv8OrlvUQWMU4UKQGYOnNMIMM4XRv2GsB39kW4e16eGstuxMPZQSysiUYFDDNHtP3jBk4QtgdtGkZfH3h8gAfdt_mXg25O0n3pH3BFHJ2URf0Bs-GjFVIeTk3b4L9F4M8TuynTrJY/s1600-h/template.bmp" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHTtFv8OrlvUQWMU4UKQGYOnNMIMM4XRv2GsB39kW4e16eGstuxMPZQSysiUYFDDNHtP3jBk4QtgdtGkZfH3h8gAfdt_mXg25O0n3pH3BFHJ2URf0Bs-GjFVIeTk3b4L9F4M8TuynTrJY/s200/template.bmp" /></a><br />
</div><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
Step 12: Click Create<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtvO_G-m31vI1Kjql9RNYu_LcMCyRVGsWdK30RlFWRYVB3T8rwD26YXy7mvw6gHUi8lslgROQql1EenEkb0NHgWCZP0JIflaE6WRsC__aGul2GCq7o45FXJgh-KqcTTbsUELDM8LMRnSY/s1600-h/final.bmp" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtvO_G-m31vI1Kjql9RNYu_LcMCyRVGsWdK30RlFWRYVB3T8rwD26YXy7mvw6gHUi8lslgROQql1EenEkb0NHgWCZP0JIflaE6WRsC__aGul2GCq7o45FXJgh-KqcTTbsUELDM8LMRnSY/s200/final.bmp" /></a><br />
</div><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<div style="text-align: left;">Step 13: Click done.<br />
</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKZlsGqxUUK5ZbT95AJUE8by0Skz1alOki3Sl571UdJast6gF4Nqowc0e1lx0p6XXVGCoSIl09f-F5c6eF4hAG1hmyvchY0btJeFkZ8pJGhzYbc2Gpg058R0VHX8hUwMyaY1nGaK2ZcmI/s1600-h/done.bmp" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKZlsGqxUUK5ZbT95AJUE8by0Skz1alOki3Sl571UdJast6gF4Nqowc0e1lx0p6XXVGCoSIl09f-F5c6eF4hAG1hmyvchY0btJeFkZ8pJGhzYbc2Gpg058R0VHX8hUwMyaY1nGaK2ZcmI/s200/done.bmp" /></a><br />
</div><div style="text-align: left;"><br />
</div><div style="text-align: left;"><br />
</div><div style="text-align: left;"><br />
</div><div style="text-align: left;"><br />
</div><div style="text-align: left;"><br />
</div><div style="text-align: left;"><br />
</div><div style="text-align: left;"><br />
</div><div style="text-align: left;"><br />
<br />
</div><div style="text-align: left;">This will create a domain template(jar file) which can be used to create domain.<br />
</div><div style="text-align: left;"><br />
</div><div style="text-align: left;">When creating domain using domain config wizard, do select 2nd option which is "base this domain on existing template" as shown below and browse the template jar file and continue.<br />
</div><div style="text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFo_NC53zTYbahZXPzzSl7JUXY79v1XgyjbzsBC2A7GKqaRHTGeh1fcvkjH0Yo0lEhwFum7NCW2BoSY-7SOpvjVrLfV4ZQmga5IVM7iDCm1ClNycvZjmTNfBLKz297rtd1_dJIf1g7N2c/s1600-h/jar.bmp" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFo_NC53zTYbahZXPzzSl7JUXY79v1XgyjbzsBC2A7GKqaRHTGeh1fcvkjH0Yo0lEhwFum7NCW2BoSY-7SOpvjVrLfV4ZQmga5IVM7iDCm1ClNycvZjmTNfBLKz297rtd1_dJIf1g7N2c/s200/jar.bmp" /></a><br />
</div><div style="text-align: left;"><br />
</div><div style="text-align: left;"><br />
</div><div style="text-align: left;"><br />
</div><div style="text-align: left;"><br />
</div><div style="text-align: left;"><br />
</div><div style="text-align: left;"><br />
</div><div style="text-align: left;"><br />
</div><div style="text-align: left;"><br />
<br />
</div><div style="text-align: left;">Good luck. Please let me know if you have any issues. <br />
</div><div class="separator" style="clear: both; text-align: center;"><br />
</div>Ananthhttp://www.blogger.com/profile/01014064398352414331noreply@blogger.com73tag:blogger.com,1999:blog-7021795647105717639.post-3488102176038285232009-10-16T17:34:00.007-05:002009-11-04T13:57:35.150-06:00How to create weblogic domain template?<div style="text-align: left;"><br />
This blog has been moved. Please refer to <a href="http://ananthkannan.blogspot.com/2009/10/how-to-create-domain-using-weblogic.html">this entry.</a> Sorry for the inconvenience. Thank you.<br />
<br />
</div><div class="separator" style="clear: both; text-align: center;"><br />
</div>Ananthhttp://www.blogger.com/profile/01014064398352414331noreply@blogger.com5tag:blogger.com,1999:blog-7021795647105717639.post-28018879611397997702009-10-14T14:16:00.007-05:002009-10-29T09:54:27.837-05:00Configure Apache with multiple weblogic server instancesI came across a unique situation at work where I needed to configure Apache web server to forward requests to multiple weblogic server instances running on same box but different port numbers. Here is the scenario:<br />
<br />
Instance A - http://test_server:7001/App1(Domain I)<br />
Instance B - http://test_server:7003/App2 (Domain II)<br />
Instance C - http://test_server:7005/App3 (Domain III)<br />
<br />
I have App1 deployed on instance1 which is running in domain I. Similarly App2 deployed on instance 2, app3 deployed on instance 3. Needless to say all domains running in different ports(non-clustered environment).<br />
<br />
Now I would like to configure my Apache to forward request to respective URLs based on what do they type in the URL.<br />
<br />
If they type http://test_server/App1 should go to instance A.<br />
If they type http://test_server/App2 should go to instance B.<br />
If they type http://test_server/App3 should go to instance C.<br />
<br />
When I use <IfModule> tag with location combination it did not work for me. But when I use <Location> tag for each app/instance in httpd.conf, it worked. Hope this information helps. <br />
<br />
#### for Instance 1/App1<br />
<Location /App1><br />
SetHandler weblogic-handler<br />
WebLogicHost test_server<br />
WebLogicPort 7001<br />
WLCookieName cookie1<br />
DynamicServerList OFF<br />
MaxPostSize 2048<br />
Debug ALL<br />
WLLogFile logs/httpd_proxy1.log<br />
</Location><br />
<br />
#### for Instance2/App2<br />
<br />
<Location /App2><br />
SetHandler weblogic-handler<br />
WebLogicHost test_server<br />
WebLogicPort 7003<br />
WLCookieName cookie2<br />
DynamicServerList OFF<br />
MaxPostSize 2048<br />
Debug ALL<br />
WLLogFile logs/httpd_proxy1.log<br />
</Location><br />
<br />
<br />
#### for Instance3/App3<br />
<Location /App3><br />
SetHandler weblogic-handler<br />
WebLogicHost test_server<br />
WebLogicPort 7005<br />
WLCookieName cookie3<br />
DynamicServerList OFF<br />
MaxPostSize 2048<br />
Debug ALL<br />
WLLogFile logs/httpd_proxy1.log<br />
</Location><br />
<span style="color: #3333ff;"></span>Ananthhttp://www.blogger.com/profile/01014064398352414331noreply@blogger.com5tag:blogger.com,1999:blog-7021795647105717639.post-81745304992709721192009-10-09T14:34:00.012-05:002010-01-25T14:21:55.650-06:00How to change log4j log levels at runtime?Here is the source code for log4jAdmin.jsp. I have copied under root of my WAR. Once you deployed the WAR, you can change the log levels on the fly without bouncing the servers. Remember you should have configured log4j in your applications properly. Please follow <a href="http://ananthkannan.blogspot.com/2009/09/how-to-configure-log4j-in-weblogic.html">this link</a> if you have any trouble in configuring log4j.<br />
Once you copy this log4jAdmin.jsp under root of your web app, you can access it by entering<br />
http://host_name:port/webapp/log4jAdmin.jsp<br />
<br />
<b><u>log4jAdmin.jsp:</u></b><br />
<br />
<%@ page language="java" contentType="text/html;charset=UTF-8" %><br />
<%@ page import="org.apache.log4j.Level" %><br />
<%@ page import="org.apache.log4j.LogManager" %><br />
<%@ page import="org.apache.log4j.Logger" %><br />
<%@ page import="java.util.HashMap" %><br />
<%@ page import="java.util.Enumeration" %><br />
<%@ page import="java.util.Set" %><br />
<%@ page import="java.util.Arrays" %><br />
<% long beginPageLoadTime = System.currentTimeMillis();%><br />
<br />
<html><br />
<head><br />
<title>Log4J Administration</title><br />
<style type="text/css"><br />
<br />
<!--<br />
#content {<br />
margin: 0px;<br />
<br />
padding: 0px;<br />
text-align: center;<br />
background-color: #ccc;<br />
<br />
border: 1px solid #000;<br />
width: 100%;<br />
}<br />
<br />
body {<br />
position: relative;<br />
margin: 10px;<br />
<br />
padding: 0px;<br />
color: #333;<br />
}<br />
<br />
h1 {<br />
margin-top: 20px;<br />
font: 1.5em Verdana, Arial, Helvetica sans-serif;<br />
}<br />
<br />
h2 {<br />
margin-top: 10px;<br />
font: 0.75em Verdana, Arial, Helvetica sans-serif;<br />
text-align: left;<br />
}<br />
<br />
a, a:link, a:visited, a:active {<br />
color: red;<br />
text-decoration: none;<br />
text-transform: uppercase;<br />
}<br />
<br />
table {<br />
width: 100%;<br />
background-color: #000;<br />
padding: 3px;<br />
border: 0px;<br />
}<br />
<br />
th {<br />
font-size: 0.75em;<br />
background-color: #ccc;<br />
color: #000;<br />
padding-left: 5px;<br />
text-align: center;<br />
border: 1px solid #ccc;<br />
white-space: nowrap;<br />
<br />
}<br />
<br />
td {<br />
font-size: 0.75em;<br />
background-color: #fff;<br />
white-space: nowrap;<br />
<br />
}<br />
<br />
td.center {<br />
font-size: 0.75em;<br />
background-color: #fff;<br />
text-align: center;<br />
<br />
white-space: nowrap;<br />
}<br />
<br />
.filterForm {<br />
<br />
font-size: 0.9em;<br />
background-color: #000;<br />
color: #fff;<br />
padding-left: 5px;<br />
text-align: left;<br />
border: 1px solid #000;<br />
<br />
white-space: nowrap;<br />
}<br />
<br />
.filterText {<br />
<br />
font-size: 0.75em;<br />
background-color: #fff;<br />
color: #000;<br />
text-align: left;<br />
<br />
border: 1px solid #ccc;<br />
white-space: nowrap;<br />
<br />
}<br />
<br />
.filterButton {<br />
font-size: 0.75em;<br />
<br />
background-color: #000;<br />
color: #fff;<br />
<br />
padding-left: 5px;<br />
padding-right: 5px;<br />
<br />
text-align: center;<br />
border: 1px solid #ccc;<br />
<br />
width: 100px;<br />
white-space: nowrap;<br />
}<br />
<br />
--><br />
</style><br />
</head><br />
<body onLoad="javascript:document.logFilterForm.logNameFilter.focus();"><br />
<br />
<%<br />
String containsFilter = "Contains";<br />
String beginsWithFilter = "Begins With";<br />
<br />
String[] logLevels = {"debug", "info", "warn", "error", "fatal", "off"};<br />
String targetOperation = (String) request.getParameter("operation");<br />
String targetLogger = (String) request.getParameter("logger");<br />
String targetLogLevel = (String) request.getParameter("newLogLevel");<br />
String logNameFilter = (String) request.getParameter("logNameFilter");<br />
String logNameFilterType = (String) request.getParameter("logNameFilterType");<br />
<br />
%><br />
<div id="content"><br />
<h1>Log4J Administration</h1><br />
<br />
<div class="filterForm"><br />
<br />
<form action="log4jAdmin.jsp" name="logFilterForm">Filter Loggers:&nbsp;&nbsp;<br />
<input name="logNameFilter" type="text" size="50" value="<%=(logNameFilter == null ? "":logNameFilter)%>"<br />
<br />
class="filterText"/><br />
<input name="logNameFilterType" type="submit" value="<%=beginsWithFilter%>" class="filterButton"/>&nbsp;<br />
<br />
<input name="logNameFilterType" type="submit" value="<%=containsFilter%>" class="filterButton"/>&nbsp;<br />
<br />
<input name="logNameClear" type="button" value="Clear" class="filterButton"<br />
<br />
onmousedown='javascript:document.logFilterForm.logNameFilter.value="";'/><br />
<input name="logNameReset" type="reset" value="Reset" class="filterButton"/><br />
<br />
<param name="operation" value="changeLogLevel"/><br />
</form><br />
</div><br />
<br />
<table cellspacing="1"><br />
<tr><br />
<th width="25%">Logger</th><br />
<br />
<th width="25%">Parent Logger</th><br />
<th width="15%">Effective Level</th><br />
<br />
<th width="35%">Change Log Level To</th><br />
</tr><br />
<br />
<%<br />
Enumeration loggers = LogManager.getCurrentLoggers();<br />
<br />
HashMap loggersMap = new HashMap(128);<br />
Logger rootLogger = LogManager.getRootLogger();<br />
<br />
if (!loggersMap.containsKey(rootLogger.getName())) {<br />
<br />
loggersMap.put(rootLogger.getName(), rootLogger);<br />
}<br />
<br />
while (loggers.hasMoreElements()) {<br />
Logger logger = (Logger) loggers.nextElement();<br />
<br />
if (logNameFilter == null || logNameFilter.trim().length() == 0) {<br />
<br />
loggersMap.put(logger.getName(), logger);<br />
} else if (containsFilter.equals(logNameFilterType)) {<br />
<br />
if (logger.getName().toUpperCase().indexOf(logNameFilter.toUpperCase()) >= 0) {<br />
<br />
loggersMap.put(logger.getName(), logger);<br />
}<br />
<br />
} else {<br />
// Either was no filter in IF, contains filter in ELSE IF, or begins with in ELSE<br />
if (logger.getName().startsWith(logNameFilter)) {<br />
<br />
loggersMap.put(logger.getName(), logger);<br />
}<br />
<br />
}<br />
}<br />
Set loggerKeys = loggersMap.keySet();<br />
<br />
String[] keys = new String[loggerKeys.size()];<br />
<br />
keys = (String[]) loggerKeys.toArray(keys);<br />
<br />
Arrays.sort(keys, String.CASE_INSENSITIVE_ORDER);<br />
for (int i = 0; i < keys.length; i++) {<br />
<br />
Logger logger = (Logger) loggersMap.get(keys[i]);<br />
<br />
// MUST CHANGE THE LOG LEVEL ON LOGGER BEFORE GENERATING THE LINKS AND THE<br />
// CURRENT LOG LEVEL OR DISABLED LINK WON'T MATCH THE NEWLY CHANGED VALUES<br />
if ("changeLogLevel".equals(targetOperation) && targetLogger.equals(logger.getName())) {<br />
<br />
Logger selectedLogger = (Logger) loggersMap.get(targetLogger);<br />
<br />
selectedLogger.setLevel(Level.toLevel(targetLogLevel));<br />
}<br />
<br />
String loggerName = null;<br />
String loggerEffectiveLevel = null;<br />
String loggerParent = null;<br />
if (logger != null) {<br />
loggerName = logger.getName();<br />
loggerEffectiveLevel = String.valueOf(logger.getEffectiveLevel());<br />
loggerParent = (logger.getParent() == null ? null : logger.getParent().getName());<br />
<br />
}<br />
%><br />
<tr><br />
<td><%=loggerName%><br />
</td><br />
<br />
<td><%=loggerParent%><br />
</td><br />
<td><%=loggerEffectiveLevel%><br />
<br />
</td><br />
<td class="center"><br />
<%<br />
for (int cnt = 0; cnt < logLevels.length; cnt++) {<br />
<br />
String url = "log4jAdmin.jsp?operation=changeLogLevel&logger=" + loggerName + "&newLogLevel=" + logLevels[cnt] + "&logNameFilter=" + (logNameFilter != null ? logNameFilter : "") + "&logNameFilterType=" + (logNameFilterType != null ? logNameFilterType : "");<br />
<br />
if (logger.getLevel() == Level.toLevel(logLevels[cnt]) || logger.getEffectiveLevel() == Level.toLevel(logLevels[cnt])) {<br />
<br />
%><br />
[<%=logLevels[cnt].toUpperCase()%>]<br />
<br />
<%<br />
} else {<br />
%><br />
<a href='<%=url%>'>[<%=logLevels[cnt]%>]</a>&nbsp;<br />
<br />
<%<br />
}<br />
}<br />
%><br />
</td><br />
</tr><br />
<br />
<%<br />
}<br />
%><br />
</table><br />
<h2><br />
Revision: 1.0<br/><br />
Page Load Time (Millis): <%=(System.currentTimeMillis() - beginPageLoadTime)%><br />
</h2><br />
</div><br />
</body><br />
</html>Ananthhttp://www.blogger.com/profile/01014064398352414331noreply@blogger.com13tag:blogger.com,1999:blog-7021795647105717639.post-28697857348269977472009-09-25T11:14:00.019-05:002010-01-25T14:32:47.301-06:00Configure log4j in weblogic serverI have recently configured log4j for our web applications deployed in weblogic 10.3 domain. The steps are given below:<br />
<br />
<i><b><u>1.</u></b></i> Copy log4j-1.2.9.jar & wllog4j.jar under domain_root/lib folder.<br />
<b><i><u>2.</u></i></b> Create log4j.xml and drop it under domain_root folder. If you have log4j.xml inside the application(EAR/WAR), I would recommend to move outside EAR/WAR as changing severity (log level) would require re-deployment. To avoid this, we can move log4j.xml into domain root folder but again the server needs to be bounced. But there is a fix. <a href="http://ananthkannan.blogspot.com/2009/10/how-to-change-log-levels-on-fly-using.html">Click</a> here for more info.<br />
<b><i><u>3.</u></i></b> Login to weblogic server console. Go to Servers -> Admin Server-> Logging. Click on advanced mode. Change the logging implementation from JDK to Log4J. Click save.<br />
<b><i><u>4.</u></i></b> Activate changes. Re-start the admin server.<br />
<br />
This should enable log4j and should write logging into log file mentioned in log4j.xml or properties file.<br />
<br />
Hang on! There is a catch here. Say now I want to change the log level from DEBUG into WARN or ERROR. How do i do? We go to log4j.xml and change the level. Now how does this change take into effect? It needs bouncing of the server. That part i didn't like it. But guess what I have a solution for this. Please <a href="http://ananthkannan.blogspot.com/2009/10/how-to-change-log-levels-on-fly-using.html">click here</a> for changing the log levels on the fly at run time. Log4jAdmin.jsp will do the trick.<br />
<br />
Some of our readers asked for example of log4j.xml. If you google it you will get plenty of them, still I am honoring your requests. Here you go, folks:<br />
<br />
<b><i><u>log4j.xml:</u></i></b><br />
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <br />
<log4j:configuration> <br />
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"><br />
<layout class="org.apache.log4j.PatternLayout"><br />
<param name="ConversionPattern"<br />
value="%d [%t] %-5p %c - %m%n"/><br />
</layout><br />
</appender> <br />
<appender name="FILE" class="org.apache.log4j.RollingFileAppender"><br />
<param name="File" value="/log/myApp.log"/> <br />
<param name="Append" value="true"/><br />
<layout class="org.apache.log4j.PatternLayout"><br />
<param name="ConversionPattern" value="%d{ISO8601} %t %-5p %c{2} - %m%n"/><br />
</layout><br />
</appender><br />
<logger name="org.apache"><br />
<level value="WARN"/><br />
</logger><br />
<logger name="org.springframework"><br />
<level value="WARN"/><br />
</logger><br />
<root><br />
<level value="DEBUG"/><br />
<appender-ref ref="FILE"/><br />
<b><!-- <appender-ref ref="CONSOLE"/></b> --><br />
</root><br />
</log4j:configuration><br />
<br />
I have disabled log4j to write into weblogic console by commenting out. If you want to enable it just uncomment it and bounce the server, you are done!Ananthhttp://www.blogger.com/profile/01014064398352414331noreply@blogger.com48