Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!

Gabriele Fabbri

Ranch Hand
+ Follow
since Dec 05, 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 Gabriele Fabbri

Gregg Bolinger wrote:Generally, if an object is populated the select tag will display the selected element based on the object's value, if things are mapped correctly. Can you show us a bit of the code to look over?



Unfortunately I cannot post any code at the moment because I'm working on a different machine.
In any case, this is the situation:

I have a very simple object News that contains several properties like Title, Text, etc...
In the actionbean that forward to the form to edit the news I create a List of NewsCategories, that is used in the jsp to populate the select field.
This field is used to move the News I'm editing to a different News Category. Obviously the News I'm editing is already related with a category (this information is stored in the newsCat property of the News object).
I would like that if the current News is child of the NewsCat with Id 2, the same value is marked as selected in the select form field.
Am I working in the wrong way for some reason?

Thanks,
Gabriele Fabbri
Hi,

I have a select form field generated using Stripes' taglib.
It's mapped to a List of objects generated inside the ActionBean.
Everything is working fine, but I can't understand if it is possible to fix the field to a specific value if it correspond to the value of a property of the current object.
I'm looking at the reference but there are no attributes that sound useful for this.

Thank you,
Gabriele Fabbri

Bear Bibeault wrote:You should always develop on the same version of Tomcat that you are deploying upon. The different versions support different versions of the Servlets, JSP and JSTL.

That said, let's see if we can find what's up. How are you declaring the web.xml deployment descriptor?



Thanks to both for the fast reply!
Bear, you are totally right. I don't want to loose other time to make it works: it's time to update tomcat installed on the web server.
I will do it as soon as possible and I will come back to you in case the problem will still present (but probably not!).

Thanks again,
Gabriele Fabbri
12 years ago
JSP
Hi,

I just deployed on the remote server an application that is working perfectly on my laptop, but not on the remote machine.
The problem is that expressions like ${news.titolo} are not translated: on the rendered page I'm getting exactly ${news.titolo} instead the real value.
I think I'm simply missing one or more jar file: I already tried moving el.jar into the shared tomcat dir but nothing is changed.
The main differences between the two environment are the OS (Win locally and Debian remotely) and the tomcat version (6.0.14 locally and 5.5 remotely).
Could you let me know which jars I have to manage to get it works properly?

Thank you in advance,
Gabriele Fabbri
12 years ago
JSP
Ok.

Thank you very much Ulf, I will check this issue!

Gabriele Fabbri

Ulf Dittmer wrote:Sounds like the remote machine is running with a more restrictive SecurityManager than your local machine. Is that maybe a machine that came pre-configured at a hosting provider?



Hi Ulf,
thank you for your reply.

I'm the owner of the remote server, and Tomcat has been installed and configured by my systemist, but he is not [yet] expert about Tomcat.
Could you give me some advice on how to change this too restrictive configuration?

Many thanks,
Gabriele Fabbri
Hi,

