Tuesday, April 23, 2013

Deleting Records From Failed Event Manager In Websphere Application Server [ WESB & WPS ]

The WebSphere application server stores all exception's in failed event manager. If FEM is full, then clearing FEM Records through Admin Console is not possible.

In this situation, we have two options to remove all FEM.

Option 1:
=======

Delete FEM records from WPSDB database . Run the below query in order.

delete from FAILEDEVENTS;
delete from FAILEDEVENTBOTYPES;
delete from FAILEDEVENTDETAIL;


Option 2:
=======

Delete FEM by jython scripts.

The script must be saved in a file and can be run on a single server profile as well as a
clustered environment (run on deployment manager) using the following command:

1.  cd Deployment manager  [ or ] Profile Name/bin 
2.   Run wsadmin.(bat|sh) -lang jython -f jythonScriptName -user wpsAdminUserName -password wpsAdminPassword

Ex: wsadmin.bat -lang jython -f /opt/Websphere/AppServer/scripts/FEMScript.py -user admin -password admin


FEMScript.py
===========
# lookup the failed event manager
objstr = AdminControl.completeObjectName('WebSphere:*,type=FailedEventManager')
obj = AdminControl.makeObjectName(objstr)

# count the overall number of failed events
fecount = AdminControl.invoke(objstr,"getFailedEventCount")
print "Failed event number before discarding: ", fecount

delnum = 100
fecount = int(fecount)

while (fecount > 0):
    if fecount < 100:
        delnum = fecount
        fecount = 0
    else:
        delnum = 100
        fecount = fecount - 100
      
    # get 100 failed events
    msglist = AdminControl.invoke_jmx(obj,'getAllFailedEvents',[delnum],['int'])

    # discard 100 events in single batch run
    print "Discarding ", delnum, " failed events"
    AdminControl.invoke_jmx(obj,'discardFailedEvents', [msglist],['java.util.List'])

# count the overall number of failed events
fecount2 = AdminControl.invoke(objstr,"getFailedEventCount")
print "Failed event number after discarding: ", fecount2




Tuesday, April 2, 2013

WPS : Unable to Install appllication on server "Application is already Exist on Server". Module status is unknown in SCA module section.

Issue: I am trying to install one application on server. It's unable to install giving exception as " already exist on server".
In admin console go to --> SCAModules : there i am finding my module over there but the state of the module is unknown. i tryed to un-deploy from there. it's not able to un-deploy. Even i am unable to remove that application from server from admin consol too..

Solution :
1. first we have to stop the server.
2. we have to remove particular application from all the folder in server profile.
3.One more main thing is go to installation folder-->  \profiles\qbpmaps\config\cells\qcell go to this path and open "cell-core.xml" file and remove SCAModules entry of that particular application from this file.
4. Start the server
now we can able to deploy that same application successfully.


OR

You can also force the uninstall with the following command:

<>\bin\wsadmin.bat -user <> -password <> -lang jacl -f <>\ProcessChoreographer\admin\bpcTemplates.jacl -uninstall <> -force

Thursday, March 28, 2013

WAS 7 – Busines level Application can not be removed

In WAS 7, IBM introduced the new concept BLA (business level application) which can include EAR, JAR or share libraries.

However, some times when you update a EAR file from console but failed, which cause the Enterprise Application was removed but BLA was still left. When you redeploy the same module, the module can not be deployed, and you will see the following error when you want to delete the existing BLA:
CWWMH0149E: Cannot delete business-level application “WebSphere:blaname=AppEAR” because it contains composition units. Delete all composition units which belong to the business-level application, and then delete the business-level application. Check log for details.
As a matter of fact, you already removed all composition units, and you can not see any composition units belong to this BLA from administrative console or even using wsadmin scripts.

Here is a way for how to remove the isolated BLA if BLA can not be removed without any composition units belonging to it.

1) stop the WebSphere Application Server.
2) backup the WebSphere profile configuration using “backupConfig.sh” command
3) go to directory /config/cells//blas
4) remove the directory of specified BLA
5) go to directory /config/cells//cus
6) remove the directory of specified BLA
7) go to directory config, remove temp directory
8) go to directory , remove wstemp and temp directory
9) restart the WebSphere Application Server
10) redeploy the module.
this is the way I solved this problem. I hope someone can provide the better way to solve this issue.

