Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

Satish Kandagadla

Greenhorn
+ Follow
since Jul 03, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Satish Kandagadla

Thank You!!

These were the mateiral I referred to
1) Exploring IBM SOA technology and practice by Bobby Woolf. An online version of the book is available in Tech Republic

2) All the SOA related Red papers from IBM.
http://www.redbooks.ibm.com/abstracts/redp4375.html
http://www.redbooks.ibm.com/abstracts/redp4376.html
http://www.redbooks.ibm.com/abstracts/redp4377.html
http://www.redbooks.ibm.com/abstracts/redp4378.html
http://www.redbooks.ibm.com/abstracts/redp4379.html
http://www.redbooks.ibm.com/abstracts/redp4380.html
http://www.redbooks.ibm.com/abstracts/redp4381.html
http://www.redbooks.ibm.com/abstracts/redp4382.html
http://www.redbooks.ibm.com/abstracts/redp4383.html
http://www.redbooks.ibm.com/abstracts/redp4384.html

3) Sample paper from yahoo groups on IBM SOA 667. Most questions were similar to the ones mentioned out in this sample.

4) Last but not the least - Java Ranch posts pointing me in the right direction.

Once again, Thank you Ranchers!!
Hi All,

I cleared IBM SOA 667 exam last weekend with 82%. Thanks to all the Java Ranch members who provided useful information to prepare for the exam.

Thanks,
Satish

Originally posted by Muktesh Tripathi:
My development structure is BeerV1.src.com.example.web.BeerSelect.java
and
BeerV1.src.com.example.model.BeerExpert.java

package com.example.model;
import java.util.*;

public class BeerExpert {
public List getBrands(String color){

List brands = new ArrayList();
if(color.equals("amber")){
brands.add("Jack Amber");
brands.add("Reb Moose");
}
else{
brands.add("Jail Pale Ale");
brands.add("Gout Scout");
}
return (brands);
}
}


package com.example.web;
import com.example.model.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;

public class BeerSelect extends HttpServlet {
public void doPost(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("Beer Selecion Advice<br>");
String c = request.getParameter("color");
BeerExpert be = new BeerExpert();
List result = be.getBrands(c);
Iterator it = result.iterator();
while(it.hasNext()){
out.print("<br> Try: "+it.next());
}
}
}

to compile BeerExpert.java cd BeerV1
javac -d classes src/com/example/model/BeerExpert.java

it lands .class file to right folder correctly.

but on compiling BeerSelect cd BeerV1
javac -classpath c:\servlet-api.jar -d classes src/com/example/web/BeerSelect.java
it shows package does not exist error....

please help



src is a source folder. In your class the package name starts with com.example.model. Change your directory to src and then try compiling. The error seems to be valid as src is a source folder.
11 years ago

Originally posted by Ulf Dittmer:
XPath makes it relatively easy to access the 2nd and 3rd occurrence directly, but it relies on the document structure not changing. SAX is more stable in the face of changing document structure.



Ok. But the possibility of using XPATH in my case is small as I would like to capture the names in Java Collections.

I think if I use Xquery I may probably do both (looking for occurrence and capturing it in collection). But I have already written a bunch of code in the parser and would like to add to it.

Thanks,
Satish

Originally posted by Paul Clapham:
How would you like to "differentiate" them? For example, do you want to know that they contain different text? Or do you want to know which comes first, second, and third? Whatever, you will have to start out by defining your requirements before you try to implement them.



I want to capture the text of the second and third occurrences of the Name tag. The sample that I pasted is just an extract. The original XML has tree structure which is huge.

I was planning to count the occurrences and then take out the text out of it. But I also wanted to check if there is any other way of doing it.

Thanks,
Satish
Hi All,

I have an XML with tags in the tree structure having similar name (Please see below). In the example below how can I differentiate the <Name tags> using a SAX parser?

<CategoryList>
<Category id="1900000021" >
<Name>Series</Name>
<CategoryList>
<Category>
<Name>ABC</Name>
<ForumList>
<Forum>
<Name>Test</Name>
</Forum>
</ForumList>
</Category>
</CategoryList>
</Category>
</CategoryList>

Is there a way to identify where does the Name tag belongs to in the tree structure?

Thanks,
Satish

Originally posted by Peter Johnson:
Try adding the directory containing the properties files to the classpath.



I tried adding the directory to the classpath while running the main class in the jar but still it does not find it.

