Win a copy of Rust Web Development this week in the Other Languages forum!

Chris Beckey

Ranch Hand
+ Follow
since Jun 09, 2006
Chris likes ...
Eclipse IDE Tomcat Server
Baltimore, MD
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
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Chris Beckey

I believe that the build instructions with open SSL will tell you where the Linux libs end up after the build. On windows, they are in the out32dll directory under the root of the OpenSSL install directory. Are you sure you are getting a successful build? libeay is the OpenSSL library itself.
10 years ago
Try something like:

You may be missing the application context from the url, for example instead of
where "application-name" is replaced wit the name of your application (try the WAR file name if you don't know the application name).

If that isn't int, post the complete URL you are trying and the name of the application and the location of the html page within the WAR.
10 years ago
Pre-emptive apologies to all who knew this answer but ...
Just as FYI and to save anyone else the time to validate this themselves. I needed to determine if isAssignableFrom() and isInstance() took into account whether the subject classes (and objects) were loaded by different ClassLoader instances. The simple answer is yes. The same class loaded by two different ClassLoader instances will return FALSE for isAssignableFrom().

This is the code I used to validate it (three classes):

Resulting output is:

Loading 'us.happycat.classloader.JustAClass'
Loading 'java.lang.Object'
Loading 'us.happycat.classloader.JustAClass'
Loading 'java.lang.Object'
cl1 is us.happycat.classloader.SimpleClassLoader@42719c
cl2 is us.happycat.classloader.SimpleClassLoader@422ede
clazz1 is NOT assignable from clazz2
clazz2 is NOT assignable from clazz1
i1 is instance of clazz1
i2 is instance of clazz2
i1 is NOT instance of clazz2
i2 is NOT instance of clazz1

10 years ago
From what you have shown, and assuming that there are multiple threads and one user (i.e. desktop app), the answer is yes.
IMHO, they are just a PITA that makes it more difficult but hardly impossible to get useful source from class files. When a JAR is anything bigger that trivial, and I find obfuscated class files that I need to debug through, I look for an open-source alternative.
10 years ago
Especially in Tomcat it is not too difficult to implement your own Realm and Principal. You can stuff pretty much anything you need in the Principal derivation and access it using getUserPrincipal(). If you know that the Principal instance returned is of your type, just cast it and you can get to whatever you put into it.

In other words:
1.) Write your own Principal class that holds whatever data you want to have available (and that you have available to populate it with). If memory serves correct, this may have to derive from the existing Tomcat Principal class.
2.) Write your own Realm class (hint: copy the existing RDBMSRealm and make changes)
3.) Declare your Realm in server.xml
4.) In your application, call getUserPrincipal() and cast the result to your Principal derived class

Look at the Tomcat realm source code for the realms, unless you are doing DIGEST or CERTIFICATE authentication, you can forgo implementing a number of the authentication methods.
It's better to declare an interface that your Principal implements and cast to that. Keep the Tomcat specific stuff in a different JAR (project) so that your app does not become tied to Tomcat.
10 years ago
You have something completely wrong in your install. There is no "jar" directory under CATALINA_HOME, the jar files should be in the "lib" directory. CATALINA_HOME has bin, conf, lib, logs, webapp, and work directories. The "bin" directory has the batch files to start, stop and set the environment.
Step back and tell us how you installed, and what you did after the installation. In particular, what did you download (include the link) and where did you find the installation instructions (again, include the link)?
Installing Tomcat should be a 5 minute task. Run the installer (if on Windows) and then start it. If you are doing a lot more than that then you're making it too difficult.
10 years ago
Are you running "startup" or running "catalina start"?
Are you running it from the "bin" directory within the tomcat directory?
Check that there is a "lib" directory within tomcat and that at least the catalina.jar file is in there. The missing class is in that JAR.
If that file is there and you didn't modify it, and did not modify the server.xml file then the problem is in the startup, catalina or setenv batch files. Somewhere in there the CATALINA_HOME is either not getting set or is being set incorrectly. Try removing the "echo off" at the start of the files and see where CATALINA_HOME gets set to.
By the way, did you modify the server.xml file at all?

10 years ago
A few more details please.
ServerSocket.receive() will wait for input, java.nio.channels.SocketChannel can be used for asynchronous servicing of socket input when data is available.
You will need to narrow down the question quite a bit as the Calendar abstract class can be derived to implement any calendar type. You can search for Java Calendar implementation but if you need a specific calendar (Mayan, Hebrew, Arabic/Islamic, etc ...) you are better off searching for that specific implementation. This is one case where the Java docs ( are quite helpful.
10 years ago
The Tomcat libaries (jar files) are not available on the classpath. Where to look depends on whether you are starting Tomcat as a service or from a command line. If you are starting it as a service then try starting it from the command line and see if that works. If it doesn't work from the command line then trace through the startup script or batch file and look for the classpath settings (hint, search for CATALINA_HOME).
10 years ago
Containment may refer to the (excuse for an) OO concept of incorporating class functionality by keeping a private reference, implementing an interface that the referant implements and delegating calls to the referant. Those of you not having spent time in that pit of despair known as Visual Basic may be forgiven for not being familiar with this shoddy excuse for not implementing a real OO language with class derivation.
As always though, just my humble opinion...
10 years ago
Java applications start with a main() method, java applets do not, nor do server components (EJBs, servlets, etc ...) or anything else that lives within a framework.
If you are trying to follow a Java application, then the main() method will be in the Main-class, which will be referenced in the manifest file if the application is packaged as an executable JAR file. If the application is just one class then finding the main() method is trivial.
If you are looking at the majority of modern java code though it will be written to live within a framework, which may be called from a native executable or a Java application or called through a native lib or some other of dozens of possibilities. To understand the startup of everything but applications you need to understand the lifecycle of components as defined by the framework they live within (EJB, servlet, portlet, etc ...).

10 years ago