Friday, January 25, 2013

Using WebSphere variable in JavaEE application


There is a section in the WebSphere Admin console called WebSphere variables (located under Environment), where you can … manage WebSphere variables (WAS variables). But how can one use these WAS variables within a JavaEE application? There is a proprietary way to load them which I will not mention here.
A better way in my opinion is to bridge the WAS variable to an environment variable. Then it can simply be accessed through System.getProperty(“varName”); It’s also easy to access the variable on Tomcat without touching the code.
To bridge a WAS variable:
  1. Log on to your WAS console.
  2. Add a WAS variable “myapp.myVar” under Environment -> WebSphere variables
  3. Go to (something llike) Servers -> Server Types -> Websphere application servers -> YOUR_SERVER -> Java and process management -> Process definition -> Java virtual machine -> Custmo properties
  4. Define a new variable myapp.myVar = ${myapp.myVar}
  5. Save and restart.
The value of myapp.myVar can now be obtained: System.getProperty(“myapp.myVar”)

Note : 
If you have cluster environment then this configuration should be in all server of cluster. 

Wednesday, December 21, 2011

WebSphere Message Broker version 8 is out!

Hot on the heels of the latest goodness in WebSphere MQ, it’s the turn of IBM’s Enterprise Service Bus – WebSphere Message Broker – to get a major new update.
WMB v8.0 was announced back in early October and has just arrived ready for  download in versions for distributed platforms, System z mainframes, and as a Hypervisor Edition for Linux and AIX (to be provisioned via the IBM Workload Deployer appliance).
As I did with WMQ last month, I wanted to take a moment to break out and highlight some of the key things in this release that you may have missed from the announcement letter. This won’t be a comprehensive list of everything, but I  want to point out some of the cooler features that you’ll want to be aware of. So, here we go…
(I’ve included a few screenshots to whet your appetite, click for larger versions!)
A simpler development experience
Version 8 brings a number of enhancements to the development experience, but one worth highlighting is what we call “Apps and Libs” – the idea that sets of message flows may be grouped into a unit called an Application which can be deployed, stopped and started as a whole. With Libraries, there are also truly re-usable assets like .esql files, or sub-flows, which can be deployed and updated separately, and invoked dynamically at runtime. This is a key change in the way that the Broker works – previously, sub-flows were compiled into the main flow and changing one required redeployment of all flows using it… they are now dynamically linked when needed, so they can be deployed and replaced more easily.
A new standards-based parser and message modeler
A new Data Format Description Language (DFDL, which you’ll sometimes hear called “daffodil”) enables any text or binary data to be understood within the message model. The Broker has had the “MRM” for many years, so of course could already do this, but DFDL is a new industry standard which can supersede the MRM (of course, you can continue to use your existing flows and message formats – you’re not forced to use DFDL). There’s a new mapper, too.
More importantly, coming along with DFDL and the mapper is a really, really nice set of utilities for testing message models inside the Toolkit – you’ll now be able to confirm that the model matches the test data without having to go through a full model->deploy-> test-at-runtime cycle. I saw this demo’ed at the WebSphere Technical Conference in Berlin during October and was blown away by it – it would have saved me a lot of time back in my consulting days!
Comprehensive .NET support
If you have .NET applications, assemblies, or services on the Windows platform, and you want to access those from your message flows – you can. If you want to write your message flow logic using C# or VB.NET or any .NET 4.0 CLR-supported language, using Visual Studio – you can.
If you don’t know how to get started with this stuff, the Toolkit has a new .NET Pattern to lead you by the hand and get you going quickly, and project wizards for Visual Studio.So, if you want a high-performance ESB platform that connects “anything to anything”, with minimal need to learn new skills, and run it on Windows with deep .NET integration – this release is going to cover your requirements.
Web administration
Delivered in version 8 is a first stage in making the Broker more easy to administer from a lightweight client – a web browser. Whilst power users and existing administrators can continue to use the Message Broker Explorer GUI, there is now an easy way to enable an optional web interface for basic administration tasks. Continuing the theme of simplicity the product has followed for a while, no additional moving parts (app or web servers) are required! Version 8.0 provides read-only views of running Applications and access to the log – more capabilities will be rolled into this interface in the future.
Record and Replay
Sometimes, when you are dealing with a set of end-to-end flows of data between applications, you may want the capability to record what is going on, and to replay specific scenarios and sets of events. This could be the case in audit, test, and many other scenarios. Another of the massive enhancements in version 8 is the Broker’s response to this requirement – again delivered using the same simple, lightweight interface offered by the web administration tool.
This also builds on technology around monitoring that has been progressively built into the Broker over the past couple of releases, so there are some really solid foundations and it is straightforward to set up.
Richer, yet easier to use
Just as I highlighted in my piece about WebSphere MQ 7.1, the Hursley teams have been strongly focused on “consumability” (translation for non-IBM-speakers = UX) for a number of years now. WMB continues to add capabilities that make it a richer, stronger integration platform, but also smooths out rough edges seen in earlier releases and is just… well… more productive to use. There’s even a drive to reduce the jargon and make the Broker logs more easy to understand, with new Activity Logging which aims to explain what a flow is doing in plain language (“GET message queue X”, “Update DB table Z”, and so on).
Taken together, the new wizards, web interfaces, integrated testing tools, message modelling tools, reduced dependencies, lightweight deployment with apps and libs… the combination just makes it a much more enjoyable experience for developer and administrators. And there’s a new installer, too.
The “papercuts” and node additions lists are huge: new JMSReceive node; new options for the File nodes; new Connect:Direct nodes; WS-ReliableMessaging support in the SOAP nodes; ability to install without root privileges; dynamic configuration of services without the need to restart execution groups… the list just goes on! Check out the product Information Center for more details on all of the features I just don’t have space to list.
… and finally…
Huge congratulations to some hard-working development teams in Hursley, Toronto and Bangalore in getting this release out there. As I’ve said before, I’ve been using the Broker for 10 years now and it just keeps getting better, and better. These guys are a very strong set of developers who turn out a fantastic, high quality product every time. Special thanks to MGK, @mqmatt, and @domstorey for some of the screenshots in this post :-)
Footnote: version 8.0 is friendly to developers who use Ubuntu, too! :-) Anton (my go-to guy on all things Debian – listen to him!) has some good advice about running WMB or WMQ on Ubuntu and Debian