I tried deploying my Stipes test application on the remote server (I'm the owner of the remote machine), but the application doesn't start.
Looking at the stack trace in the Tomcat log it seems to be a problem related with some privileges and permission.

This is the stack trace:

SEVERE: Exception starting filter StripesFilter
net.sourceforge.stripes.exception.StripesRuntimeException: Problem instantiating default configuration objects.

at net.sourceforge.stripes.config.DefaultConfiguration.init(DefaultConfiguration.java:220)
at net.sourceforge.stripes.config.RuntimeConfiguration.init(RuntimeConfiguration.java:272)
at net.sourceforge.stripes.controller.StripesFilter.init(StripesFilter.java:125)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:223)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:304)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:77)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3634)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4217)
at org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1175)
at org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:530)
at org.apache.catalina.manager.HTMLManagerServlet.doGet(HTMLManagerServlet.java:104)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:245)
at org.apache.catalina.core.ApplicationFilterChain.access$0(ApplicationFilterChain.java:177)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:156)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:152)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
at java.security.AccessController.checkPermission(AccessController.java:546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.lang.SecurityManager.checkMemberAccess(SecurityManager.java:1662)
at java.lang.Class.checkMemberAccess(Class.java:2157)
at java.lang.Class.getDeclaredMethods(Class.java:1790)
at net.sourceforge.stripes.controller.AnnotatedClassActionResolver.processMethods(AnnotatedClassActionResolver.java:218)
at net.sourceforge.stripes.controller.AnnotatedClassActionResolver.processMethods(AnnotatedClassActionResolver.java:215)
at net.sourceforge.stripes.controller.AnnotatedClassActionResolver.processMethods(AnnotatedClassActionResolver.java:215)
at net.sourceforge.stripes.controller.AnnotatedClassActionResolver.processMethods(AnnotatedClassActionResolver.java:215)
at net.sourceforge.stripes.controller.AnnotatedClassActionResolver.addActionBean(AnnotatedClassActionResolver.java:146)
at net.sourceforge.stripes.controller.AnnotatedClassActionResolver.init(AnnotatedClassActionResolver.java:116)
at net.sourceforge.stripes.controller.NameBasedActionResolver.init(NameBasedActionResolver.java:125)
at net.sourceforge.stripes.config.DefaultConfiguration.init(DefaultConfiguration.java:121)


Do you have any idea how to solve this?
The only difference between the local and the remote environment is the Tomcat version: 6 local, 5.5 remote.

Thanks,
Gabriele Fabbri
Puah!
I solved the problem, and it was a very stupid mistake in the end.
The problem was in the form, I wrote <stripes:errors/> but the correct prefix is "s" not "stripes".
It works fine now.

Gabriele
Hi,

I added a @ValidateNestedProperties validation inside an action bean, setting some properties as required.
When I submit the not-filled form I don't get the error messages in the jsp as aspected: it goes back to the form but errors are not displayed.
In the past I did some test using @Validate for simple validation on non-object properties fields and it worked fine... there is something different in this case?

This is the jsp form:


This is the ActionBean:


And this is the model class:

Ulf Dittmer wrote:8MB of disk space is not worth thinking about for even one minute (so unless you have 100000 instances...).

Memory consumption is something to think about, but Stripes is fairly small, and so probably not worthy of optimizations in this regard. That said, the cos.jar and commons-logging.jar libraries can probably go into the common directory without problems.



And what about Hibernate? It's quite huge (16 jars, more than 5Mb). I would like to have it shared, but if you suggest to keep it inside the application dir I trust you...

Thanks,
Gabriele Fabbri

Ulf Dittmer wrote:Seriously, you shouldn't do that. What if some other web app needs to use a different version of any of these libraries? What was wrong with keeping the Stripes jar in WEB-INF/lib to begin with?



Yes, in fact this is my doubt.
I mean, I'm planning to have several instances of the same application on the server, and I don't want to have 8Mb of libraries duplicated for each of them.
I thought that a possible solution was to move those libraries into the tomcat lib directory, but you are right: it can happen that in some month I will develop a new version of the app. using an updated version of Stripes or Hibernate (and it can be that it is not backward compatible...).
So, what I should do?

Thanks,
Gabriele
Finally I moved ALL the jar files from the application's lib directory to the Tomcat lib.
I was missing the cos.jar, but at the end I moved Hibernate libs and jstl jars as well.
Yes, I solved the problem.
I forgot to move some other jar files that were apparently needed.

Thanks,
Gabriele Fabbri
Is it possible to put the stripes.jar inside the Tomcat common lib directory?
I moved the stripes.jar and commons-logging.jar files in that dir and setup everything as I did for other libraries, like for example the JDBC Connector.
The application is not deployed in tomcat, it's compiled but not deployed.
I also tried moving the stripersist libraries but I'm still getting the same.
Is it mandatory to have stripes jar file inside the application lib dir?

Thanks,
Gabriele Fabbri
Ok, I solved the problem.

I just added another hidden field in the form jsp and then I put getter and setter in the ServizioBaseActionBean class.
It works perfectly now!

Gabriele