Joe Gilvary

Ranch Hand
+ Follow
since May 11, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Joe Gilvary

It's a brittle solution, but you can write something else to preprocess the file to strip away the "garbage" and produce a valid XML output. The XML classes in Java pretty much expect to find valid XML in their inputs.

If you can't change the process to avoid the prepended characters but you can detect some rhyme or reason to them, you can make this approach more robust.
Hi,

We're converting our project layout to use Maven and I'm running into some difficulties. I can't seem to find clear, comprehensive documentation on the Maven WAR plugin, so I'm hoping someone here can share some expertise.

Does the WAR plug-in generate the web.xml file? I ask because I keep getting errors related to the content of an <env-entry> element even after I have corrected the issue in the sources from my "resources" directory.

In the WAR created by Maven (building on Win32) I have both a "web-inf" and a "WEB-INF" directory. When I deploy to Unix, these are going to be separate directories, unless the SUN Appserver8 is a lot smarter about deploying than I have a right to expect it to be. When I search the sources (again, on Win32) I can't find a directory that uses the lower-case name, and that's why I'm wondering if the WAR plug-in is doing some sleight of hand. I know that Win32 might be showing me the "wrong" filename, but it shows only uppercase "WEB-INF" in all the sources.

BTW, does anyone know where the actual spec for the content and format of the WAR file is? I had believed that the spec calls for the use of "WEB-INF" in all capitals, but I can't confirm that by checking the latest J2EE and Servlet specs.

Thanks for any and all help with these questions,

Joe
17 years ago
I found this thread:

https://coderanch.com/t/374496/java/java/send-byte-array

here, so I figure this is the approriate forum.

I am using the org.apache.xerces.impl.dv.util.Base64. More precisely, I am trying to use it. I have tried all the combinations I can imagine to get my digest bytes into it, finally resorting to simply creating a new byte[] as a test.

This is what javac thinks of my test:

Any ideas what is going on here? I know that I don't find a String where byte[] is required in that code.

I'm compiling with JDK 1.4.2_06 on XP.

I'm limited in my choices for a Base64 encoder, due to an arduous process for getting third party code approved for deployment. I may just write one myself, but I'd still like to know why I get this compilation error.

Thanks,

Joe
18 years ago
Hi,

I have an intermittent error from a null pointer in a generated SOAP serializer classes. Despite the warning posted at the top of the source, I went ahead and edited the class, recompiled, massaged it into my EAR and redeployed. I can see the stack traces that incriminate the null pointer for the times when it does occur (and it doesn't always), but I can't use Log4j, System.out, or even throwing new Error() to get any details about what exactly is null those times when the failure occurs.

The application runs on SunONE Java System App Server v72004Q2. Anyone have any ideas how I can get the details out when the error occurs? The stack traces don't show what was null, just a series of exceptions.

Thanks,

Joe
19 years ago

Originally posted by Ben Souther:
Just don't pass the JSESSIONID header and the server will treat each request as a new session.

Thanks, Ben.

I didn't give you enough information. I don't want every request to be a new session. I want every thread to have an individual session for its use over several requests. Each thread should pull data from the backend to the client, possibly modify it, and send it back through the web app to the persistent store. To look more like the real world, each thread should access different records. Currently they step on one another's requests because they're all in a single session.

Thanks,

Joe
19 years ago
I've searched in this forum to see if anyone has worked through something like this before. I see a lot of people working on ways to prevent multiple simuultaneous accesses by a single client, but that is just what I want to create.

I want to use a multi threaded client to simulate load on a web app. The application stores some persistent data in the session. Each thread will request different information to model real world behavior more closely.

The problem is that the app server sees each thread as the same client (via cookies) coming from the same process on the same machine and subsequently lets them step all over one another's session-stored data.

I need to fix this on the client side. The purpose is testing the web app we will deploy, not changing the app to something we can more easily test. The real world clients are locked down and will use cookies, so URL rewriting is testing something besides what we will deploy.

I know I can use separate JVMs instead of threads, but then I need more hardware to simulate the same load. I prefer threading if I can find such a solution.

TIA,

Joe
19 years ago
Amy,
I think if you write your own toString() method for the Requirement class and have it return the value of name you'll get the behavior you seek.
Thanks,
Joe
21 years ago
One way would be to move through the String checking the 3 character substring that begins in index 0, then the one that begins in index 1, then the one that begins in index 2, and so on.
Another way would be to move through the String looking for the first letter of the substring, and if you find it, compare the next index in the string to the second character of the substring, and so on.
There are lots of ways to do something like this. I hope one of these suggestions helps you get started.
Thanks,
Joe
21 years ago
They're not basically the same to the compiler, because it doesn't look at all of the work in the m2() call and say, "Gee, this is always throwing a new RuntimeException, so the finally block overrides the call from inside the catch block." It says something more like, "The finally block does not explicitly throw an exception, so the possible exceptions in the catch block method invocations need to be declared."
You can read the code and "mentally inline" the m2() call inside the finally block, but the compiler doesn't. It sees a finally block that makes a method invocation, but doesn't "notice" what that method invocation must do.

Thanks,
Joe
Please forgive me if I'm being dense, but when your jar is on the classpath, can you not call UIManager.setLookAndFeel(packages.to.Kunststoff.KLookAndFeel) or some such? I have never built a custom look and feel, so maybe I just don't understand the problem.
If you have to have the ClassLoader, try getClass().getClassLoader() and use that to load the L&F class directly. If the classpath setting is insufficient to make the classes visible, try using the util.jar.JarFile to read a stream of bytes and ClassLoader.defineClass() from that.
Thanks,
Joe
21 years ago
The exception occurs when doing the layout, and it's a ClassCastException. I think you need to write your own TableCellRenderer to display your dat and cname objects because they are not the kinds of objects that JTable knows how to display by default, e.g., String, Boolean, or Number.
HTH,
Joe
21 years ago
Check the Linux Network Administrator book, online at http://www.tldp.org/LDP/nag2/index.html or available in hard copy from O'Reilly. Everything you'll need to know to get started is in there.
HTH,
Joe
21 years ago
Why wouldn't you just put the jar on the classpath to access the classes?
Joe
21 years ago
Your code example is confusing to me. Is JTree1 the JTree or is it an implementation of TreeModel? You call setSelectionPath() and nodeStructureChanged() on the same object. Are you subclassing JTree and implementing TreeModel yourself in a single class? Implementing TreeModel is a lot of work.
I have used setSelectionPath() successfully in a mouse listener without needing to call the SelectionEventListener from there at all. I think it's unusual to have to call that method yourself.
I've been able to add nodes to a JTree with code like this:

(The loader persists menu structure data back to a database. myModel is an instance of DefaultTreeModel. xfer is declared Transferable and cast to my own class after it passes the transfer flavor checks.)
The O'Reilly "Swing" book and their "Java Foundation Classes in a Nutshell" were a lot of help to me with this stuff. Well worth the money, especially if you will be doing more of this kind of work.
HTH,
Joe
21 years ago