Friday, November 11, 2011

Settings up Message Broker Command environment

Run mqsiprofile script

Running Commands:
Commands must be lower case
Component names case sensitive
Start/Stop/Delete Broker:
Start: mqsistart BrokerName
Stop: mqsistop BrokerName

–q after name stops associated queue manager
–i after name stops immediately
Delete: mqsideletebroker BrokerName [options]
Note: Broker must be stopped before it can be deleted
Start/Stop/Delete Configuration Manager:
Start: mqsistart ConfigMgrName
Stop: mqsistop ConfigMgrName
–q after name stops associated queue manager
Delete: mqsideleteconfigmgr [ConfigMgrName] [options]
–n flag to delete configuration repository
-w flag deletes all files in the configuration manager’s work path
Start/Stop/Delete UserNameServer:
Start: mqsistart UserNameServer
Stop: mqsistop UserNameServer
–q after name stops associated queue manager
Delete: mqsideleteusernameserver [options]
–q after name deletes associated queue manager
–w after name deletes all files in the work path associated with the User Name Server
Specifying Username and password:
You can specify the following flags along with the commands
–i userid
–a password
If you leave, -a flag black; it will prompt you for password.
Changing Broker
mqsichangebroker BrokerName [options]
-s — User Name Server queue manager name
-j — Enable publish/subscribe for the broker
-d — Disable publish/subscribe for the broker
-t — Run the broker as a trusted MQ application
-n — Stop running the broker as a trusted MQ application
-g — Configuration timeout — maximum time for response from an execution group
-k — Configuration delay timeout — maximum time for response from a broker
Changing Configuration Manager
mqsichangeconfigmgr [ConfigMgrName] [options]
-s — User Name Server queue manager name
-j — Maximum Java virtual machine heap size in megabytes. The default is 128.
Changing User name server
mqsichangeusernameserver [options]
-r — Refresh interval being the amount of time before the User Name Server interrogates
the security subsystem for changes to users or groups
-g — The name of the authentication data source
-j — Indicates use of a data source containing users and group information instead of
using the operating system
-o — Indicates use of the operating system users and group information
Note: before executing above change commands, the respective component must be stopped.
Execution Groups:
Create: mqsicreatexecutiongroup [options]
Delete: mqsideleteexecutiongroup [options]
-i host
-p port number of the Configuration Manager-q Config Manager QM
-q queue manager of Configuration Manager
-b Broker name
–e Execution group name
-w timeout
- v tracefile name
Start: mqsistartmsgflow [options]
Stop: mqsistopmsgflow[options]
-i host
-p port number of the Configuration Manager-q Config Manager QM
-q queue manager of Configuration Manager
-b Broker name
–e Execution group name
-m specific flow within the execution group
-w timeout
- v tracefile name
Report message flow statistics: mqsireportflowstats broker_name [options]
-e ExecutionGroupName
-f MessageFlow
-a Specify that the command modifies archive accounting and statistics collection.
-s Specify that the command modifies snapshot accounting and statistics collection.
-g Specifies that the command applies to all execution groups that belong to the broker.
-j Specifies that the command applies to all message flows that belong to the execution group.
Change message flow statistics: mqsichangeflowstats [options]
-e ExecutionGroupName
-f MessageFlow
-a Specify that the command modifies archive accounting and statistics collection.
-s Specify that the command modifies snapshot accounting and statistics collection.
-g Specifies that the command applies to all execution groups that belong to the broker.
-j Specifies that the command applies to all message flows that belong to the execution group.
-o OutputFormat; usertrace/xml
Deploy:
mqsideploy [options]
-p port number of the Configuration Manager
-q queue manager of Configuration Manager
-b Broker
-e Execution Group
-a BAR file
-w Timeout
Listing resources
mqsilist [options]
- a List all the components
- brokerName The name of the broker for which you want to list resources
- e egName selects an execution group within a broker
Security Commands
Create ACL: mqsicreateaclentry ConfigmgrName [options]
List ACL entries: mqsilistaclentries [options]
Delete ACL entries: mqsideleteaclentries [options]
-g GroupName The local group to which this entry refers
-u UserName The user name to which this entry refers
-m MachineName The name of the machine from which a specified user can connect.
-a The specified user name can be on any machine.
-x AccessLevel
F: Full control
D: Deploy
E: Edit
V: View
-b Broker
-e ExeGroup, You must specify the b flag if you specify this flag.
-s Subscription The object is a subscription object, and its name is specified as a parameter.
-r The object refers to the root topic.
-t The object refers to the main topology.
-p The object refers to the “allresources” resource type
Backup/Restore Commands
Backup: mqsibackupconfigmgr ConfigMgrName –d DirPath [options]
Restore: mqsirestoreconfigmgr ConfigMgrName –d DirPath –a ArchiveName [options]
-w WorkPath Specifies the path for the Configuration Manager repository
Problem Determination
Trace
Report Trace: mqsireporttrace [options]
Change Trace: mqsichangetrace [options]
-componentName The name of a broker, a Configuration Manager, or the fixed name User Name Server;
-e egName The label of the execution group for which a report is required. This option is valid only if you have specified a broker as the component.
-f messageFlow The label of the message flow for which a report is required. This option is valid only if you have specified a broker as the component, and an execution group.
-u Derive report information from the user trace.
-t Derive report information from the service trace.
-b Request a report for agent function.
-n Report the setting of the Trace node switch.
Read Trace: mqsireadlog BrkName [options] –o Output_file
-e Egroup
-o Outputfilename
-f Read the log file directly from the file system
-u Read the log contents from the user trace log.
-t Read the log contents from the service trace log.
Format Trace: mqsiformatlog –i input_file -o Output_file
Publish/subscribe commands
Add, remove, and list MQ publish/subscribe broker network
Add: mqsijoinmqpubsub Broker_name [options]
-p ParentQueueManagerName, The name of the queue manager that hosts the WebSphere MQ Publish/Subscribe broker to which this WebSphere Message Broker broker is to be joined
Remove: mqsiclearmqpubsub Broker_name [options]
-n NeighborQueueManagerName, The name of the queue manager that hosts the WebSphere MQ Publish/Subscribe broker for which the association as a neighbor is being removed.
List: mqsilistmqpubsub Broker_name
Database commands
CreateDB:
(windows) mqsicreatedb DBName [options]
-i ServiceUserID, The user ID under which the DatabaseInstanceMgr service runs
-a ServicePassword, The password for the ServiceUserID
-p PortNumber, The TCP/IP port number that this component will use on the local machine
-e DbType
-u DbUserID, An additional user name that requires access to the database that is created by this command.
(unix/Linux) mqsi_setupdatabase [options]
-Database_Home_Directory, The name of the directory in which the database is (or will be) installed
Change user ID andpassword information
mqsisetdbparms BrokerName [options]
-n ResourceName or AdapterName
-u UserId or EISUserId
-p Password
-d This parameter deletes the user ID and password pair for this resource from the registry.
-a Specify this parameter to process the mqsisetdbparms command when the broker itself is running.

