William Stafford

Ranch Hand
+ Follow
since Dec 13, 2004
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 William Stafford

I'm not sure I see the point of this game.

I post a question.

You think the question is so stupid or the answer is so obvious that instead of
1. actually answering the question
2. pointing to the docs that answer the question
3. giving any sort of useful advice
4. doing nothing

you reply RTFM. What's the point?
I ask a question because I want an answer.
You respond with a useless reply because you want to point out that, unlike yourself, I am an idiot who can't be
bothered to try to search for an answer before asking for help.

It seems like a huge presumption on your part and a complete waste of time for both of us.

13 years ago
I'm working on a web service and I want to sent the url for the help page in the header of every response.

I thought the Struts url tag would do the trick but it produces a relative url or at least that is what I see when I do the following:

url=<url namespace="/rest/list" action="help"/>

This tag usages produces url=/my-service/rest/list/help

Is there a way to get a url of the form http://<host name>/my-service/rest/list/help

I'm using struts tags in Freemarker so If there is a Freemarker tag that would suffice.
(and the actual syntax in Freemarker is <@s.url namespace="/rest/list" action="help"/>)

Thanks for any help or guidance,
-=beeky
13 years ago
Paul,
Thanks very much for the reply. Changing getDouble to getBigDecimal did the trick! I still can't figure out where the rounding was taking place but the problem is solved.

Thanks again,
-=beeky
I wrote a Java app to move lat,lon data from an Oracle table to a Postgres table. The app reads an Oracle row and uses the values to build an insert statement that is executed against the Postgres table. Both columns in both tables are defined as numeric.

The java code that replaces the prepared statement placeholder with an actual value is:
stmt.setDouble(placeHolderNum,rs.getDouble(columnIndex));

When I run the application values are truncated to 12 decimal digits, for example
113.26666666666667 value shown by System.out.println(rs.getDouble(columnIndex));
113.266666666667 value shown by select * from test_moveit_truncation after the move application was run

If I capture the prepared statement with System.out.println(stmt.toString()) I see an untruncated value in the statement
INSERT INTO test_moveit.test_moveit_truncation (lat,lon) VALUES (-7.766666666666667,113.26666666666667)

If I run this statement using the Postgres admin console the values are inserted without truncation.

I can't tell whats going on here, can anyone make sense of these results and figure out where the truncation is happening?

Thanks for any help or advice,

-=beeky
I'm getting the same error message when trying to start Tomcat 6 from Eclipse Galileo. However, if I start Tomcat with the startup command in <CATALINA_HOME>/bin it starts up normally with no complaints.

Is this an Eclipse or Tomcat (or both) issue?

-=b
Bear,
Thanks for the reply.

-=b
14 years ago
I'm trying to deploy a simple, one servlet, web service to Tomcat 6 and every attempt to invoke the service produces an HTTP 404 "The requested resource (/GetData) is not available."

my web.xml contains the following:
<servlet>
<servlet-name>DataProviderServlet</servlet-name>
<display-name>DataProviderServlet</display-name>
<servlet-class>org.mycompany.servlet.DataProvider</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>DataProviderServlet</servlet-name>
<url-pattern>/GetData</url-pattern>
</servlet-mapping>

After deployment my apps file system in Tomcat looks like:
apache-tomcat.6.0.24
webapps
DataProvider
WEB-INF
classes
org
mycompany
servlet
DataProviderServlet.class

I'm trying to invoke the service with http://localhost:8888/getData?...some params...

My servlet has an init method that writes some text to standard out and I do see this text during Tomcat startup so I'm sure Tomcat is finding the class, loading it and calling the init() method. And in my Tomcat.log I see:
INFO main org.apache.catalina.startup.HostConfig - Deploying web application directory DataProvider.


Can anyone spot what I've done wrong?

Thanks for any help and/or advice

-=beeky
14 years ago
I hope answering my own posting is an indication that I may know what I'm doing. I discovered that an environment variable was pointing to a different Tomcat instance! This is a big problem with hand-me-down computers. After setting CATALINA_HOME correctly I now see Tomcat.log as expected.

And no building of Tomcat is required. All I did was download the two jar files mentioned on the documentation page.

-= beeky
14 years ago
I have to correct my original posting. I'm not sure if Tomcat needs to be rebuilt. The instructions on http://tomcat.apache.org/tomcat-6.0-doc/logging.html are not clear but I think only downloading is required.

However, after downloading the juli extras and following the instructions on the page I do not see tomcat.log in <CATALINA_HOME>/logs. So I missed something.

Can anyone give me some advice on doing this? I'm at a loss as to what to try at this point.

Thanks for any help or advice,

-=beeky



14 years ago
log4j is the only type of logging I've ever used so that would be my preference. However, the config page for log4j is really confusing. It appears that to use log4j you must build Tomcat from scratch. This seems like a very error prone approach so I would consider the other form of logging.

Can anyone recommend one over the other?

-=beeky
14 years ago
William,
Thanks for the reply. As you suspected the web.xml was the problem. Actually the problem was that the WRONG web.xml had been deployed.

Thanks again for the reply.

-=beeky
14 years ago
I just installed the latest version of Tomcat (6.0.24) and when I run the startup.bat (on Windows XP) I get the following error message:

Feb 12, 2010 2:50:36 PM org.apache.catalina.startup.TldConfig lifecycleEvent
SEVERE: Error processing TLD files for context path /DataProvider
javax.servlet.ServletException: Exception processing TLD at resource path /WEB-I
NF/c.tld in context /DataProvider
at org.apache.catalina.startup.TldConfig.tldScanTld(TldConfig.java:543)
at org.apache.catalina.startup.TldConfig.execute(TldConfig.java:299)
at org.apache.catalina.startup.TldConfig.lifecycleEvent(TldConfig.java:7
39) ... lots more eliminated for brevity

My app is DataProvider but it is a Servlet based web service and does not have any TLD files. It also has no JSPs and no tags at all.

Could someone explain what the message is referring to? Do I need a local copy of c.tld?

I'm mystified, any help or guidance would be appreciated.

Thanks,
-=beeky
14 years ago
I don't believe there is a general solution. In some simple cases you can accomplish what seems like passing an object when the text in the query string is used to create a local object. Integers for example can work like this.

The most common way of accomplishing object passing is to put the object in the session (or some appropriate scope) and pass the key in your query string.

Hope this helps,
-=beeky
14 years ago
Ulf,
Thanks for the reply. At this point I'm not completely sure what I want to do but as you said "... stream the KML to the client and have Google Earth start there" seems like the best solution for the requirements of this feature.

Previously we just allowed a download of the KML file but the decision makers have decided that a better solution would be to have a link that results in Google Earth starting on the client and displaying the KML file constructed by the Servlet.

Thanks again for the informative reply,
-=beeky
14 years ago
For our Servlet-based application we need to build a kml file and start Google Earth from a Servlet.

I know how to generate the kml file but I'm not sure of how to:

1. start Google Earth from a Servlet. Has anyone done this?

2. manage the temporary kml files. Is there a way to give files a limited lifetime or is there a Java file cleanup 'utility' that can be part of a servlet based application?

Thanks for any help or advice,

-=beeky
14 years ago