<target name="run" depends="migration-jar">
<java fork="true" classname="${community-class}">
<arg value="c:/Forums.xml"/>
<classpath>
<path refid="build.classpath.id"/>
<path location="${jar.dir}/${ant.project.name}.jar"/>
<fileset dir="${properties.dir}">
<include name="*.*"/>
</fileset>
</classpath>
</java>
</target>
11 years ago

Originally posted by Shawn Montague:
check out the "fileset" tag...you should be able to use that to include files during compilation.



Well I need the files during run time. I can use fileset during compilation but that will not solve the problem of referring it during the execution.

I have tried this before and could not succeed.

Thanks for the reply.
11 years ago
Hi All,

I have an ant script which runs a standalone java class packaged in the jar. The jar needs to refer to some property files like log4j.properties, app.properties during run time. How can I run the jar file without packaging the properties in the jar and still refer to the property files?

The target below from the build.xml is where I want a reference of the properties -

<target name="run" depends="migration-jar">
<java fork="true" classname="${community-class}">
<arg value="c:/Forums.xml"/>
<classpath>
<path refid="build.classpath.id"/>
<path location="${jar.dir}/${ant.project.name}.jar"/>
</classpath>
</java>
</target>
11 years ago

Originally posted by Paul Clapham:
So, to sum it up and remove all the loosely-related background information: you have a String in Java and you want to remove the carriage-return characters from it? (No, there's no XML option for removing carriage-return characters via the parser.)

I will move this to the Java in General (Intermediate) forum. If you realize you already know the answer to my summed-up version of your question then you can go over there and post that.



If it is in java I could replace the carriage return character with an empty space using the replace method of the String class. I wanted to check if there is any parser option to do that but as per your mail we do not.

That answers my question. Thanks Paul.
11 years ago
Hi All,

I have an XML where the contents in the elements have carriage return characters which I want to ignore while parsing. I'm parsing the XML using SAX and the carriage return characters are obtained as is whenIi take that as a string in java.

I do not have a XSD/DTD to validate the XML but I still want to remove/ignore these characters. Any pointers will be helpful.

Thanks,
Satish
11 years ago

Originally posted by Paul Clapham:
Only well-formed documents are XML. But a SAX parser will process a document until it reaches a place where it sees a problem.

In my opinion you would be better off getting the people who are sending you garbage documents to fix those documents themselves.



Thanks Paul. Yes there are challenges in the project to get the XML from them but I see no other way in getting the proper XML apart from approaching them. My life will be lot easier if I get a well formed XML.

Originally posted by Paul Clapham:
You could do that with a SAX parser. Here is an example of how to use a SAX parser and a Locator to find the current parse location. Save the information and use it when the exception is thrown.

I assume this enormous malformed document is being generated by a computer program, and you're trying to fix that program?



Thanks for the Reply. The XML is from a product. I do not have access to how the product generates the XML. My intention is to figure out how many missing tags are there and then find out how to fix it.

Well the code that you pointed me to assumes that the xml is well formed or does it work on any XML?
[ November 19, 2008: Message edited by: Satish Kandagadla ]
Hi All,

I have a really huge XML which is not a well formed one.

Is there any way to find out exactly where it is not well formed by reading the file in java?

My file size is a 100 MB one and it eats up a lot of memory in opening through any XML editor. Moreover there are 2 million lines and editor for sure cant help. If I try to parse through any parser it will fail in the first step saying that it is not well formed. Any inputs would really help.

Thanks,
Satish

Originally posted by Jean Jorge Michel:
Satish, thanks for your attention.

I am new Spring�s user (of course hahaha), and this configuration is the result of hours and hours fighting with Spring and search on Google a silver bullet to save me.

Today on morning (now in Rio de Janeiro/Brazil is 10: 50AM) I tried:



And the problem is the same.

Let me show �all problem�.

I Start MySQL DB and log in, is created 2 connections.
When I start my Tomcat and do login my pool is initialized and is created three new connections.
After login my JSF navigation rule redirect the browser to home, this page search on DB my notes and show it in a table. In this point is created more three connections. Now I have 8 connections with MySQL.

My transaction management is ignored or my pool is crazy =)

Here is my codes.

First login flow.



Second home flow:



Some idea?

Thanks for all help.



I do not see anything wrong with the transaction beans. How are you saying that the transaction attributes are not working? What are you expecting from the annotations given in your application?