Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!

Ankit Tripathi

Ranch Hand
+ Follow
since Oct 17, 2009
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ankit Tripathi

I have two tables which contain some data :

Table1 : abc

||entity_id| entity_title| cust_code| cust_acc_no ||

|| AB101Z | IND | 101Z | 1234 ||

|| AB101Z | PAK | 101Z | 1357 ||

|| CD101Y | IND | 101Y | 2468 ||

|| EF101X | IND | 101X | 3579 ||

|| JK201N | LKO | 201N | 5678 ||

Table2 : def

||entity_title| in_count| out_quant||

|| IND | 10 | 7 |

|| LKO | 7 | 7 |

|| PAK | 5 | 2 |

joined Table : abcdef

||entity_id| entity_title| cust_code||

|| AB101Z | INDPAK | 101Z |

|| CD101Y | INDPAK | 101Y |

|| EF101X | INDPAK | 101X |

I want to join tables abc and def which would be resultant in table abcdef.While joining both tables and records would be grouped by entity_title
The joining condition would be such that in_count!=out_count.
For ex. in such situation LKO as entity_title would not be part of resultant table and I need to replace the entity_title records with matching condition by a third record signifying a matched record,for ex. INDPAK is the replacement for both IND and PAK entities on which condition is satisfying.
I tried to come up with a solution but was not able to form a single query.Thanks in advance for any solution suggested.

Hi Joe,

