Renjith Panikar

Ranch Hand
+ Follow
since Nov 06, 2012
Renjith likes ...
Java Spring
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 Renjith Panikar

I am pretty new to spring security & OAuth2. As a part of the learning I am trying to set up an OAuth2 Authorization server and protect a REST end point from unauthorized access.
But validation using OAuth2 roles is failing.

I have briefly explained my query in Stackoverflow.:

can anyone help me to resolve it?
1 week ago
I am novice in Angular 6 (more appropriately Angular > 1). I am basically trying to pull some data from Jenkins and present in on an Angular backed UI application.

At first, I followed the below tutorial to start with.

I ensured that I am able to access the "http://localhost:4200" after performing "ng serve".

To access Jenkins, I used Jenkins module from NPM.

Installed the same using npm install jenkins

Then modified the app.component.ts with the following code to pull information from Jenkins.

Then I tried to do an ng serve which resulted in the following error.

ERROR in ./node_modules/papi/lib/client.js Module not found: Error: Can't resolve 'http' in '\Study1Jenkins\node_modules\papi\lib' ERROR in ./node_modules/papi/lib/client.js Module not found: Error: Can't resolve 'https' in '\Study1Jenkins\node_modules\papi\lib' i 「wdm」: Failed to compile.

If somebody can give a hint on what has gone wrong, that will be really helpful.
Both are same if all the elements used in the soap message comes under the same targetNameSpace. (ie. if '' is your default namespace).

But in webservices it is a common practice to define the complex elements in an XSD. While creating the SOAP message, these elements should be have a prefix that refers to the targetNameSpace of that XSD.

For eg.
if the XSD that defines the complex element 'Employee' has a targetNameSpace "", SOAP message looks as given below.

Unless we prefix Employee element, the receiver will not be able to understand the 'Employee' element. Having prefix, receiver can relate it to the corresponding XSD and identify the element.
@Suraj Thanks for the reponse.Each bacth is independent of each other, as the execution order is not required. But it is denpendent in other way that all batches should execute successfully.
Did you mean to say that it is not advisable to execute bacthes in threads?

Or I have to go with Spring Batch?. If so what makes Spring Batch diffrent from ThreadPoolExecuter in Creating & Managing threads?
As mentioned in Saifuddin's post if 'batch features' are the only reason, will it be a good move if i go with 'ThreadPoolExecuter' ?
5 years ago
Our use case is simple. Split the records, update using multiple threads.
My thought was like, the commit will happen only after executing all the batch statements.
Since it is not so, some thing has to be done to rollback the update.
Another issue was the memory used by threads. If it can be controlled by ThreadPool, I am good.
Do you think it requires Spring Bacth implementation?
5 years ago
One more question.

What about using Spring's 'ThreadPoolTaskExecutor', there we can handle the Queue size?
Feels like it can handle the number of threads and there by restricting the memory usage. But database commit failure should be handled manually.
What's your thought?
5 years ago
Thanks Jayesh & Saifuddin.
That's lot of inputs for me. I started reading spring batch and left it halfway seeking for alternate technology, as i am not much familiar with Spring batch.
Now let me go back and see how spring batch can help me.
5 years ago
100000, is just a sample digit of the POC i am working on.
Actually it can go up to 4 Million. Each row will be having 30 fields.
Apologies, i dint communicated it properly.
5 years ago

a. List<String> splittedRecords = splitRecords(fullRecords); - should be outside the loop. you don't need to run it 10 times.

Sorry for the wrong naming convention. By 'splitRecords', i just mean a method that returns the sub List required for that particular iteration. Not a method that splits the 'fullRecords' on each iteration.

b. JDBC template is thread safe once instantiated.

You are right. That is one reason i kept the JdbcTemplate creation outside of all threads. But seems like the point given by Jayesh contradicts with this.

Note that the threads will not be able to share a transaction. Each thread will have tok open it's own connection to db and each connection will have its own transaction

@Jayesh By opening so much connection, is it possible that it can consume most of the connections in the DB2 connection pool?

@Saifuddin What's your thought? if we use a single JdbcTemplate, i think it will take the same amount of time as that of executing single batch at a time.

Thanks a lot for your valuable inputs. Most of them are valid. Some of them were in my mind when we decided to experiment with this approach.

5 years ago
Currently I am updating 100000 records to DB using jdbcTemplate bacth update. Each batch consists of 10000 records.
So i have to execute 10 batches in total. Is it a good practice to start each batch as a seperate thread?. Single JDBCTemplate instance
will be shared by all threds.

5 years ago
I am trying to execute a program in Z-OS machine, to write an excel report. Due to size of the Report, we are using SXSSFWorkbook to write the report.

One of the cell in the report is grey in color. So i have to apply Color to that cell. Used the following code to set the color.

But for the report generated, this cell is dark incolor. Out of curiocity, i checked the Styles.xml inside the excel document. Folowing is what i found.

<fill><patternFill patternType="solid"><fgColor rgb="ããâãâãâã"/></patternFill></fill>

I tried to generate the same report in Windows machine, it gave me correct result.

<fill><patternFill patternType="solid"><fgColor rgb="FFBFBFBF "/></patternFill>

Can any one help me to resolve this issue?
This one is resolved.

Used SAX + XSSF approach to read the data.
Created a class which represents the Sheet.
Instance of the above class is used to store the row data read using SAX.
Each instance will be having a errorDesc fields used for storing the error data.
once all the errors are captured, write whole data along with the errors to a predefined template using SXSSF.
Kept the window size as 1, so that it will keep only one row in memory.
That does the job. Little bit of effort is needed, but really effective.
5 years ago
Sorry for the very very late update on this thread, but better late than never.
I have resolved this issue. Hope if i share it, it will be helpful for some one else.

Thanks Ulf Dittmer, followign reply helped me to resolve it

Maybe open the file manually (xlsx files are just zip files containing various XML documents) and see if somewhere in there you find a sheet attribute that looks like "r:id"

In detail,

Rename the .xlsx file as .zip. It will give you a zip file. Open it and you will see a folder called "xl". Inside "xl" folder concentrate on the following things.

worksheets folder : contains the xml representation of each sheet.
sharedStrings.xml : Common place for storing all the string values across sheets.
styles.xml : common place for holding the styles(color, formula...) applied to cells.
workbook.xml : Contains the information about all sheets in the .xlsx file

Now start the journey from workbook.xm. Inside this file all sheets are covered in <sheets> tag.
sheets are represented as <sheet> Eg: <sheet name="General" sheetId="15" r:id="rId1"/>
Take r:id, that will help you to access the General.xml which represents the General sheet of .xlsx file.

Once you have r:id, will help you to read the XML file and get its contents.

SharedStringsTable sharedStringsTable = reader.getSharedStringsTable(); // using this we can access sharedStrings.xml
StylesTable stylesTable = reader.getStylesTable(); // using this we can access styles.xml

Since we are streaming the XML, we dont have to worry about memory consumption.

Sorry for giving the confusing information.
1 Million is the worst case.
In reality it can have an avg of 200000-300000 records.
.xlsx file is system generated.
User may not look into the entire records, instead he will edit only those he is interested in and uploads the file.

This one ( talks about creating a new excel file, not about editing it.
5 years ago