How to Schedule a Java Application from Windows Task Scheduler

If you want a Java application to run daily, hourly or on some other frequency and the server is Windows, this entry provides a step-by-step method for configuring such a system.  Below are the basic steps in brief:

1. write java class or obtain classes to use
2. move class or classes to root location:  java_home\bin (where java.exe is found)
3. put your classes in the file path descending from bin, as usual (i.e. com.utilities.mycompany)
4. put .properties file (if any) in bin directory (java_home\bin )
5. create a batch file on desktop or anywhere.  Inside batch file place your java class invocation
6. point to batch file in Windows Scheduler.
7. Configure Windows Scheduler to run on some schedule.

Details of Process (uses same sequence as above):
1. write java class or obtain classes to use. Can also use jar files, of course.
2. move class or classes to root location:  java_home\bin (where java.exe is found). If you don't have java_home environment variable set search for java.exe and use the JRE/JDK folder that matches the version of Java JVM you're using. It's often found in c:\program files\java...
3. put your classes in the file path descending from bin, as usual (i.e. com.utilities.mycompany).  See image below: 
 


4. put .properties file (if any) in bin directory (java_home\bin ). In this example: C:\Program Files\Java\jdk1.5.0_09\bin
5. create a batch file on desktop or anywhere.  Inside batch file place your java class invocation.  Here is a sample batch file. Of course, you can get as fancy and include as many features as you want. Check the Internet for details about how to write batch (.bat) files...this is an entire subject in itself:
echo Running Java Move File utility
echo %date% %time% Start of Running Java Move File utility> c:\test.log
cd C:\Program Files\Java\jdk1.5.0_09\bin
java -cp ".;" com.util.cmmc.CopyAndDelete 1>>c:\test.log 2>>&1
echo Batch file completed
Intrepretation of bat file (in parentheses)
echo Running Java Move File utility (just a comment)
echo %date% %time% Start of Running Java Move File utility> c:\test.log  (this line puts a timestamp and title into a file called test.log)
cd C:\Program Files\Java\jdk1.5.0_09\bin (this ensures you are in correct directory to launch java JVM)
java -cp ".;" com.util.cmmc.CopyAndDelete 1>>c:\test.log 2>>&1 (this is the key line that launches your app. In this case it's called CopyAndDelete. Classpath has no supporting classes besides default classes. Note that standard output statements are written to the same log file)
echo Batch file completed (just a comment)
6. point to batch file in Windows Scheduler. Open Windows Scheduler by Contol Panel | Scheduled Tasks (Windows 2003 Server Enterprise Ed.). Create a new task. Point to the .bat file you just created:
  
 


7. Configure Windows Scheduler to run on a schedule. Use Advanced settings if you need to further define scheduled run time.







Advanced settings allow repeating schedule and frequency not found in the basic settings:
 



Setup is now complete. You can do a sample run (independent of schedule) by right clicking on the Scheduled Task (at Explorer level - folder level) and clicking Run.
 
Note that there are many options for creating a .bat file, setting up scheduler, logging, etc. This blog entry shows how to do a basic, workable system from start-to-finish.  You can use this as a starting point and construct what you need from this example working system

Sunday, May 22, 2011

Work Life Balance

One of the common problems today every one of us goes through in our day to day life is work life balance. I have heard this term recently multiple times and I wanted to blog about my opinion on the same.


Work life and personal life are the two sides of the same coin. Traditionally creating and managing a balance between the work-life was considered to be a woman’s issue. But increasing work pressures, globalization and technological advancement have made it an issue with both the sexes, all professionals working across all levels and all industries throughout the world. Achieving "work-life balance" is not as simple as it sounds.

Work life and personal life are inter-connected and interdependent. Spending more time in office, dealing with clients and the pressures of job can interfere and affect the personal life, sometimes making it impossible to even complete the household chores. On the other hand, personal life can also be demanding if you have a kid or aging parents, financial problems or even problems in the life of a dear relative. It can lead to absenteeism from work, creating stress and lack of concentration at work.


Okay, Okay, We have heard this n number of times… so what do you want to say?

In my opinion following are the list of items which can help in achieving WLB.

Understand what you want: You are the best judge of what you want. If you want an aggressive career then there will be obviously more work to do. If you are a person who talks about aggressive career only during the time of appraisal then convince yourself about that. If you are not able to decide what you want, no one can help you in this. IMHO, you can’t have the best of both worlds.

Prioritize your tasks: Yes, prioritize your work. In the morning, when you get into office, list the items which are important that needs to be completed before you leave for the day.

Have 2 sets of list. One is Critical and the other one is Non-Critical Items. Critical are the list of items which you need to deliver or which your boss has asked you to deliver.

Non-critical are the items which you need to complete, but it is not high priority. May be you can delegate to your team members (if possible).

There are cases where you need to move the items between the groups. You need to prioritize this based on the situation.

Make a habit to complete the items in the list. If you have a very long to do list, then it means that you are not following what you have agreed to do. Mark items as completed as you move along and clear the list on a regular basis.

Time Management: Everyone talks about the need for managing time, but it’s the hardest thing to implement. Maintain a list where you could specify the time spent during my day. Capture this for a week or so and analyse. You do not have to share it with your boss. It’s for you. Apart from work, there could be items like Tea break, Cigarette break, Lunch break, Browsing, Chatting, Personal E-mails, Socializing chats, Evening Walk and Reading News Feeds etc. Find out where majority of your time goes.

Once you know where your time is spent, cut those items and see how it can be used effectively at work. As far as I know, we do not work more than 6 focused hours (most of the cases its only less than 4 focused hours of work). If we can effectively spend these hours in the day time then you can definitely complete your work by 6 PM and there is no need to stay after 6.

If you have client calls in the evening/support the client side team, then work out a plan with your manager so that you can start little late. You can use this time in the morning to do your personal work. Adjust your work hours. I have seen the benefits of adjusting the work hours. It really helps.

Exercise/Stay fit: The other thing which we normally miss is exercise. It could be because of laziness or not wanting to do any physical activity. Exercise will keep you fit and make you feel better.

Hobby: Have a hobby/life outside your work. If things are not going well, this will help you focus in things outside work.

In summary, work Life Balance starts with understanding what you want. It requires a person to know how to prioritize work, say NO whenever required and manage his/her time better. It’s all about how you can juggle the elephants.

More work and less personal life create problems. The same way, more of personal life and less work also will not help. It’s not possible to exactly get the balance. IMHO, it’s more about adaptability and how one can adjust to the situation.

Reference:

http://www.naukrihub.com/hr-today/work-life-balance.html

Saturday, May 21, 2011

Learn To Put A Full-Stop !!!

You can remain stable when you learn to apply a full-stop.


In any difficult situation, check if you are having thoughts like, "why do things happen with me like this or why is this person behaving in this way" etc. you can never remain stable when you have such questions. Tell yourself that it is much easier to put a full-stop(.) than putting a question mark(?). understand the difference between worrying and finding solutions and worrying. If there is a solution, find it, if there isn't let things take care of themselves and put a full-stop.

Overcome & Control Your Weakness !!

The way to overcome your weakness is to feel that the weakness is not yours.


Check what weakness within you is not enabling you to attain success in the way you want to. Also check how many times during the day you have felt caught up with that weakness. See yourself in your perfect form and let there be the thought in your mind that the weakness is not yours and you are the one who has developed it in yourself. This thought helps you to gain mastery over that weakness and gives you the control to overcome it.