ranjan Khaba

Greenhorn
+ Follow
since Jan 16, 2008
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 ranjan Khaba

Hi all,


Problem description:

Let's say there is an xml file called first.xml which contains some information about a device.
first.xml
name = test1
location = L2_first

In the next release, some more new parameter are introduce for the device.
To support the new device version, create a new xml file called second.xml
second.xml
name = test1
location = L3_second
size = 23
output = 5

Since the application has to support both the version of the same device, two xml files are maintained.
As we move on, we have to maintain many xml files which has almost same contain since the changes from one version to another version is very minimal.
Suppose if there is only one changes, even then we have to maintain different xml files.

What I want is something to have like mother.xml files.

mother.xml

<common parameter for all the version of a device>
common1 = same
common2 = same
common3 = same
....
</common parameter for all the version of a device>
<different parameter>
<version_0.0.0>
diff1=diff
diff2=diff
diff3=diff
</version_0.0.0>
<version_0.0.1>
diff1=diff
diff2=diff
diff3=diff
</version_0.0.1>
.................
..................
</different parameter>


And there are many device available.

So, in this current scenario, if there are 20 device with 5 version, then there are 100 xml files with almost same contains, maintaining this files is a nightmare.

Required:
The application is using java.
I would to develop a java API which will solve the above problem.

My suggestion:


An interface with API

Method signature: getDeviceXML( param1, param2)
param1 = device name
param2 = version no.
Return type = xml object


Method implementation:
1. Based on the device name read the xml file
2. Construct the xml file for the common parameter
3. Append the different parameter section of the version in the xml file.
4. Return the constructed xml version.

Please let me know if there is any improvement which can be done in the above design concept.
By doing this we can reduce the no. of xml files to 20.

Thanks,
Raj












I have two application based on JSF Say A and B. I am moving from one page of application A to another page of Application B. while
i perform a history.back operation from application B to A to go back on the previous page of Application A it gives a warning message "web page has expired". Browser back button also does not let me go back to the previous page of application A.

Can anybody give some suggestion for handling such scenerio?

Thanks in advance

Ranjan
13 years ago
JSF
Hi,
I try to used the Spring AOP in my demo application. I followed an example given in the link http://www.devx.com/Java/Article/30799/0/page/1 for the configuration and the logging interceptor, but when I deploy my war file in the Jboss application server; I got the below exception.
Can anybody help me where I did the mistake?


applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN/EN" "http://www.springframework.org/dtd/spring-beans.dtd" >
<beans default-autowire="byName">

<bean id="maintenanceServiceBean" class="org.springframework.aop.framework.ProxyFactoryBean">

<!-- Interface to be proxied -->
<property name="proxyInterfaces"><value>com.org.learning.demoLogic.DemoResult.IDemoResult</value></property>

<!-- Actual bean for which AOP proxy is to be created by Spring IoC -->
<property name="target">
<ref bean="demoResult"/>
</property>

<!-- A list of advices to be applied to the actual bean defined above -->
<property name="interceptorNames">
<list>
<value> theLogger </value>
</list>
</property>
</bean>
<bean id="theLogger" class="org.springframework.aop.support.RegexpMethodPointcutAdvisor">
<property name="advice">
<ref local=" loggingInterceptor "/>
</property>
<property name="patterns">
<value>.*getResult.*</value>
</property>
</bean>

<bean id=" demoResult " class="com.org.learning.demoLogic.DemoResult"/>
<bean id=" loggingInterceptor" class="com.org.learning.AOPLoggig.DemoLogging"/>


</beans>



