Pages

Monday, April 22, 2013

Creating simple JMS application, understand JMS with basic example, JMS queue example

I hope you already have a basics of the JMS concpet, a bit more about it in different way.

1. when to use JMS or when a test case or secanrio to eligible for use JMS?
    1. When you want to decouple an application  and keep it loosly coupled with
    other systems/modules.
    2. When your application is growing and has growing responsibility to maintain
    interaction with modules.
    3. While communicating with other system there has to be no need of waiting for response
    immideatly, I would rather say that if you design application to communicate with other system
    asyncronously.
in all above case it is preferred to use JMS as a way for communiation protocol.
these are few examples where JMS can be used efficiently...
1. in your saving account you have sms alert on transactions.
2. you submit your tax processing appliction.
3. request for checkbook order
4. request for transaction details report (that will be emailed)
5. monitoring system which audits data based on events.

I would also like to share that there will be more different exampls which may look like can be build
only with syncronus communication, but they can be designed differently in such a way to work with JMS
as to improve performance of the system and scalability.

Lets take an example of banking application now.

I have a banking application which has integral module within that sends email and sms
on transaction processiing. now bank is devleloping another module which is a pesonal
goal module where use specify his saving goal and once it is achieved it will send sms
there also new module need to be added about alter of new bills payment that customer have to pay.

now think that if the banking application was desingned earlier in such a way that this small
sms/email module was developed as a integral part of system and as more and more functionality
gets added its become difficult to maintain and provide different features/ integrate with different
module. (this is a simple scenario presented here don't think of too much of complexity or alternatives)

lets try to design it as a loosly coupled system.

assume that bank has a independant module deployed on the server along with banking application
and both communicate over JMS because banking appliation do not need any feedback after it post
message for sending email or sms, rather confirming customer that request processed.

OK now who is consumer and who is producer?, what type of JMS messaging it is?
in this case your sms/email module is a consumer of the message as it process message for sending email or sms.
and your bank application is a producer of the message who send the request to process message.
and this is queue based message processing because response (sms/email) is intended to one recepient only.

Lets try to create a sample application both bank and sms module and deploy on weblogic server
here I am using weblogic as a JMS server hope you know that weblogic provides JMS Server functionality also.
else you can use different server as well, but concept is same.

Step 1. setting up of JMS Server on weblogic

1. click on jms server >> summery of jms server>> new
2. type the name of jms server you desired, persistance store: either select if you have one or create new
3. persistance store is of two type file and jdbc, select file store as persistance store, which means your messages are
persisted in file. >>next
4. enter the name for file store, target is admin server since it is not cluster or managed server, also make of note
given on sever for directory
*The pathname to the directory on the file system where the file store is kept.
*This directory must exist on your system, so be sure to create it before completing this tab.
so create directory and enter the path. >>next
5. Console will come back to same page of step 3 select file store and click next.
6. select jms server target and click finish.

Setp 2 set up jms module

1.from the top again go to summery of jms services >>jms module>> new
2. enter name of the module,description, location in domain can be left blank, >> click next
3.select target as admin server>> next
4. select add resources to jms module >> click next.

step 3. Setup Connection Factory and Queue

in last step of 2 will create module and take you to resources page where you can define jms queue now.

1. Click new >> select Connection factory >> click next
2. Enter jms factory name and jndi name… that is only important now. subscription policy exclusive, clientid policy unrestricted
max message 10, xa conn.. unchecked
3.click next >>and select adminserver>> next/finish
4.You are back again on summary of resources page Click again on new >> select queue option >> next
5. Enter the queue name and its jndi name, template none>>click next
6.Click on create new subdeployment>> Enter the subdeployment name>>ok
7. select subdeployment >>target will be shown previously created jms server select and >>finish

with this we are finish with setting up jsm server and queue now we will create java provider class

I have attached the screen shots and sample example as link here.
jms-screenshots.doc
jms-screenshots.docx
BankAppSMSSender.java >> is a simple jms producer which generated message and post it on server
SMSProcesssor.java >> is the consumer which reads message from jms server and process it.

Soon I will write on them more...
















Wednesday, April 17, 2013

how to kill process that is runnung on perticular port in windows?

This has very handy information. sometime windows fails to kill process properly and it lefts the port running/open with that process.

  • To List the processes running on ports
    • netstat -a -o -n
  • Find the specific ip/prot you are looking for  and get the PID of it.
    • taskkill /F /PID




Tuesday, April 16, 2013

change local/language of admin console of weblogic

Hi We are doing migration of weblogic 10 to 12 and I suddenly noticed that weblogic default language was changed from english to Deutsch.
well I tried to search how is this behavior got changed and there is no way i found that how could i change it
mine is windows machine with default language setup set to Deutsch (german)  after digging for long time I could not reach to any conclusion how to change language setting for weblogic but I found interesting note about weblogic that weblogic uses browser  language setting, so I tried following
I open up Internet Explorer >>options>>General Settings>>presentation>> language>>
click on add button>> select english-US>> move it up as first preference if you have another language pre selected in list. save and apply.
thats it. and try to login again to weblogic console and you will see it now in english langauge.


Monday, April 8, 2013

javax.servlet.ServletException: java.lang.NoClassDefFoundError: javelin/jsp/JspFunctionMapper

Recently I come across above error on weblogic 12c migration project, since  for my test I used fexisting old ear that was built for weblogic 10.0.2 version. Later I found that this error has caused a problem because application is using pre-compiled jsps inside, I also noticed that weblogic 10.3.0  this jsp compilation has been depricated. so the solution was to remove the pre-compiled jsp classes from your war file or compile them again using weblogic 12c, I took a shortcut to remove classes and guess what, it failed again, since you must also know that who wants to use pre-complied jsps also use JSPClassServlet servlet to make sure that
weblogic at runtime should not try to recompile them and must always use pre-compiled. So that was additional task for me to remove this servlet and its mapping from web-inf to make sure my shortcut way should work.