Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp

Saurabh Agrawal

Ranch Hand
+ Follow
since Oct 07, 2003
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
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by Saurabh Agrawal

I have found the solution myself and would like to share it with the group.

In case we need to have a different source folder structure as opposed to maven project structure, we need to specify the the source directory under build tag in pom.xml as follows:



It will compile the code from the source directory.

Thanks.
Saurabh
4 years ago
Hi Saif,

Thanks for your reply.

As I mentioned in original post, the directory structure that we have in project is - src/com/panera/*.

In the configuration I posted, I tried giving value as "src" as well as "src/com/panera" but it still doesn't locate the source files.

I tried it again and still the same result.

Saurabh
4 years ago
I don't think that is a java limitation. Frameworks like sprint allow using point cut strategy to intercept each class and it's corresponding methods to print log messages.

I have used it in my past project using Spring. I wanted to see if we can do a similar thing in struts2 as well.

Saurabh
4 years ago
Hi,

I am using Maven 3.0 version to build my struts project which has the project hierarchy as follows:

src -> com -> myorg -> source files
webContent

When I am building the project using maven goal - mvn compiler:compile, it says build successful. However, it says no source files available for compilation.

I read that default src directory that maven searches for is src/main/java. However, I don't want to convert my project into maven way of organization as it is a struts 2 guideline of organization.

Is it possible to specify the source folder in the pom.xml. I tried few things but could not make it work.

My pom.xml looks like the following:



Quick help is much appreciated.

Saurabh
4 years ago
Is it possible to assign an object(DTO) to a hidden variable in Struts 2?

I tried doing the following:

<s:hidden value="%{addressDTO}" name="address" />

However, it fails throwing following exception:

Cannot create type class com.abc.dto.AddressDTO from value com.abc.dto.AddressDTO@c86b31 - [unknown location]
at com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter.convertValue(XWorkBasicConverter.java:126)
at com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter.convertValue(XWorkBasicConverter.java:120)
at com.opensymphony.xwork2.conversion.impl.XWorkConverter.convertValue(XWorkConverter.java:328)

2013-07-04 18:35:16 WARN OgnlValueStack:64 - Error setting expression 'address' with value '[Ljava.lang.String;@198d24d'
ognl.MethodFailedException: Method "setAddress" failed for object com.abc.action.InitiateOrderAction@1d1ca96 [java.lang.NoSuchMethodException: com.abc.action.InitiateOrderAction.setAddress([Ljava.lang.String;)]
at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1305)
at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:1494)


Looking at the above exception it seems that only string values can be assigned to a hidden variable. I was assuming objects can also be assigned to a hidden variable ?

Any thoughts ?

Saurabh
4 years ago
Hi,

I am trying to implement logging interceptor for all my classes that are invoked when user request is processed by the server.

The framework we have in place is as follows:

Action -> Service -> DAO -> Adapter -> 3rd Party API invocation.

When using struts interceptors, I implemented the logging. However, it only intercepts the action classes and prints the entry/exit of action classes. I want to extend this to ensure entry/exit of all methods are printed so that it helps me in debugging the code on production. However, it seems by default struts doesn't offer this.

Has anyone implemented such requirement ? If yes please share your learning.

Code snippet



4 years ago
I have worked on weblogic portal version 9.2 and it was based on JSR 168 specifications and it did support IPC. Which version of weblogic portal is based on JSR 286 specifications?

Saurabh
8 years ago
Hi Techies,

I am currently in process of evaluating different options for portlet development. The available options are:

- Portlet Factory
- RAD/RSA Toolkit for Portlet Development

Can anyone tell me which is the better option to use considering the pros/cons of each option? If somone has done any comparative analysis then please share the same.

Thanks in advance,
Saurabh
8 years ago
Hi Techies,

I am working on a web application built on fedeated portal architecture of Weblogic. Inorder to capture end to end user journey, I am using NDC (Nested Diagnostic Context) of LOG4J. However, it is not logging any information in the log files.

The code snippet is very simple -

NDC.push("Saurabh");

However, it is not logging the information in log files. I am using Apache Log4j for logging the information.

I haven't updated any property in log4j.xml as I can't see any such settings in the docs available on intranet.

Please can someone tell me wham am I missing in here? It is pretty simple one liner code which is not working.

Thanks in advance,
Saurabh

Originally posted by Ulf Dittmer:
Web service is the more general term. While "web" always implies "HTTP", the payload need not be XML (although it often is). Plain text or JSON might also be sent.

A subdivision of "XML over HTTP" is SOAP vs. REST.



Thanks. Does that mean it is safe to say that a webservice is XML over HTTP?
10 years ago
Hi All,

A very basic question but I am not clear that what is the difference between a Webservice and XML over HTTP?

Can someone elaborate this? i have checked the FAQ of webservices but could not find any answers there.

Many thanks in advance,

Saurabh
10 years ago
Hi,

I have developed a web based portal application using weblogic 9.2. I am facing few issues with it.

At times when user performs some activtities like searching for users, it throws a null pointer exception.

When i try to see the stack trace, it tells the class name but doesn't give me the line number in the method which caused exception. Instead it says UNKNOWN source.

I am confident there are no problems with the code by which NULL POINTER EXCEPTION can be thrown?

It is intermittent and not consistent Any ideas why it can happen and the solution to resolve this?

I am unable to trace the cause of this issue.

Any help will be highly appreciated.

Thanks in advance,
Saurabh
10 years ago
Hi,

I am using

PageURL postUrl = PageURL.createPageURL(getRequest(), getResponse());

postUrl.setPageLabel("test");

This should essentially forward to the test page of the PORTAL. Instead it forwards to the last page that was rendered.

Is this a known issue in weblogic ?? Please let me know as i am stuck at this point for quite sometime now.

Thanks in advance,
10 years ago
Hi All,

I have one issue which I would like to discuss it with you. If you have faced such issue please let me know.


From the login page of my application, I am taken to dashboard page which has link for Bills. I click on the bills link and I am presented with bill search page. Now I copy paste the URL of the browser which is as follows:


http://10.210.7.238:7001/abcPortalWeb/abcPortal.portal?_nfpb=true&_pageLabel=bills


What must happen?

I should be taken to the login page and I should be able to login to the application and taken to the same page whose URL is pasted above.

What is happening?
I am taken to the login page but it is distorted. When I login I am taken to the dashboard. Ideally I should be taken to the same page whose URL is pasted.

Can anyone guide my way why it is happening?

Thanks in advance,
11 years ago
Problem:

A (Login) --> B (Reset Password) --> A (Login)


Submitting details on Page A takes to Page B. Clicking a link on Page B takes back to Page A. Making a selection in the header of Page A refreshes the page to change the locale of the page.


What must happen?
Page A should be refreshed. Since the refresh action of the page is set as begin, so begin of all the portlets on the page should be called. Page A i.e. login page with changed locale should be displayed.



What is happening?
Begin of Page B (which is a previous page) is getting called up. Result: Reset Password page is getting rendered and displayed.


Possible Actions:
1. I checked the render Cacheable property of the portlets to check if it is set to true. I was of the impression due to portlet caching mechanism; the previous portlet is called again.

2. When I click the back link on Page B (taking me to page), I have modified the URL as follows:
<a href="/coltPortalWeb/coltPortal.portal?_nfls=false">

Assuming that _nfls will reset the page on which action is done.

Yet the previous page is getting rendered. I am not getting any clue on what can be other possible issue. May be some property of portlet is required to be set. If anyone has faced such issue, please let me know.



Note:

The application is developed using Weblogic Portal 9.2 with AndroMDA.

Any quick help in this regard will be much appreciated. If you need more information feel free to get back to me.
11 years ago