Sam Rakshit

Greenhorn
+ Follow
since Jun 22, 2010
Merit badge: grant badges
For More
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 Sam Rakshit

Hi,

I have a web application built on Struts2 framework. Lately, I have been using a custom filter which modifies the URL based on a pattern. This filter uses javax/servlet/http/HttpServletRequestWrapper to modify the url params. This filter works fine till now. But the moment I add the struts2-convention-plugin-2.1.8.1.jar into my WEB-INF/lib directory, I get the following error:

Could not load javax/servlet/http/HttpServletRequestWrapper.class - [unknown location]
at com.opensymphony.xwork2.util.finder.ClassFinder.readClassDef(ClassFinder.java:769)
at com.opensymphony.xwork2.util.finder.ClassFinder.access$400(ClassFinder.java:48)
at com.opensymphony.xwork2.util.finder.ClassFinder$InfoBuildingVisitor.extractSuperInterfaces(ClassFinder.java:814)
at com.opensymphony.xwork2.util.finder.ClassFinder$InfoBuildingVisitor.visit(ClassFinder.java:801)
at org.objectweb.asm.xwork.ClassReader.accept(Unknown Source)
at org.objectweb.asm.xwork.ClassReader.accept(Unknown Source)
at com.opensymphony.xwork2.util.finder.ClassFinder.readClassDef(ClassFinder.java:764)
at com.opensymphony.xwork2.util.finder.ClassFinder.<init>(ClassFinder.java:149)
at org.apache.struts2.convention.PackageBasedActionConfigBuilder.findActions(PackageBasedActionConfigBuilder.java:352)
at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildActionConfigs(PackageBasedActionConfigBuilder.java:317)
at org.apache.struts2.convention.ClasspathPackageProvider.loadPackages(ClasspathPackageProvider.java:53)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:204)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)
at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:190)
at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:662)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:224)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:185)
at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:146)
at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:222)
at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:171)
at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48)
at com.google.appengine.tools.development.DevAppServerMain.<init>(DevAppServerMain.java:120)
at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:96)

Actually I want to use the Rest Plugin for struts2, and that requires this jar. Please note that I am using Google AppEngine platform to run the web application. Could this be a problem?? But then how does the filter work when I am not using the convention plugin? Please help me to solve this issue!

Regards
Sam
13 years ago
http://www.java2s.com/Code/Java/Spring/AutoWiring.htm

google is a search engine used for such queries!!!
13 years ago
Hi,

We were trying to create access logs for our web application. Currently we are using the Spring Security 3 for authentication & authorization. We were able to get the DEBUG logs entries for all activities in the spring security framework. But, we want to generate logs which would allow us to view LogIn , Logout, Access Denied, entries customized for our needs. Also, we want the Log level to be INFO and not DEBUG for performance reasons. Is there any way we can do that in Spring? I was thinking of adding another Filter which would be invoked by the spring secirity filters after processing the request...But I am not sure if that is possible.

If anyone has already tried something similar, please help us with this.

Thanks
Sam
13 years ago

maggie joseph wrote:Hi,
I am a newbie in Struts 2...
i am trying to execute a Login.jsp and i am using eclipse as the development environment....i have stored the struts.xml in ApplicationResources.properties file......

but when i run the program i get....

There is no Action mapped for namespace / and action name . - [unknown location]
...
i went through previous links in javaranch which had same posts but even though i made changes like puttings struts.xml under WeB-InF dirrectory and all...my problem is not getting solved...thanks...



Try creating an action in struts which would have a result entry like :

<action name="start">
<result>/login.jsp</result>
</action>

Then try to direct your website to this location : http://localhost:8080/start

That should work if you are in Tomcat (change the port accordingly)

To make it the default page, make an entry of the /start in the <welcome-file-list> in web.xml

hope that helps!!!

13 years ago
How can I modify an already set response header?

This is required for an application which behaves like this -

Client C talks to server A in a different syntax and server A sends the request to server S ( struts2 server) . Now after a successful login, i am using a actionRedirect to take the user to the Home page whose URL is like this : http:/mywebserver.com/secure/home . So, struts2 sets the Location header to this URL. But, server A expects us to write the URL in the form >> Location: widget:secure/home or Location: http://mobileapp.com/secure/home

So, I want to edit the header by replacing the mywebserver.com with mobilesite.com and keep the rest of the value intact.