org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'maintenanceServiceBean' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyAccessExceptionsException: PropertyAccessExceptionsException (1 errors); nested propertyAccessExceptions are: [org.springframework.beans.MethodInvocationException: Property 'proxyInterfaces' threw exception; nested exception is java.lang.ClassNotFoundException: com.org.learning.demoLogic.DemoResult.IDemoResult]
PropertyAccessExceptionsException (1 errors)
org.springframework.beans.MethodInvocationException: Property 'proxyInterfaces' threw exception; nested exception is java.lang.ClassNotFoundException: com.org.learning.demoLogic.DemoResult.IDemoResult
java.lang.ClassNotFoundException: com.org.learning.demoLogic.DemoResult.IDemoResult
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.springframework.aop.support.AopUtils.toInterfaceArray(AopUtils.java:144)
at org.springframework.aop.framework.ProxyFactoryBean.setProxyInterfaces(ProxyFactoryBean.java:154)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:814)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:716)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:850)
at org.springframework.beans.BeanWrapperImpl.setPropertyValues(BeanWrapperImpl.java:877)
at org.springframework.beans.BeanWrapperImpl.setPropertyValues(BeanWrapperImpl.java:866)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:901)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:707)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:316)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:146)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:271)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:310)
at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:133)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:230)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:156)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:48)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3856)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4361)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:790)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:770)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:553)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:296)
at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.apache.catalina.core.StandardContext.init(StandardContext.java:5312)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:296)
at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.web.tomcat.service.TomcatDeployer.performDeployInternal(TomcatDeployer.java:301)
at org.jboss.web.tomcat.service.TomcatDeployer.performDeploy(TomcatDeployer.java:104)
at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:375)
at org.jboss.web.WebModule.startModule(WebModule.java:83)
at org.jboss.web.WebModule.startService(WebModule.java:61)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:417)
at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy44.start(Unknown Source)
at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:466)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
at org.jboss.wsf.container.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:87)
at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy45.start(Unknown Source)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)

I am new to Spring AOP. If anybody know a good link from where I can start with.

My requiredment:
1. My project is having different module.
2. I need to used the Spring AOP for logging.
3. Will be good if I can get a working web based application example.

Thanks
Ranjan
I have search a lot and get some suggestion, but seems there is no proper solution.
Some give the suggestion regarding the
-multi part response ---IE has some limitation.
-Page refresh automaticcaly----cannot be used according to my requirement.
-sending two request-- so on.
Still, I am not able to find the correct solution according to my requirement. Is it a limitation.

One request - One Response

Thanks
ranjan
13 years ago
JSF
Thanks for reply,

The pop-up is not created by me, it comes because of the header "content- disposition" from the servlet. So I do not have the means to reload the page.

any sugggestion....

thanks
Ranjan
13 years ago
JSF
Thanks for the reply,

When I clicked the export button of the JSF page, the eventhandler method redirect it to a servlet, the servlet used the "content-disposition" Header. There for the pop-up for the csv file download comes up. My requiredment is I want to get my page refresh after the user clicked /open/save/cancel button. I am not able to relate with my requiredment and the solution provided above. Excuse me if I am not putting my problem properly.



thanks
Ranjan
13 years ago
JSF
Hi,
The web application has an export button which will download the csv file to the client machine (content-disposition). After completing the csv file download to the client machine, how can I refresh the JSF page. The file transfer is done by using the Servlet.

The logic to refresh the page automatically can not be used here because the user cannot perform any of the operation until the current operation is not completed.

Getting it as a response from the Servlet thread

https://coderanch.com/t/432961/JSF/java/JSF-page-refresh-after-csv

"You can send only one response per request.
Here you want to send two responses: one for the CSV file and another for the reload.
So you need to fire two requests. You can use Javascript to fire the another request."

Can anybody share some more info.



Thanks in advance,
Ranjan
13 years ago
JSF
Hi,

thanks for the response,

I need a clarification, firing two respnse means, I have to call a java script method to send a response from the servlet and response for writting the csv file.

I will be very happy, If you share me some link or some code snippet.

Thanks in advance,

Ranjan
13 years ago
JSF
My JSF project has a requirement to reload a page after an attachment is downloaded I am using a ServletOutputStream print method to write the CSV file. My requiremtn is first the pop up should come up and then the page should get refreshed.
The logic to refresh the page after some time cannot be implemented because the user is not allowed to perform any of the operation if the “current operation is not complete”.

Thanks in advance,
Ranjan
13 years ago
JSF
Thanks Mark.
The bean defined in the applicationContext.xml are loaded, Now In my job class which extends the QuartzJobBean, I can get the applicationContext from the JobExecutionContext which is passed in the executeInternal method.