I got it working finally.... ...thanks
But with one glitch ....when I am refreshing the page and even if there is no record in database,automatically last inserted row is displayed..not sure why?
and why I haven't got any error when my setters/getters were not in camel case.
Thanks for your help so far
6 years ago
I can see in logs that these methods are not being invoked in my action class(

Apart from above I can sniff that commentorList.size() is throwing a null pointer exception while execution of commentor.jsp:

2014-06-11 19:59:27,744 [ACTIVE] ExecuteThread: '12' for queue: 'weblogic.kernel.Default (self-tuning)' DEBUG ognl.OgnlValueStack - Caught an exception while evaluating expression 'commentorList.size()>0' against value stack
java.lang.NullPointerException: target is null for method size
at ognl.OgnlRuntime.callMethod(
at ognl.ASTMethod.getValueBody(
at ognl.SimpleNode.evaluateGetValueBody(
at ognl.SimpleNode.getValue(
at ognl.ASTChain.getValueBody(
at ognl.SimpleNode.evaluateGetValueBody(
at ognl.SimpleNode.getValue(
at ognl.ASTGreater.getValueBody(
at ognl.SimpleNode.evaluateGetValueBody(
at ognl.SimpleNode.getValue(
at ognl.Ognl.getValue(
at com.opensymphony.xwork2.ognl.OgnlUtil.getValue(
at com.opensymphony.xwork2.ognl.OgnlValueStack.getValue(
at com.opensymphony.xwork2.ognl.OgnlValueStack.tryFindValue(
at com.opensymphony.xwork2.ognl.OgnlValueStack.tryFindValueWhenExpressionIsNotNull(
at com.opensymphony.xwork2.ognl.OgnlValueStack.findValue(
at org.apache.struts2.components.Component.findValue(
at org.apache.struts2.components.If.start(
at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(
at jsp_servlet.__commentor._jsp__tag4(
at jsp_servlet.__commentor._jspService(

6 years ago
Thanks for your response..

Do I have to define these setter and getter for list in my entity class?

6 years ago
What problem you are facing exactly.Have you even tried that?

In your JSP will have to invoke your captcha servlet as image source something like below :

and will have to map corresponding servlet in your deployment descriptor(web.xml) something like below :

check the url pattern in servlet-mapping tag. it should match with src attribute of your img tag.

6 years ago
Hi all,

I have followed a tutorial(struts2,spring and hibernate integration)(set of code snippets) on a website and tried to develop below example according to my needs but I am not able to see appropriated details in view(JSP).

Even after referring to original resource and many other resources I am not able to figure out the issue.

I have copied/attached code snippets and screen-shot of view(JSP) below : Entity Class) Action Class)

CommentorBoImpl(Service class implementing interface CommentorBo)

CommentorDAOImpl(DAO class implementing CommentorDAO interface)

Commentor.hbm.xml(Hibernate mapping file)

commentor.jsp(Struts view page(same page is being returned on either adding or listing the commentors))

attached below(first screen-shot) is screen-shot when I am trying to access the application first time(without adding a commentor).

second screen-shot is of page which used to appear after you have entered details and hit submit button.It can be seen that action url has been changed(from listCommentor.action to addCommentor.action).

But I am not able to see the list of commentors which are already been added.

I can see that arraylist is not empty from logs and can confirm that details are being inserted in database properly but not able to display over JSP(commentor.jsp)

Could you please give me an idea..

Also please let me know in case I would have to add other config files(struts,spring) to problem posted.

6 years ago
Hi Claude,

I tried to update GUI in separate thread as suggested by you and it seems that finally I got things working.Thanks for same.Below is the modified code :

attached herein are the screen-shot of GUI for one of the interfaces

and below is the output for packet data from console for same interface

PacketCapture: loading native library jpcap.. ok
packetList []
Received packet ([UDPPacket: -> l=8,101])
Received packet ([UDPPacket: -> l=8,287])
Received packet ([TCPPacket: -> ack[0x33454c6d] psh l=20,58])
Received packet ([EthernetPacket: c0:18:85:7b:41:b2 -> 33:33:00:01:00:02 proto=0x86dd l=14])
Received packet ([TCPPacket: -> ack[0x73c7a825] l=20,0])
Received packet ([EthernetPacket: c0:18:85:7b:41:b2 -> 33:33:00:01:00:02 proto=0x86dd l=14])
Received packet ([UDPPacket: -> l=8,103])
Received packet ([UDPPacket: -> l=8,289])
Received packet ([UDPPacket: -> l=8,49])
Received packet ([UDPPacket: -> l=8,67])
tlen 525
tlen 525
tlen 525
tlen 525

But still I can see three problems/questions here :

1. Why there is no data in ArrayList packetList still

2. Why I am not seeing any ups and downs and spikes in graph as its moving.Value of packet length(tlen) is also indicating the same.

3. I think I am not able to see my wifi interface in interface selection drop-down menu which is Broadcom 4313GN 802.1 b/g/n 1x1 Wi-Fi Adapter{4d36e972-e325-11ce-bfc1-08002be10318} so unable to capture traffic from same

Please refer screen-shots at end of page. Thin straight red line in first screen-shot is showing network traffic after selection of interface in second screen-shot.
6 years ago
But still not able to understand because from console I can see that required dll and jars are loading correctly.It should give linkage error if any problem is there as I have got during initial set-ups
6 years ago
Yes,Jpcap is an opensource networking library.Thanks for your response...
6 years ago
Hi People,

Thanks for your responses so far!
I have tried to print network packet over console using below code :

This code is either printing all the network interfaces in your system or printing network packet across console if you are providing name of any of interfaces available explicitly.Outputs in both the conditions are given below :

Available network devices on your machine:
PacketCapture: loading native library jpcap.. ok
Realtek PCIe GBE Family Controller
Bluetooth PAN Driver

PacketCapture: loading native library jpcap.. ok
Using device '\Device\NPF_{BBA1CB68-B3FA-4CE9-8610-F402EEA70DEE}'
In PacketHandler class
Capturing packets...

In second output I am not able to see network packets at all no matter how much time I am going to wait.(You can increase and decrease value of waiting time by altering the value of variable INFINITE.INFINITE=-1 means program will never terminate)

So from message I can see that native library(jpcap.dll) is loading perfectly which has been kept in C:\Windows\System32.But it's also clear that packetArrived() method declared in PacketListener(Provided by jpcap.jar file) interface is not being defind by my class PacketHandlerC.

Not sure why this is not working!
6 years ago
I was able to open the network device and was able to print raw network data over the console before adding the chart to application but its more looking like a problem related to networking.
6 years ago
Hi Claude,
Thanks for your reply.
I tried to print packet data over console as in packetArrived() method.Its not working as well.
6 years ago

I am trying to develop an application which will be showing a TimeSeries graph(related library JFreeChart) displaying network activity related to a particular network interface embedded in a JFrame.I have created a JPopUpMenu which is having containing a list of JMenuItems showing network interfaces as their String values.Menu is popping up correctly

Further I am selecting a JMenuItem related to a particular network interface to show network activity in TimeSeries graph.On selecting a JMenuItem I can see that graph is moving on constantly but not able to see any network activity.

Pasted the code below :

Futher I can see that packetArrived method of PacketListener is not being overridden by class PacketHandler as I am not able to see data packets on console and static list in main class is also empty.

Please help me out regarding same.


6 years ago
Hi Tsang,


2.CaptchaServlet is called as image source in register.jsp for which URL mapping in web.xml is given as "captcha".

7 years ago
Session value in hidden field is being updated but always previous request value is coming in it.Not able to figure out why...
7 years ago