I just surprised that selenium rc 1.0.2 can’t launch firefox in snow leopard os. these all softwares are so famous in their fields. so it must be easy to solve this issue, but nope..
the problem is complicated, and i almost blow up my macbook’s hard drive by moving sqllite library..
there are many suggestions but none works. believe me, i try all. and this is the final solution that really works
http://jira.openqa.org/browse/SRC-743
there’s an attachment called snowleopard.patch file. you can apply it to the source of selenium-server.jar. and this can fix all the problem at once.
i have to generate some logs in struts 2 framework. i know the action classes include resource bundle feature by just using getText() method. but i can’t find how i use resource bundle outside of Action classes. just google it and get no reasult.
i didn’t give up and download xwork2.0.7. (yes, xwork!) struts2.0.x source doesn’t contain old xwork code. and finally found some classes about that. DefaultTextProvider and LocalizedTextUtil. DefaultTextProvider is just a wrapper of LocalizedTextUtil.
1
2
| TextProvider textProvider = DefaultTextProvider.INSTANCE;
log.info(textProvider.getText("some.property")); |
i have to use Locale.US for logging. so…
1
| LocalizedTextUtil.findDefaultText("some.property", Locale.US) |
struts 2 has many good features but lacks of manual.. anyway, we can do what we want. if you don’t care about reading sources.. good luck to you
i stuck some strange bug today. somewhat wierd error message showed when i tried to login with unauthorized account. it’s only a 403 situation. why i have to see this error messages?
java.lang.NullPointerException
org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:58)
org.apache.struts2.views.jsp.StrutsBodyTagSupport.getStack(StrutsBodyTagSupport .java:54)
org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport .java:49)
org.apache.jsp.WebContent.index_jsp._jspx_meth_s_005fhead_005f0(index_jsp.java: 155)
org.apache.jsp.WebContent.index_jsp._jspService(index_jsp.java:77)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at first, i thought it’s the problem of authentification. but that wasn’t. it’s because i use struts 2’s <s:if tag in my header.jsp. struts 2’s tags cannot be used in jsp directly. you have to use those with some actions. so my 403.jsp generates an error message for that. i change it to <c: and it works fine now.
i always wonder why struts 2 doesn’t provide well-made validation documents. and now i find that’s because there are well-made documents already. search opensymphony site not apache site. apache just give a hint about struts 2.
now i can do much better with struts 2. (am i too late?)
http://www.opensymphony.com/xwork/wikidocs/Validation%20Framework.html
P.S. Oh, i found real struts 2 validation page. why i can’t get it till now.. mysterious..
http://struts.apache.org/2.x/docs/validation.html
h2 is a cool java sql db. it’s quick and handy. but not stable as other (non-java) db solutions.
sometimes “Unique index or primary key violation” is occured. probably inserting data in multiple threads cause this (though i set single thread mode). it’s critical, you have to fix this manually, not automatically.
in h2’s official site, this procedure is not well explained. org.h2.tools.Recover and org.h2.tools.RunScript will fix this problem.
1. org.h2.tools.Recover will generate *.sql backup file.
2. delete broken db
3. run org.h2.tools.RunScript. you will face some sql error.
4. comment the parts in *.sql. delete db and run RunScript again and again.
if you have a critical data, you have to be careful to fix sql file.
i’m testing h2 database’s memory usage.. it costs too much memory when indexing tables.. i have to choose between search performace and memory usage.. good luck to me~
i faced some serious issues in h2 database, the h2 data saved in local file system are disapeared whenever tomcat is restarted only in window mode. i found easily that this problem is based on the db url parameter.
like this:
LOCK_MODE=0;LOG=0;MULTI_THREADED=1;DEFAULT_TABLE_TYPE=MEMORY;RECOVER=1;
ASSERT=0;CACHE_SIZE=200000;DEFAULT_LOCK_TIMEOUT=5000;TRACE_LEVEL_SYSTEM_OUT=0;
TRACE_LEVEL_FILE=0;LOCK_TIMEOUT=5000;
it’s tuned for fastest speed. and you know debugging is always a matter of choice. i choosed most suspicious options first. and test and test. but i can’t found till there left only one option, LOG=0, and finally i remove it, the program works so smoothly with no error..
i spend almost 2 hours for this simple test which would be ended in 10 mins. i know i’m an unlucky guy, i always have been. it will not be overcome soon..
i have to admit there’s no good embedded java sql file db actually. i tested h2 yesterday and h2 was good before the tuple was over 20,000. db access speed is scaled by O(n). and it showed heap error finally. aside the deadly critical table lock problem in concurrent situation, it cannot be used for real world db solution.
i know h2 is very good db, fastest and easy to use(with hibernate). i was impressed much. but when i need some db for embedded log system, h2 is not the product i have to adopt.
so there’s 3 ways to solve this problem.
1. use derby(is there any other file base sql java db?)
2. use berkeley db java edition, this is not sql base
3. use non-java sql file db
derby is too slow, and buggy.. berkeley db’s structure is very different and i have to redesign the entire or at least half of application. i’m not sure what is a good non-java sql file db. and non-java solution is also hard to maintain with servlet solution. there’s no time, so i have to decide asap.. good luck to me~
P.S. i found some good discussion about this topic
http://www.h2database.com/ipowerb/index.php?s=58737509ee010033b0743b7a55a6f957&showtopic=331&st=0&
it seems that postgresql is the best solution, though it’s not a java db. but, i may choose the 4th option. 4. find a way with h2 -_-;;
it’s a good to know document.
http://raibledesigns.com/rd/entry/ja_sig_comparing_java_web
i’m using struts2 now.. it has many cool and useful features, but no satisfiable amount of docs and no intutive coding style, especially ognl.. struts 2 uses ognl heavily. but the official ognl doc for struts is like this. http://struts.apache.org/2.0.8/docs/ognl.html
i think there’s no definitively good (i may say, perfect) framework in java scene now.. the only way to survive is to sacrifice the functionalities, and you don’t need to hesitate for that kind of decisions..
i need to deliver some parameter when redirecting in struts 2. it’s some what like this..
Action.java
Long id;
public Long getId() {
return this.id;
}
struts.xml
<action name="saveAction" class="Action" method="save">
<result name="success" type="redirect">
<param name="location">url.html?id=${id}</param>
<param name="parse">true</param>
<param name="encode">true</param>
</result>
</action>
and it fairly doens’t work.. like this..
url.html?id=com.cns:ips:war:2.0
what the hell!
i change it to this
Action.java
Long myId;
public Long getMyId() {
return this.myId;
}
struts.xml
<action name="saveAction" class="Action" method="save">
<result name="success" type="redirect">
<param name="location">url.html?id=${myId}</param>
<param name="parse">true</param>
<param name="encode">true</param>
</result>
</action>
and it works fine! please tell me how redirect works in struts? if struts 2 uses id as a reserved variable.. why can i get those documents? there’s so many mystery in struts and java world..
i found some trouble in hibernate, last night. hibernate annotation doesn’t support default value explicitly. you can use by implementing UserType interface. but, you know it’s not an annotation at all. there’s two workarounds to avoid this situation. first is making tables and model classes manually. use alter or create you know, this isn’t annotation but it doesn’t conflict annotation nor clumsy. 2nd is columnDefinition. this is an annotation and non-portable way to definite table. i don’t want to recommend it, either.
i choosed the first, manual way to solve my problem. but it’s very unpleasant to use non-authentic way when implementing basic functions. hibernate supports so many sql dbs. for that reason, basically hibernate provides minimum set of functions. and when you want more, there’s no way but to use workarounds.. and you know, workarounds are not documented well.. it’s a some kind of tragic..