How can I do that in struts? what sort of interceptor I must use? Or is it possible at all?
13 years ago
Finally after following your advice, and the steps mentioned in this link - http://www.oracle.com/technology/pub/articles/dev2arch/2005/05/decorators.html

I created a servlet filter and overridden the getParameterMap() directly even before struts could start processing the request. I iterate through the keys and check of a .(dot) and remove it and populate another map with the parameter values and the sanitized keys. This is working for me now.

I hope this is a full proof solution. Please comment.
13 years ago

David Newton wrote:My first thought would be to modify the parameter names in a filter or interceptor--if you're not using these kinds of parameters across the application, an action-specific interceptor might be the cleanest solution. Or just don't process it with Struts--map it to a servlet instead (which could do whatever it needs to, and/or muck with the parameter names, and potentially forward to an action).

But yes--since S2 (and similar) frameworks will try to map parameter names to actual objects, things like this will cause a problem.



Pardon me for my ignorance as I am very new in Struts2. But will the interceptors be invoked even before the request parameters are parsed and set into the value stack? Also, can I use or override an existing interceptor like ParameterInterceptor for this?
13 years ago
Hi,

I am integrating a Yahoo Blueprint application with Struts2 and I end up getting the error

ognl.ParseException: Encountered " "." ". "" at line 1, column 1.

when this URL is called : http://mydomain.bpapps.com/public/login?.ts=1277027581&.intl=IN&.lang=en-in

I cannot modify the way the URL is set as this comes from the Yahoo Servers. What I can try is to configure Struts2 to ignore the parameters starting with .intl, .lang, .ts. But again, I will also need a way to access these parameters from my source code.

Can anyone help me with this? How do I solve this problem?

The complete stack trace of the exception follows :

com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn: Error setting expression '.intl' with value '[Ljava.lang.String;@83fde6'
ognl.ExpressionSyntaxException: Malformed OGNL expression: .intl [ognl.ParseException: Encountered " "." ". "" at line 1, column 1.
Was expecting one of:
":" ...
"not" ...
"+" ...
"-" ...
"~" ...
"!" ...
"(" ...
"true" ...
"false" ...
"null" ...
"#this" ...
"#root" ...
"#" ...
"[" ...
"{" ...
"@" ...
"new" ...
<IDENT> ...
<DYNAMIC_SUBSCRIPT> ...
"\'" ...
"`" ...
"\"" ...
<INT_LITERAL> ...
<FLT_LITERAL> ...
]
at ognl.Ognl.parseExpression(Ognl.java:112)
at com.opensymphony.xwork2.ognl.OgnlUtil.compile(OgnlUtil.java:214)
at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:198)
at com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:161)
at com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:149)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(ParametersInterceptor.java:276)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:187)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)
at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:97)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:35)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:238)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
at com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:76)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:135)
at com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:250)
at com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:5838)
at com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:5836)
at com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest(BlockingApplicationHandler.java:24)
at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:398)
at com.google.net.rpc.impl.Server$2.run(Server.java:852)
at com.google.tracing.LocalTraceSpanRunnable.run(LocalTraceSpanRunnable.java:56)
at com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan(LocalTraceSpanBuilder.java:576)
at com.google.net.rpc.impl.Server.startRpc(Server.java:807)
at com.google.net.rpc.impl.Server.processRequest(Server.java:369)
at com.google.net.rpc.impl.ServerConnection.messageReceived(ServerConnection.java:442)
at com.google.net.rpc.impl.RpcConnection.parseMessages(RpcConnection.java:319)
at com.google.net.rpc.impl.RpcConnection.dataReceived(RpcConnection.java:290)
at com.google.net.async.Connection.handleReadEvent(Connection.java:474)
at com.google.net.async.EventDispatcher.processNetworkEvents(EventDispatcher.java:831)
at com.google.net.async.EventDispatcher.internalLoop(EventDispatcher.java:207)
at com.google.net.async.EventDispatcher.loop(EventDispatcher.java:103)
at com.google.net.rpc.RpcService.runUntilServerShutdown(RpcService.java:251)
at com.google.apphosting.runtime.JavaRuntime$RpcRunnable.run(JavaRuntime.java:413)
at java.lang.Thread.run(Unknown Source)
Caused by: ognl.ParseException: Encountered " "." ". "" at line 1, column 1.
Was expecting one of:
":" ...
"not" ...
"+" ...
"-" ...
"~" ...
"!" ...
"(" ...
"true" ...
"false" ...
"null" .
13 years ago