karthik Suryanarayanan

Ranch Hand
+ Follow
since Oct 07, 2009
karthik likes ...
Oracle Opera Java
Chennai,India
Cows and Likes
Cows
Total received
1
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
6
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by karthik Suryanarayanan

I am sorry for posting this under a different forum. Didnt check that and randomly created this post under that group.

karthik Suryanarayanan wrote:Hello Everyone,

I am trying to look for a solution for below problem. i have been checking Service Locator design pattern , and Dependncy Injection, But couldnt get it working.

We have 5 rest service endpoints and once each are triggered, they need to find the right DataProcessorBean and execute it. The problem is each method (or the code executing each endpoint) all has different signatures. (meaning different input parameters and different return type). This was how its designed already. And there is no common interface implementation.

/default - > triggers DefaultController - > Based on the input typeName  - > should find the correct DataProcessorBean for the input type name for the Default,
/validate - > triggers ValidateController - > Based on the input typeName  - > should find the correct DataProcessorBean for the input type name for the Validate,  

Default - > Has a list of beans defined under it.
Validate - > Has a list of beans defined under it.

InputType name can be same and based on the URL Endpoint, it has to fetch corresponding ProcessorBean.

So my requisite is based on inputType and the endpoint, i need to fetch the correct DataPrcoessorBean and execute it.

Currently, the code uses a registry and a Locator , but after upgrading from Spring 2 to Spring 5, I am getting below error. So i am trying to correct to a proper design.

Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.util.LinkedHashMap' to required type 'java.util.Map' for property 'dataProcessorMap'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'com.dataprocessors.impl.CDDProcessor' to required type 'com.dataprocessors.RestDataProcessor' for property 'dataProcessorMap[Check Receipt]': no matching editors or conversion strategy found
at org.springframework.beans.AbstractNestablePropertyAccessor.convertIfNecessary(AbstractNestablePropertyAccessor.java:595)
at org.springframework.beans.AbstractNestablePropertyAccessor.convertForProperty(AbstractNestablePropertyAccessor.java:609)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:219)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1738)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1694)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1434)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:601)
... 30 more
Caused by: java.lang.IllegalStateException: Cannot convert value of type 'com.dataprocessors.impl.CDDDataProcessor' to required type 'com.dataprocessors.RestDataProcessor' for property 'dataProcessorMap[Check Receipt]': no matching editors or conversion strategy found

Full code below.



Further info i will paste as needed.

Hello Everyone,

I am trying to look for a solution for below problem. i have been checking Service Locator design pattern , and Dependncy Injection, But couldnt get it working.

We have 5 rest service endpoints and once each are triggered, they need to find the right DataProcessorBean and execute it. The problem is each method (or the code executing each endpoint) all has different signatures. (meaning different input parameters and different return type). This was how its designed already. And there is no common interface implementation.

/default - > triggers DefaultController - > Based on the input typeName  - > should find the correct DataProcessorBean for the input type name for the Default,
/validate - > triggers ValidateController - > Based on the input typeName  - > should find the correct DataProcessorBean for the input type name for the Validate,  

Default - > Has a list of beans defined under it.
Validate - > Has a list of beans defined under it.

InputType name can be same and based on the URL Endpoint, it has to fetch corresponding ProcessorBean.

So my requisite is based on inputType and the endpoint, i need to fetch the correct DataPrcoessorBean and execute it.

Currently, the code uses a registry and a Locator , but after upgrading from Spring 2 to Spring 5, I am getting below error. So i am trying to correct to a proper design.

Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.util.LinkedHashMap' to required type 'java.util.Map' for property 'dataProcessorMap'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'com.dataprocessors.impl.CDDProcessor' to required type 'com.dataprocessors.RestDataProcessor' for property 'dataProcessorMap[Check Receipt]': no matching editors or conversion strategy found
at org.springframework.beans.AbstractNestablePropertyAccessor.convertIfNecessary(AbstractNestablePropertyAccessor.java:595)
at org.springframework.beans.AbstractNestablePropertyAccessor.convertForProperty(AbstractNestablePropertyAccessor.java:609)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:219)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1738)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1694)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1434)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:601)
... 30 more
Caused by: java.lang.IllegalStateException: Cannot convert value of type 'com.dataprocessors.impl.CDDDataProcessor' to required type 'com.dataprocessors.RestDataProcessor' for property 'dataProcessorMap[Check Receipt]': no matching editors or conversion strategy found

Full code below.



Further info i will paste as needed.
Hi Everyone,

I am building a maven project and bundling it into a war and finally an EAR file. I have angular code inside the war project under src/main/webapp/angular_dashboard as a web resource and under that i have a folder called dist which is needed inside the war.

When the build runs , the maven war plugin (version 2.6) does not include the dist folder inside the war file.
I tried to use warSourceIncludes and packagingIncludes , but doesnt seem to solve the case.

