Rich Raposa

Ranch Hand
+ Follow
since Dec 06, 2001
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 Rich Raposa

Make sure you are comfortable with Generics and polymorphism - both with the type of collection and the type of elements. For example, the following statement is valid because ArrayList is a List:



But the following doesn't work, even though a String is obviously an Object:



This topic is definitely on the exam - not sure how best to learn all the details except maybe by writing some code.
If that is the exact command you are typing, then you are getting an error because of the spaces in the folder names. Put the folder name in double quotes and that should help a lot.
12 years ago
I think it's as easy as putting the complete URL to the login page. Something like:

https://www.myhost.com/login.html

This is as opposed to just putting "/login.html" in web.xml.
15 years ago
You might need to define your docBase correctly. For example:

<?xml version='1.0' encoding='utf-8'?>
<Context docBase="C:/myapp_dir" path="/myapp" privileged="true">
</Context>

If you have JSP, just put it in the c:/myapp_dir directory and you should be able to access it from your browser similar to:

http://localhost:8080/myapp/hello.jsp
15 years ago
My experience with the admin app is that it is buggy at best! It can be useful at times and worthless at other times. For example, defining a database connection at the context level rarely works for me using the admin app - and I have done this dozens of times on different platforms and setups.

This might sound harsh, but my advice is to not use the admin app unless you really don't know what you are doing otherwise.
15 years ago
I suspect this topic has been discussed in detail before in a previous post, but I will give you a brief answer.
Keep in mind that writing a JSP is really just a convenient way of writing a Servlet. Your Web server converts the JSP into a Servlet and includes a service() method (actually named _jspService()). This method is invoked each time a request is made for your JSP. If multiple requests occur simultaneously, then the _jspService() is invoked in separate threads IF you have the isThreadSafe directive set to "true", which is the default behavior.
If you have a variable that has page scope, then it is likely being shared amongst clients. If your page-scoped bean can't be shared, then you want to declare isThreadSafe as "false". This causes the resulting Servlet to implement the SingleThreadModel interface, in which case the Web server ensures that the service() method is not invoked in multiple threads. How? By instantiating new Servlet objects when multiple requests occur simultaneoulsy.
I hope this helps.
[ July 29, 2003: Message edited by: Rich Raposa ]
17 years ago
JSP

Originally posted by Corey McGlone:

NO! Protected constructors are accessible ONLY from other classes within the package. Child classes outside that package CAN NOT access a protected constructor of the parent class.


Maybe this might clarify your statement above: another class in the same package has access to a protected constructor when instantiating the class using "new". A child class has access to a protected constructor when invoking that constructor using "super".
So the question now is: Can a child class instantiate a parent class using "new" on a protected constructor (assuming the child class is in a different package)? I would say no with 99.9% confidence, with a simple example proving my instinct.
Perhaps more importantly: is there ever a good reason for a child class to create an instance of its parent?
If a constructor is private, then it is only accessible from other constructors within the class (sounds a lot like a private field or method).
If a constructor is protected, then it is only accessible from other classes within the same package, or child classes (sounds a lot like a protected field or method).
Private and protected, as with the default access, have the same effect on constructors as they do on any other member of a class. You'll have a hard time getting a runtime error to occur, because the compiler is going to catch any mis-use of a private or protected constructor.
Your compiler errors are clearly related to classpath. I copy-and-pasted your code onto my PC, compiled and executed it with no problem.
Trust me here and perform the following steps:
1. Delete any bytecode (.class) files you currently have.
2. Enter the following from the command prompt:
javac -d . *.java
3. Type in the following:
set classpath=.;
4. Run the program:
java packagename.ClassName
That should do it!
Rich
17 years ago
Shashank,
Your code is perfectly fine. I'm not sure what your compiler error is, but I suspect it has something to do with either classpath or not having your .class file in the appropriate file structure.
Try this:
1. Delete the .class files (if you got one of them to compile successfully).
2. Compile both classes using the -d flag, and you can compile them at the same time. The command will look something like:
javac -d . *.java
3. To run the program, be sure to use the package name, as in:
java package1.package1class2
Your classes compiled and ran fine on my machine.
Good luck,
Rich
17 years ago
The use of URLs as a namespace is to be (somewhat) assured of a unique namespace. However, they do not have to resolve to an actual URL, so I'm not surprised you got a "page not found" response.
17 years ago
Did you start Tomcat? Is Tomcat running on your localhost or elsewhere?
17 years ago
To bind a MDB to a topic is often done using a deployment tool. Which J2EE application server are you using?