I want to get the referrence of the class in the (Spring MVC) controller, which stored the information for the job.

there are certain solution provided in the net
http://cse-mjmcl.cse.bris.ac.uk/blog/2007/06/20/1182370280435.html

or we can write a class which is context aware and store the applicationContext by calling the getter and setter method.

As you said that, it is possible to get the reference, can you please elaborate or provide me some example.

Thanks in advance
Ranjan
Hi,

I have declared a bean in the applicationContext.xml file. The bean stored some data for the QuartzScheduler. I am using the Spring MVC, if I want to get the reference of the bean in the controller, how can I do it. Please give me a suggegstion.

Or is it possible to get the bean reference which is declared in the applicationContext.xml in the controller class.

thanks in advance


Ranjan
with lot of Analysis, below are the some important points.

Reason: - To dupe the problem, I have to do “Import” and “Restore” operation many time. The problem is intermittent and the log does not give proper information. The solution are trying based on below points.

1. Any stream which does not closed properly.
2. Any Thread issue.
3. Any variable setting and reading issue.

The ajax region is applied to only the status panel Grid. It is poll for every 3 seconds. It check the status for the backend job.
The ArrayList display in the datatable is not a part of ajax implementation.
The issue is getting during the “Restore” operation.



Probable Root cause: -

When I debug the code, the method to ge the ArrayList is invoke every three seconds, which should not be the case.

During the “Restore” operation the ArrayList is creating the issue [Related to point no 3]. This is the reason why “NoSuchElementException” is thrown.

If I can limit the implementation of the ajax to only the status panel grid, then the problem may be resolved.

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The code snippet of my JSF

<!-- AJAX for Generation status -->
<a4j:poll id="pollingTextArea"
reRender="generationStatus"
interval="3000" enabled="true" />

<!-- Generation status Panel-->
<h:panelGrid id="generationStatus" columns="2"
styleClass="explanatoryText">
<h:column>
<h:outputText value="#{bundle.generationStatus}:"/>
</h:column>

<h:column>
<h:outputText
value="#{EventHandler.generateStatus}"
styleClass="errorDetails">
</h:outputText>
</h:column>
</h:panelGrid>

<h:message id="errorMessage" for="upForm"
styleClass="error"/>



<%
/* Button bar */
%>
<n:searchResultsButtonBar

.................button declaration.....
/>

then data table handler which get the ArrayList. This part is being called for every two second. Only the method generationStatus should be called every three seconds.

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


thanks in advance
Ranjan

13 years ago
JSF
The Text pooling area is showing the status of a Job running a backend. The job information is getting from the Spring singleton bean.

the log does not contains any information about my classes. It prints NoSuchelementException.

Here is snippet of log.

at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:420)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.util.NoSuchElementException
at java.util.AbstractList$Itr.next(AbstractList.java:427)
at javax.faces.component._FacetsAndChildrenIterator.next(_FacetsAndChildrenIterator.java:56)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:626)
at javax.faces.component.UIForm.processValidators(UIForm.java:73)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:627)
at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:149)
at org.ajax4jsf.component.AjaxViewRoot.access$201(AjaxViewRoot.java:57)
at org.ajax4jsf.component.AjaxViewRoot$3.invokeRoot(AjaxViewRoot.java:319)
at org.ajax4jsf.context.JsfOneOneInvoker.invokeOnRegionOrRoot(JsfOneOneInvoker.java:56)
at org.ajax4jsf.context.AjaxContextImpl.invokeOnRegionOrRoot(AjaxContextImpl.java:170)
at org.ajax4jsf.component.AjaxViewRoot.processValidators(AjaxViewRoot.java:333)
at org.apache.myfaces.lifecycle.ProcessValidationsExecutor.execute(ProcessValidationsExecutor.java:32)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
... 40 more
13 years ago
JSF
No, there is no selectItem.

The JSF page has Ajax pooling Area, some button "import", "Restore"... and display a data table. There is no Ajax application to the dataTable part.


Thanks
Ranjan
13 years ago
JSF