ANy suggestions ? If needed, i can post my entire maven project stucture here
1 year ago
Hi All,

I'm happy to be back to the ranch family. It's been long since i visited. And i'm back with a question.


I am building an executable jar with classpath entries in MANIFEST MF file using Java 8 ANT build. I am trying to run the jar in Linux server.

The problem is through the code when i use ResourceBundle , i need to refer to a property file that exists in a physical path in the server and not from within the jar file.

I have added property file with the path in the classpath entries as well, but when too many entries are specified, the MANIFEST MF file splits them into different lines which is not recognized by Linux server.

I have tried many solutions, but this doesnt work. Any help would be appreciated.. Thanks.
2 years ago
Hi Prasad,

i found the solution. The below is the solution.

The script file had issues since it is in Windows format and had to be converted to Unix/Linux format. Since there was an extra space at the end of the $2 argument, it was not loading the property file correctly.
I had to open the run script file in Notepad++ and remove all the CR carriage return characters and used only LF at the end of each line and save it in UTF-8 encoding format. Also have made code changes to trim the file name for any extra spaces and then load it.
3 years ago
Hi All,

Good to be back to Ranch and see you all.

I have a question here. I have a java application that runs in the Linux server.

There are 2 arguments to the program and the second argument is a property file which has to be loaded from the application. I am pretty confused on the below results.

Works and loads the file:

Doesnt work and gives error “We are getting error message (No such file or directory) "



Please let me know what could be the issue here and why these behave differently
3 years ago
I have a requirement where the Scheduler will call my program's main method and my program should then connect to the database, execute multiple procedures , get cursor data and then use them to create a PDF and then back again connecting to DB to update some tables. I need to create different types of PDFs. I need some suggestions on how i could achieve this effectively as per day the volume of PDFs would be very high.
3 years ago
Hi Guys,

I have one more question.

My application is having multiple web services and I am trying to write a common utility for logging the response data.

The response is a POJO of a particular class (different POJOs for each service) and has certain values like Status , Details ,etc.

I need to get those values and log it..

For ex)




This stands okay for a single POJO.

But since I have too many different types of POJOs , i thought of writing a common utility which takes care of logging the data.

Reflection was an option but it looks too costly. And as well , i guess for logging , it is never a right option as huge data would keep on coming.

Suggest me !!!

Thanks..







6 years ago
Ya Stephen,

Actually we are using Apache Axis (wsdl2Java) to generate the POJO classes from the web services.

This request is actually for logging purpose .

I thought of writing a Utility method where these values(status , details , etc) if present could be written on the log and could use it in all places.

For certain responses , we will get nested values. For some we wouldn't have it.



6 years ago
Hi Stephan,

Thanks for the reply. I would love using Optional but currently i'm restricted to use Java 1.6/1.7.

So looking for something within that.

6 years ago
Hi All,

Hope everyone is good.

I have a scenario where I have a web service response in XML mapped to a POJO object and returned.

This POJO object is having nested nodes.

I need to read a particular node value (which is in a inner level) and print it as a common value for all services.

Looks like the below.



I need to use null check at all places to access the values and the code looks ugly.



Also ,the POJO object does not have a method like fieldA.hasValue() which checks for the null condition.

I need to write a common utility for printing this data which is common for all web services.

I'm using Java 1.7.

Could someone explain is there any other Utility or library that I could use or how to achieve this ?

Thanks
Karthik S
6 years ago
Dear Paul,
Sure. I will do more analysis and post the results.
Dear Dave,
I finally found a solution. As you said , its not something to do with the q quote as it is unnecessary. The problem was with my String where the french data was in ISO-8859-1 encoding.

Hence , instead of passing my data directly for insert into DB , i did something like the below and it worked. Thanks !!!

Dave Tolls wrote:

And for SQLDeveloper.
When you do:
INSERT INTO MAIL_TBL (<snip other fields> OD_MAIL_BODY <snip other fields>) values ('âäàå')
do you get âäàå in the database?
And when you do:
INSERT INTO MAIL_TBL (<snip other fields> OD_MAIL_BODY <snip other fields>) values (q'[âäàå]')
do you get âäàå in the database?

I'm trying to see whether all the bases have been covered here.

.




Dear Dave,
Executing both the above insert queries through SQL Developer , the data gets inserted correctly in DB as âäàå .

I would like to know if there is any other way to insert the french characters correctly without using q quote (as it gets inserted correctly through SQL deveoper without q quote)or is there something to do with the JDBC driver.


Dave Tolls wrote:But that's all the Oracle Thin driver does.
Translate from UTF-16 to UTF-8.

You haven't shown what data is causing the problem.

And you use q' in SQL Developer, but when you don't use it it fails to insert correctly?




Dear Dave,
I have shared below on what data is passed and how it is getting stored without using q quote operator.

Passed Data

âäàå
ëèïéë

Data getting Stored in DB

âäàå
ëèïéë