Michael Zellmann

+ Follow
since Dec 17, 2004
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by Michael Zellmann

Thanks - I think that works.
Actually, when I put the data folder under src,
InputStream is = loader.getResourceAsStream("data/comparisons.txt"); works -
but InputStream is = loader.getResourceAsStream("/data/comparisons.txt"); does not

I had the data folder at the top level of the project - it seems src is where it should be.
8 years ago
I am developing some applications in Eclipse that I want to deploy as Applets and Web-Start applications. They need to read data files in the deployment jar - not from the user's machine. I have a directory "data" at the top of my Eclipse project, containing several files - use "comparisons.txt" as a concrete example. In local development, I can read it within Eclipse using new FileReader("data/comparisons.txt"). When I go to deployment - I use a ClassLoader with getResourceAsStream - this works fine if I have the .java and .class files in the same directories.

However, if my Eclipse project is organized with separate bin and src folders, the above code fails. I have tried several variations, but they fail.
I thought the root of the project was the same, so the same approach would work, but I must be mistaken.

If it helps, I have attached a screen-shot showing the two Eclipse project structures - one labeled cs64_final fails as described above. The other, redistricting works fine.

What is the correct way to read the data files when src and bin are separate?
8 years ago
I am having trouble using a PreparedStatement to search for a record.
As an example, I have a table with fields name and namespace.
Usually the namespace is NULL, but lately we have some records with a specific namespace.
In the past I have used a PS with SELECT id FROM tagnames WHERE name = ?
That works fine.
Now I need to include the namespace - SELECT id FROM tagnames WHERE name = ? AND namespace = ?
If I have a name of Credit and namespace of abc, it works fine
However, there might also be a record with name of Credit, but namespace NULL
If I try ps.setNull(2, java.sql.Types.VARCHAR) the query doesn't get the result
I find I need to use a different query - SELECT id FROM tagnames WHERE name = ? AND namespace IS NULL
So - I need to test if the namespace is NULL and then use the alternate ps
What I would like is to have one ps that would handle both a NULL namespace and a specific namespace.

Is there any way to do this?
I want to dependably close the data base resources used in my application, despite exceptions. I also want to do this with sensible, clean code. The finally block seems critical, as well as avoiding duplication. Below is my current thought on how to do this, but I am not sure if it is good practice. I would welcome any suggestions from more experienced programmers.
I would like to compare two XML Documents to determine if they are equivalent. I am trying to rewrite software that crates the documents and want to see if I am achieving the same results as the former approach. I know my approach will have different white space and also a different order of attributes within an element. However, I want to assure that each node has the same parent, children and siblings, and that each element has the same attributes.

I can imagine writing my own code to traverse the tree and determine equivalence, but I was hoping there to use existing code to achieve this.

Is anything like this available ?
Sorry if this is basic, but I have scoured for an answer, without any luck. I am running Tomcat 5,5 on my home development machine with Windows XP using Java 1.5_011. I have a relatively simple Servlet where I am trying to log some information. I can't see where the log goes. I have left everything "plain vanilla" no changes to config or properties files in Tomcat or the JRE. I have in the Servlet
private Logger logger = Logger.getLogger(SearchSelect.class.getName());

the later within the doPost I have

Everything runs, but I can't find the log anywhere.

In Tomcat 5.5/logs, I have logs for admin, catalina, host-manager, jakarta-service, localhost, manager, stderr, stdout - each with a suffix for the current date. Nothing shows up in any of them. I have also looked in my home directory - for any *.log file in Documents and Settings - but nothing there either.

What can I do about this?
10 years ago
Thanks !
10 years ago
I know this has been asked before, and I have tried to read the answers and implement their suggestions, but I have not succeeded yet. I have Tomcat 5.5 running as a Windows Service. I am running Windows XP SP2, with 2GB or real memory. The Tomcat service is started automatically at system start-up, not from a Start menu. I need to increase the heap size. I have tried setting CATALINA_OPTS in the system environment variables. It is now CATALINA_OPTS=-Xms64m -Xmx256m However, when I look at Tomcat status, I see Free memory: 17.16 MB Total memory: 63.56 MB Max memory: 63.56 MB.

How can I increase the heap size?
10 years ago
In my application, a user has chosen a news feed from a list of options. I can get that chosen url into an action method or action listener. I want to open a new browser window on the client's machine and display the selected news feed there. I also want to show a refreshed page in the original browser window. I am not sure how to accomplish this. Any guidance would be appreciated.
10 years ago
Thanks for the reply. With your suggestion, I got it to work! Had to do some fiddling to get the href link and the title to work out. Also had to wrap it in a <h:form tag> even though I don't need any servlet handling.
10 years ago
I am new to JSF, and working on an application where the user is shown a DataTable of possible links. Each is represented in an <hutputLink component. When that link is chosen, the user sees the requested page in a new window - all behavior as intended. I want to implement a Listener that will capture what link the user chose. When I try to add a <f:actionListener type=... component, I get an error that an action listener can only be nested within a component that is a Faces ActionSource. (that make sense) However, the only components that do that are HtmlCommandButton, HtmlCommandLink and UICommand. I don't see how to accomplish what I am looking for. What can I do?
10 years ago
Thanks. I guess that is true. No nested jars. I unzipped the library jars and re-jarred everything and it works. I guess if I re-read the manifest instructions, class-path refers to the relative urls from which the main jar was downloaded. It isn't meant for "internal" library jars.
10 years ago
Thanks for getting back to me. I have tried that but still not successful. Here is my exact Manifest

Again, the three jars are in the lib directory in the jar

The first time the application tries to get a class from those libraries, I get a ClassNotFoundException.

If I put the jars in the jre/lib/ext directory, it works.

[ March 23, 2007: Message edited by: Michael Zellmann ]
[ March 23, 2007: Message edited by: Michael Zellmann ]
10 years ago
I have an application that I want to package into a single jar for deployment. I have read through other posts and solved my problems with data files by using the class loader and getRsourceAsStream(String path). Now I need to do soemthing similar with my supporting library jars. I have tried to include the class path information in the Manifest, but I am not successful.

Here are some specifics.

I have three jars - call them a.jar, b.jar and c.jar. I have them in a folder lib at the top level of my structure - same level as all the packages and folders in the application. The main class is common.Driver. My manifest declares

Main-Class: common.Driver
Class-Path: lib/a.jar;lib/b.jar;lib/c.jar

(there is a new line at the last entry)

I have everything jared into one jar - call it app.jar

Then I try

java -jar app.jar

But - this does not work. I get a ClassNotFoundException for the first class that is needed from the library jars.

If I take the three required jars and place them in my jre/lib/ext folder, everything works fine.

What is the correct way to do this?
10 years ago
Thanks for the replies. Now I understand the code tag and will use that in the future. I figured out the problems (by looking through the logs !) Tomcat logs hadn't been saying anything about my ch1 deployment and everything else that I expected to work was working, so I didn't read the entire log. It turns out that another app that I had tried to deploy didn't work, and it was still in webapps. Apparaently, everytime Tomcat would be started, it would load the other applications (from the Tomcat distribution), but when it got to my problem app, it had an exception because of missing class files. As a consequence, it "skipped inmstalling application listeners because of previous error(s)" I guess that meant it wouldn't pay attention to the ch1 deployment. I successfully deployed ch1 on my Glassfish, and on my public ISP, so I knew it worked. When I removed the other incorrect application from webvapps and Tomcat was able to start without exception, then ch1 worked fine.
10 years ago