Retrieve tomcat information in your servlet
I have set a startup variable in CATALINA_OPTS, however i'm not very sure that it's actually been set and that tomcat has the variable.
Is there a way to display such things in a servlet? Retrieve tomcat information? Get all variables, tomcat version, ... ...
(in php there is a function called phpinfo() which displays a whole lot of information, is there an equivalent in java servlets/jsp?)
Thanks in advance
javax.servlet.ServletConfig
javax.servlet.ServletContext
java.lang.System.getProperties()
There may also be vendor-specific (e.g. Tomcat) classes to obtain more information, but that should at least get you started.
- Saish
Similar Messages
-
Tomcat crashes while running servlet chat in IE
Hi all!
I've seen similar problems posted about three years ago, but I didn't see an answer for it.
I'd be very grateful if you could help me.
I'm writing a chat, the code was taken from the J.Hunter "Servlet programming book" O'reilly, "absurdly simple chat", and adjusted (I only need the Http version). It's an applet-servlet chat.
When executed in IE, Tomcat crashes after a few (usually 5) sent messages. When executed in a debugger (I use Forte, the last available version, 4 update 1) the program works just fine...
Another question is about debugging an applet, executed in a browser - how do I do this?
Here is the code for the servlet:
=================================
import java.io.*;
import java.net.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class TryChatServlet extends HttpServlet
// source acts as the distributor of new messages
MessageSource source = new MessageSource();
// doGet() returns the next message. It blocks until there is one.
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
res.setContentType("text/plain");
PrintWriter out = res.getWriter();
// Return the next message (blocking)
out.println(getNextMessage());
// doPost() accepts a new message and broadcasts it to all
// the currently listening HTTP and socket clients.
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
// Accept the new message as the "message" parameter
String message = req.getParameter("message");
// Broadcast it to all listening clients
if (message != null) broadcastMessage(message);
// Set the status code to indicate there will be no response
res.setStatus(res.SC_NO_CONTENT);
// getNextMessage() returns the next new message.
// It blocks until there is one.
public String getNextMessage() {
// Create a message sink to wait for a new message from the
// message source.
return new MessageSink().getNextMessage(source);
// broadcastMessage() informs all currently listening clients that there
// is a new message. Causes all calls to getNextMessage() to unblock.
public void broadcastMessage(String message) {
// Send the message to all the HTTP-connected clients by giving the
// message to the message source
source.sendMessage(message);
// MessageSource acts as the source for new messages.
// Clients interested in receiving new messages can
// observe this object.
class MessageSource extends Observable {
public void sendMessage(String message) {
setChanged();
notifyObservers(message);
// MessageSink acts as the receiver of new messages.
// It listens to the source.
class MessageSink implements Observer {
String message = null; // set by update() and read by getNextMessage()
// Called by the message source when it gets a new message
synchronized public void update(Observable o, Object arg) {
// Get the new message
message = (String)arg;
// Wake up our waiting thread
notify();
// Gets the next message sent out from the message source
synchronized public String getNextMessage(MessageSource source) {
// Tell source we want to be told about new messages
source.addObserver(this);
// Wait until our update() method receives a message
while (message == null) {
try { wait(); } catch (Exception ignored) { }
// Tell source to stop telling us about new messages
source.deleteObserver(this);
// Now return the message we received
// But first set the message instance variable to null
// so update() and getNextMessage() can be called again.
String messageCopy = message;
message = null;
return messageCopy;
=============================
The code for the applet is
=============================
import java.applet.*;
import java.awt.*;
import java.io.*;
import java.net.*;
import java.util.*;
public class TryChatApplet extends Applet implements Runnable {
TextArea text;
Label label;
TextField input;
Thread thread;
String user;
public void init() {
// Check if this applet was loaded directly from the filesystem.
// If so, explain to the user that this applet needs to be loaded
// from a server in order to communicate with that server's servlets.
URL codebase = getCodeBase();
if (!"http".equals(codebase.getProtocol())) {
System.out.println();
System.out.println("*** Whoops! ***");
System.out.println("This applet must be loaded from a web server.");
System.out.println("Please try again, this time fetching the HTML");
System.out.println("file containing this servlet as");
System.out.println("\"http://server:port/file.html\".");
System.out.println();
System.exit(1); // Works only from appletviewer
// Browsers throw an exception and muddle on
// Get this user's name from an applet parameter set by the servlet
// We could just ask the user, but this demonstrates a
// form of servlet->applet communication.
user = getParameter("user");
if (user == null) user = "anonymous";
// Set up the user interface...
// On top, a large TextArea showing what everyone's saying.
// Underneath, a labeled TextField to accept this user's input.
text = new TextArea();
text.setEditable(false);
label = new Label("Say something: ");
input = new TextField();
input.setEditable(true);
setLayout(new BorderLayout());
Panel panel = new Panel();
panel.setLayout(new BorderLayout());
add("Center", text);
add("South", panel);
panel.add("West", label);
panel.add("Center", input);
public void start() {
thread = new Thread(this);
thread.start();
String getNextMessage() {
String nextMessage = null;
while (nextMessage == null) {
try {
URL url = new URL(getCodeBase(), "/servlet/TryChatServlet");
HttpMessage msg = new HttpMessage(url);
InputStream in = msg.sendGetMessage();
DataInputStream data = new DataInputStream(
new BufferedInputStream(in));
nextMessage = data.readLine();
catch (SocketException e) {
// Can't connect to host, report it and wait before trying again
System.out.println("Can't connect to host: " + e.getMessage());
try { Thread.sleep(5000); } catch (InterruptedException ignored) { }
catch (FileNotFoundException e) {
// Servlet doesn't exist, report it and wait before trying again
System.out.println("Resource not found: " + e.getMessage());
try { Thread.sleep(5000); } catch (InterruptedException ignored) { }
catch (Exception e) {
// Some other problem, report it and wait before trying again
System.out.println("General exception: " +
e.getClass().getName() + ": " + e.getMessage());
try { Thread.sleep(1000); } catch (InterruptedException ignored) { }
return nextMessage + "\n";
public void run() {
while (true) {
text.appendText(getNextMessage());
public void stop() {
thread.stop();
thread = null;
void broadcastMessage(String message) {
message = user + ": " + message; // Pre-pend the speaker's name
try {
URL url = new URL(getCodeBase(), "/servlet/TryChatServlet");
HttpMessage msg = new HttpMessage(url);
Properties props = new Properties();
props.put("message", message);
msg.sendPostMessage(props);
catch (SocketException e) {
// Can't connect to host, report it and abandon the broadcast
System.out.println("Can't connect to host: " + e.getMessage());
catch (FileNotFoundException e) {
// Servlet doesn't exist, report it and abandon the broadcast
System.out.println("Resource not found: " + e.getMessage());
catch (Exception e) {
// Some other problem, report it and abandon the broadcast
System.out.println("General exception: " +
e.getClass().getName() + ": " + e.getMessage());
public boolean handleEvent(Event event) {
switch (event.id) {
case Event.ACTION_EVENT:
if (event.target == input) {
broadcastMessage(input.getText());
input.setText("");
return true;
return false;
=====================================
HttpMessage
======================================
import java.io.*;
import java.net.*;
import java.util.*;
public class HttpMessage {
URL servlet = null;
String args = null;
public HttpMessage(URL servlet) {
this.servlet = servlet;
// Performs a GET request to the previously given servlet
// with no query string.
public InputStream sendGetMessage() throws IOException {
return sendGetMessage(null);
// Performs a GET request to the previously given servlet.
// Builds a query string from the supplied Properties list.
public InputStream sendGetMessage(Properties args) throws IOException {
String argString = ""; // default
if (args != null) {
argString = "?" + toEncodedString(args);
URL url = new URL(servlet.toExternalForm() + argString);
// Turn off caching
URLConnection con = url.openConnection();
con.setUseCaches(false);
return con.getInputStream();
// Performs a POST request to the previously given servlet
// with no query string.
public InputStream sendPostMessage() throws IOException {
return sendPostMessage(null);
// Performs a POST request to the previously given servlet.
// Builds post data from the supplied Properties list.
public InputStream sendPostMessage(Properties args) throws IOException {
String argString = ""; // default
if (args != null) {
argString = toEncodedString(args); // notice no "?"
URLConnection con = servlet.openConnection();
// Prepare for both input and output
con.setDoInput(true);
con.setDoOutput(true);
// Turn off caching
con.setUseCaches(false);
// Work around a Netscape bug
con.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");
// Write the arguments as post data
DataOutputStream out = new DataOutputStream(con.getOutputStream());
out.writeBytes(argString);
out.flush();
out.close();
return con.getInputStream();
// Converts a Properties list to a URL-encoded query string
private String toEncodedString(Properties args) {
StringBuffer buf = new StringBuffer();
Enumeration names = args.propertyNames();
while (names.hasMoreElements()) {
String name = (String) names.nextElement();
String value = args.getProperty(name);
buf.append(URLEncoder.encode(name) + "=" + URLEncoder.encode(value));
if (names.hasMoreElements()) buf.append("&");
return buf.toString();
Those files are the only files needed to execute the program.The whole Tomcat crashes, and no exception
displayed.
Do I have to write the log file, or it's kept by
Tomcat itself?yes, tomcat writes a log file, you find it in the tomcat dir. but it's just very highlevel. Having a look in it could help.
Is there a way to write a log file by myself?sure. you could get the log file from tomcat by getting it from the ServletContext:
ServletContext = getServletContext();
ServletContext.log("text to log");
When I view the output window in Forte, it doesn't
even write that Tomcat crashed.
I use Tomcat that is installed with the last version
of Forte(Sun 1 Studio, update 1), I guess it's the
last version of Tomcat also.No. The lastest is 4.1.12 and i guess it's 4.0.4 with forte.
Get Tomcat standalone from jakarta.apache.org and try to run your servlet with the standalone tomcat. this could help since i also expirenced problems sometimes with the forte-integrated tomcat. -
Bought a new 4s and need to transfer photos from iCloud to new device. iCloud is giving me an old @me address. I do not have the email or pw for the iCloud account. How do I retrieve this information? Thanks.
If you need to change the iCloud ID on your new phone you have to go to Settings>iCloud, tap Delete Account, provide the password for the old ID when prompted to turn off Find My iPhone, then sign back in with the ID you wish to use. If you don't know the password for your old ID, or if it isn't accepted, go to https://appleid.apple.com, click Manage my Apple ID and sign in with your current iCloud ID. Click edit next to the primary email account, change it back to your old email address and save the change. Then edit the name of the account to change it back to your old email address. You can now use your current password to turn off Find My iPhone on your device, even though it prompts you for the password for your old account ID. Then save any photo stream photos that you wish to keep to your camera roll. When finished go to Settings>iCloud, tap Delete Account and choose Delete from My iDevice when prompted (your iCloud data will still be in iCloud). Next, go back to https://appleid.apple.com and change your primary email address and iCloud ID name back to the way it was. Now you can go to Settings>iCloud and sign in with your current iCloud ID and password.
-
I set up Firefox sync from my old computer. This has had its hard drive replaced and been sold. I now want to retrieve the information and get my bookmarks on my new computer. I can't see any way to do this!
Help pleaseTo build on the second option provided by The Edmeister make sure that you have your Sync Key, if this is not the case Firefox Sync will not help you (data is encrypted with that Key).
Finally, if the last sync happened long time ago, it may be the case that your data is not on the servers anymore. Firefox Syn wasn't designed as a back up service. -
My iMac (late 2010 model) desktop's hard drive is fried (was about 200GB). How much am I expecting to pay for a new one and retrieve my information?
As you can see Erin, trying to recover information from a hosed drive can be very expensive.
I would suggest first the OWC site as well. You can get a new drive of choice in size there.
I would also get the voyager http://eshop.macsales.com/item/Newer%20Technology/VOYQHDB1.0T/
and..
http://eshop.macsales.com/item/Prosoft%20Engineering/DGDR3BUN/
http://eshop.macsales.com/item/NewerTech/TOOLKIT11/
Wth your lap top and these folllowing tools your are set to change out the drive, reload OS and then with
the voyager pop in the old iMac drive and with the Prosoft software, try to mount and recover the files. Data Rescue is very good at this " if " the drive is not totally mechanically hosed. Drive Genius is very good at a number of things too. Nothing replaces the old adage of Back Up Back up Back up.
The voyage I listed can become the new backup drive for you.. your choice of tools: Time Machine or by cloning via CarbonCopyCloner or by what I use SuperDuper! IF you want to be really kewl.. both. By that I mean cloning and Time Machine.
It will take you an hour to swap out the drive and spring clean the iMac.. there is a hundred how too,s on you tube.
Hope this helps. Remember if is always when a drive will fail..they all do. I tell the people I support that Harddrives are good for 15 min.. to when they don't work. They will all fail.
Apple Geniuses are very limited to what they can and will do as far as file recovery.
Your best bet is to try to do it your self first. There is lots of help out here and you are not the first.
Don -
RE: Polymorphism - retrieving type information from thedatabase or how
Don,
Ok but if I was to model a real restaurant, I would then have a head chef
that can then delegate to other chefs. This head chef would have the
additional task of coordinating the completion of subservient chefs. This
does not and would not mean that the head chef is stuck (or partitioned) in
one part of the kitchen. Further a head chef would most likely also be a
chef so that he would be running around the kitchen using and interacting
with different objects to get his part of the recipe completed. Then once
all chefs have completed their part of the recipe the head chef could return
the meal.
I would also point out that it does not make sense to me to be talking about
the chef and its ability to scale. I would look that the resource limited
devices that must be used to prepare meals to see scalability. In this case
the grill, the stove and the microwave. Scalability of the restaurant is a
function of the amount of resource limited devices versus the number of
process (i.e. chefs) that need to use those devices concurrently and the
amount of time they require access to those devices. By talking about chefs
as if they are the scalability limiting factor seems to bring us back to the
notion that the chef is a manager object that is shared. And again I come
back to the question, why?
You may now think that in a real restaurant, there are only so many chefs so
why not make it a shared service? Well in a real restaurant there are only
so many of any object, but this is not a consideration in our restaurant
model. In our "virtual" restaurant hiring a chef is as easy as:
Chef = new;
And of course chefs are of zero mass so there can be a whole lot in the
kitchen. Now assuming the Grill, Stove and Microwave map to physical
objects in our computing environment, then that is the limiting factor and
are therefore partitioned. Whenever communication has to go through a
single source, then scalability breaks down. I fear that too many people
make shared objects and create communication bottlenecks where they simply
don't exist. The only place your scalability bottlenecks should exist is in
the actual resource limited objects of your computing environment. Simply
said, if something isn't a resource limited object, then why is it shared?
If anyone is not clear how to architect an application independently of the
business model, then I would suggest looking at various framework products
and reading some technical architecture white papers to get a different, and
possibly enlightening, point of view.
Mark Perreira
Sage IT Partners.
-----Original Message-----
From: Don Nelson [mailto:[email protected]]
Sent: Wednesday, June 17, 1998 9:04 AM
To: Mark Perreira
Cc: [email protected]
Subject: RE: Polymorphism - retrieving type information from the
database
Mark,
First, I completely agree about the naming. I purposely used rather
euphamistic names for these "managers", since I see many convoluted names
for common things in various applications. But that is a topic for another
thread...
Simply because there is a "manager" of some type, does not imply that it is
chained to a particular duty. However, let's look at a real life case. In
a large restaurant, you would rarely see a chef chopping carrots or serving
dishes to customers. Those are the responsibilities of the sous-chef and
the waiter. So, we see that the chef does not really follow the food
around. Why not? Because it simply doesn't scale. When scalability isn't
a problem, (the restaurant isn't that popular, for example) the chef has
some lattitude to accept more responsibility, and might even get involved
with purchasing, etc.
In the real world, the more scalable something has to be, the narrower the
responsibilities are for each of the participating members.
Don
At 12:59 AM 6/17/98 -0700, Mark Perreira wrote:
Don,
One thing that always baffles me is when should an Object get the moniker
"Manager." This practice seems to tell me a couple of things about these
objects. In general when someone makes reference to a "Manager" objectthat
it is probably a service object and probably contains no or very little
attribution. The question is why? If I am developing an object model why
am I thinking about such implementation issues.
Surely if you are trying to model cooking an egg I would not see
"SustenancePreparationManager" in your model. Using a more common term I
would still be alarmed to see "CookManager" in your model. What does the
CookManager manage? Does it manage other cooks or eggs. Maybe it shouldbe
called an EggManager, but that doesn't make sense. How about just Cook.
There that seems like the real world. And this brings me to a problem in
the analogy. Conjuring up managers in a model can sometimes make you missa
container. For example, I would say that if we wanted to model the real
world, then eggs is a specialization of ingredient that is contained by
recipe that can be given to a cook to be prepared.
I may have many cooks (objects) that can prepare recipes and my application
architecture not the object model needs to deal with how to best let those
cooks utilize the grill, stove and microwave that sits on different
partitions on my server. My cooks can move around and when they do they
take their ability to know how to cook with them. In the real world Iwould
expect a cook to use the right appliance to prepare the recipe based on its
contents. I would not chain every cook to its appliance and them make me
responsible for giving the right cook the right recipe. This is what
managers can cause. They cause the consumer of cooks to know which cookcan
prepare what recipes based on where they are chained. This then makes me
know something about cooking. And if I don't know anything about cooking I
can only image what my egg would look like if I accidentally gave therecipe
to the cook stationed at the microwave.
Ok Ok, I have seen many architectures use facades to hide the fact that I
like to chain my cooks to their appliance. But what is that. I have gone
to restaurants and I don't know what a cook facade is. If I ask themanager
to present the cook facade manager employee I would probably be met by the
bouncer employee.
So what is the answer? Well for a start keep the application architecture
out of the model. The model should stand alone in describing the
interactions required to satisfy use cases. Second find an architecture
that describes a more responsibility driven design and how that design and
can map your business object behavior to a physical implementation with
appliances and cooking rules. And lastly, don't be so quick to chain your
cooks to their appliances. Give them some control over where they cook
their recipes, after all that is what they do.
Mark Perreira
Sage IT Partners.
-----Original Message-----
From: [email protected]
[<a href="mailto:[email protected]">mailto:[email protected]]On</a> Behalf Of Don Nelson
Sent: Tuesday, June 16, 1998 2:07 PM
To: Nick Willson
Cc: [email protected]
Subject: Re: Polymorphism - retrieving type information from the
database
This thread is switching context a bit, but I would add one thought tothe
idea of encapsulating behavior. One of the advantages to OO is that it
helps us model real world behavior. In the real world, I would not askan
invoice to stuff itself into an envelope and mail itself to its
customer; I
would not ask my vehicle to fuel itself or change its own oil; I wouldnot
tell an egg carton to ask one of its eggs to fry itself. Even if these
things were physically feasible, I could list a number of reasons why I
still wouldn't want to do them. That is why we haveVehicleRepairManagers
and SustenancePreparationManagers (aka, "Mechanics" and "Cooks").
Don
At 11:28 PM 6/15/98 -0700, Nick Willson wrote:
Tim,
You've had lots of good suggestions so I hope you won't mind an attempt
at another one. The consensus seems to be for your option (1) for the
Vehicle table, and Steve's example of a GenericConstraint (taking the
place of your Vehicle) is probably how most people would go about
answering your question. I don't have much to add to that, just wanted
to offer something about where the persistence mechanism lives and how
things look to clients that depend on it.
Suppose for a moment you think about the Vehicle classes' persistence as
being just one aspect of their behavior. In addition to persistence,
you might have to implement security, or locking for concurrent access,
or caching of vehicle objects to improve performance, and of course you
want to calculate the vehicle tax and probably do other things with
Vehicles too.
You can put the persistence aspect of Vehicles into a
PersistenceObjectManager, but then the others need somewhere too. If
you use a bunch of Managers (one for security, one for locking...) then
each class's behavior is scattered across these various Manager classes,
each of which has to know about many classes. Or if you use one Manager
class, it's going to know still more, plus you are forced to implement
all the behavior in (or at least via) that manager's partition.
An alternative would be to keep all the Vehicle classes' behavior
encapsulated together, so a client always makes requests to a Vehicle,
and the Vehicle delegates the implementation of requests to a chain of
handler objects that hang off the vehicle object (a handler for
security, another for persistence, and so on).
One of the nice things about this is, the handlers can be responsible
for going to another partition (if necessary), e.g. to perform
persistence operations, or for more business-specific operations like
tax calculations. And because the handlers are smart, you don't have to
put a lot of code into service objects, the SOs can stay pretty simple.
This isn't an approach you'll see in Express, so I hope of it's of some
interest.
General wrote:
Part 1.1 Type: Plain Text (text/plain)
Encoding: quoted-printable--
Nick Willson
SCAFFOLDS Consultant,
Sage IT Partners, Inc.
(415) 392 7243 x 373
[email protected]
The Leaders in Internet Enabled Enterprise Computing
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:<a href=
"http://pinehurst.sageit.com/listarchive/">http://pinehurst.sageit.com/listarchive/</a>>
>>>
>>>
>>
>>
============================================
Don Nelson
Regional Consulting Manager - Rocky Mountain Region
Forte Software, Inc.
Denver, CO
Phone: 303-265-7709
Corporate voice mail: 510-986-3810
aka: [email protected]
============================================
"When you deal with higher numbers, you need higher math." - Hobbes
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:<a href=
"http://pinehurst.sageit.com/listarchive/">http://pinehurst.sageit.com/listarchive/</a>>
>>
>
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:<a href=
"http://pinehurst.sageit.com/listarchive/">http://pinehurst.sageit.com/listarchive/</a>>
>
>
============================================
Don Nelson
Regional Consulting Manager - Rocky Mountain Region
Forte Software, Inc.
Denver, CO
Phone: 303-265-7709
Corporate voice mail: 510-986-3810
aka: [email protected]
============================================
"When you deal with higher numbers, you need higher math." - Hobbes
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:<a href=
"http://pinehurst.sageit.com/listarchive/">http://pinehurst.sageit.com/listarchive/</a>>Don,
You are absolutely correct. But this is where I honestly think you are
missing the point. While the mail program sends the mail, my mail message
has an interface (i.e. send button) which can delegate that to the mail
program. This makes it nice and simple for me the consumer of the mail
program. It also means I can think of mailing by focusing on the interface
(i.e. the button). It would suck if every time I wanted to mail something I
had to identify the correct pop server to send it to (i.e the MailManager).
Mailing something is the collaboration of the setup information of the mail
program and my mail message. If I were to model this my mail object would
indeed have a send method that could delegate to the correct mail servers.
This is just simplicity of interface and it is a good practice in UI
development just as it is in business model development. A simpler
interface, I think we can all agree, provides for a better and quicker
understanding.
Mark Perreira
Sage IT Partners.
-----Original Message-----
From: [email protected]
[<a href="mailto:[email protected]">mailto:[email protected]]On</a> Behalf Of Don Nelson
Sent: Thursday, June 18, 1998 9:22 AM
To: Nick Willson
Cc: [email protected]
Subject: Re: Polymorphism - retrieving type information from the
database
Nick,
It turns out that your message does not, indeed send itself. Your mailing
program does that.
Don
At 11:54 PM 6/17/98 -0700, Nick Willson wrote:
Hey Don,
In the real world, no, you can't tell an invoice to put itself into anenvelope
and mail itself. You have to know about stamps and post boxes and wherethey
are located. But isn't it nice that in software you don't have to followthe
real world very closely if you don't want to?
Above the top left hand corner of this message I'm typing right now, thereis a
send button which lets me tell the message to 'stuff itself into anenvelope
and mail itself'. Why wouldn't you want to do that?
Don Nelson wrote:
This thread is switching context a bit, but I would add one thought to
the
idea of encapsulating behavior. One of the advantages to OO is that it
helps us model real world behavior. In the real world, I would not askan
invoice to stuff itself into an envelope and mail itself to its customer;I
would not ask my vehicle to fuel itself or change its own oil; I wouldnot
tell an egg carton to ask one of its eggs to fry itself. Even if these
things were physically feasible, I could list a number of reasons why I
still wouldn't want to do them. That is why we haveVehicleRepairManagers
and SustenancePreparationManagers (aka, "Mechanics" and "Cooks").
Don
At 11:28 PM 6/15/98 -0700, Nick Willson wrote:
Tim,
You've had lots of good suggestions so I hope you won't mind an attempt
at another one. The consensus seems to be for your option (1) for the
Vehicle table, and Steve's example of a GenericConstraint (taking the
place of your Vehicle) is probably how most people would go about
answering your question. I don't have much to add to that, just wanted
to offer something about where the persistence mechanism lives and how
things look to clients that depend on it.
Suppose for a moment you think about the Vehicle classes' persistence as
being just one aspect of their behavior. In addition to persistence,
you might have to implement security, or locking for concurrent access,
or caching of vehicle objects to improve performance, and of course you
want to calculate the vehicle tax and probably do other things with
Vehicles too.
You can put the persistence aspect of Vehicles into a
PersistenceObjectManager, but then the others need somewhere too. If
you use a bunch of Managers (one for security, one for locking...) then
each class's behavior is scattered across these various Manager classes,
each of which has to know about many classes. Or if you use one Manager
class, it's going to know still more, plus you are forced to implement
all the behavior in (or at least via) that manager's partition.
An alternative would be to keep all the Vehicle classes' behavior
encapsulated together, so a client always makes requests to a Vehicle,
and the Vehicle delegates the implementation of requests to a chain of
handler objects that hang off the vehicle object (a handler for
security, another for persistence, and so on).
One of the nice things about this is, the handlers can be responsible
for going to another partition (if necessary), e.g. to perform
persistence operations, or for more business-specific operations like
tax calculations. And because the handlers are smart, you don't have to
put a lot of code into service objects, the SOs can stay pretty simple.
This isn't an approach you'll see in Express, so I hope of it's of some
interest.
General wrote:
Part 1.1 Type: Plain Text (text/plain)
Encoding: quoted-printable--
Nick Willson
SCAFFOLDS Consultant,
Sage IT Partners, Inc.
(415) 392 7243 x 373
[email protected]
The Leaders in Internet Enabled Enterprise Computing
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:<a href=
"http://pinehurst.sageit.com/listarchive/">http://pinehurst.sageit.com/listarchive/</a>>
>>>
>>>
>>
============================================
Don Nelson
Regional Consulting Manager - Rocky Mountain Region
Forte Software, Inc.
Denver, CO
Phone: 303-265-7709
Corporate voice mail: 510-986-3810
aka: [email protected]
============================================
"When you deal with higher numbers, you need higher math." - Hobbes--
Nick
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:<a href="http://pinehurst.sageit.com/listarchive/">http://pinehurst.sageit.com/listarchive/</a>>
>
>
============================================
Don Nelson
Regional Consulting Manager - Rocky Mountain Region
Forte Software, Inc.
Denver, CO
Phone: 303-265-7709
Corporate voice mail: 510-986-3810
aka: [email protected]
============================================
"When you deal with higher numbers, you need higher math." - Hobbes
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:<a href=
"http://pinehurst.sageit.com/listarchive/">http://pinehurst.sageit.com/listarchive/</a>>
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:<a href=
"http://pinehurst.sageit.com/listarchive/">http://pinehurst.sageit.com/listarchive/</a>> -
Get Thread information in a Servlet
Hi,
I'm wondering if there is a way to get the running thread information in a Servlet, Something like an ID. For example, each time the Servlet receives a new request, the Servlet container will create a new thread to run the code, I want to know and log the information of this Thread.
Any ideas?
Thanks in advanceNot sure why you want to know what thread it is. The container multi-threads for you. If you want to store a value for use later in the thread, use ThreadLocal. If you want to spin off other threads, J2EE frowns on this, but you can do so. I'm not at all clear why the name or ID is important, since it is normally arbitrary and implementation-dependent on the J2EE container. If you are simply trying to log which thread is doing what, Log4J and the Logging API allow you to specify a pattern that will include the thread name without any coding on your part. So, I am having trouble understanding why you think you have this requirement.
- Saish -
IE, tomcat 4.0 - running servlet kicks to localhost7070 search screen
I moved my shopping cart website (my first) to a PC running xp, downloaded j2sdk1.4.1_02 & tomcat4.0, set classpath, java_home, catalina_home. Set html in the webapps directory of Tomcat, java servlets in the webapps/mywebsite/WEB-INF/classes folder and recompiled sucessfuly. Tomcat runs on localhost7070, I can see the HTML in /mywebsite but when I click on the 'submit button' to run the servlet, my IE momentarily shows 'not found' but immediately goes to an ATT Worldnet site with a search field filled with localhost:7070.
I have no idea of what setting might be off on IE but I have checked the directorys and system variables multiple times and can't figure this out. Any ideas would be greatly appreciated.
BruceYour web.xml (in WEB-INF) have your Servlet URL mapping. Try and see if you can get in contact with your Servlet manualy by typing in URLs like
HTTP://localhost:7070/servlet/ProductLookup
HTTP://localhost:7070/mywebsite/servlet/ProductLookup
HTTP://localhost:7070/mywebsite/ProductLookup
and when you find it, compare it the the URL in your HTML, relative to the URL used load the HTML page. -
Ive somehow managed to delete a complete user profile. Is it possible to retrieve the information?
Try this:
iTunes: Finding lost media and downloads
Also go to iTunes>Preferences>Advanced and see if the it posint to where your music is located. -
Tomcat 5.0.18 Servlets
I am new to JSP, installed J2SDK1.4.2_03 and Tomcat 5.0.18. I am able to get the jsp pages to work and also view the sample servlet examples. But I am having a hard time getting my servlets to work. I have
set the
ClassPath to C:\Jakarta\Jakarta-tomcat-5.0.18\common\lib\servlet-api.jar
My directory structure is
webapps\Myexamples\WEB_INF\CLASSES
WEB-INF has the web.xml doc, and the Classes and lib folders
Classes has the class called DontPanic, and the java file DontPanic
the url I typed is
http://localhost:8080/Myexamples/servlet/DontPanic
I get an error message source file not found.
Please help!!!!!!
LakshmiClassPath to
C:\Jakarta\Jakarta-tomcat-5.0.18\common\lib\servlet-api
jarThis is worthless at runtime. Tomcat ignores your system CLASSPATH environment variable. It uses its own CLASSPATH at runtime. You must include the servlet-api.jar in your CLASSPATH when you compile. I do it by using the -classpath option. (Actually I use Ant to build Web apps.)
>
My directory structure is
webapps\Myexamples\WEB_INF\CLASSES
WEB-INF has the web.xml doc, and the Classes and lib
folders
Classes has the class called DontPanic, and the java
file DontPanic
So your serlvet DontPanic.class file is in webapps/Myexamples/WEB-INF/classes. (Not an underscore in WEB_INF, it's a hyphen WEB-INF.)
Tomcat won't deal with a class that's not in a package. You should put a package statement at the top of your servlet .java file and make sure that it's compiled into that directory in your WEB-INF/classes.
I'm assuming that you've got the servlet mapping in the web.xml properly. You should be mapping your servlet class DontPanic to a URL mapping /DontPanic.
the url I typed is
http://localhost:8080/Myexamples/servlet/DontPanic
After you've changed your WEB_INF to WEB-INF, try this URL:
http://localhost:8080/Myexamples/DontPanicAre there any messages in the Tomcat logs that tell you anything? - MOD -
Which views/tables to use for retrieving item information
Hi All,
I need to write a PL/SQL procedure for retrieving detailed information for a specified item (given inventory item ID and organization ID). I'm not quite sure which views/tables to us for this.
I found out that view MTL_SYSTEM_ITEMS_FVL is the underlying view for the Master Item Form (via help / record history menu option). But when looking up in eTRM following warning is described:
Warning: Oracle does not recommend you query or alter data using this view. It may change dramatically in subsequent minor or major releases.
The second view I found is MTL_SYSTEM_ITEMS_VL. But when quering for data in this view, it turned out that the view is empty.
Can anybody tell me for what purposes this view is used?
Is it the correct way to use one of these views (or any other?) for retrieving detailed item information or should I better define a new query within the procedure using tables such as MTL_SYSTEM_ITEMS_B, MTL_SYSTEM_ITEMS_TL and MTL_PARAMETERS (any others) ?
Any ideas for that?
Best Regards,
CarolinHi Carolin,
It's usually more efficient to use base tables instead of views. The tables you will actually need will depend on your requirements. Regarding your question about MTL_SYSTEM_ITEMS_VL, it's usually ok to use the _VL views. These typically contain the same information as the base tables plus some logic to get the appropriate translations for fields that can be shown in different languages (for instance, DESCRIPTION). Typical table names you will need could be:
Item Master: MTL_SYSTEM_ITEMS_B
Organizations: MTL_PARAMETERS
Subinventories: MTL_SECONDARY_INVENTORIES
Units of Measure: MTL_UNITS_OF_MEASURE
Onhand Quantity: MTL_ONHAND_QUANTITIES_DETAIL
Material Transactions: MTL_MATERIAL_TRANSACTIONS
Categories: MTL_CATEGORIES_B, MTL_CATEGORY_SETS_B, MTL_ITEM_CATEGORIES
If your query didn't return any data, it's probably because the language was not properly setup in your session (check USERENV ('LANG') so see what's the language in your session).
Hope it helps. -
How do I resolve error 5011; "Attention: unable to retrieve shared information" on Time Magazine app?
Dear Goteamjosh,
When you bought a subscription through iTunes you shouldn't have to login seperately using the sign in which asks you for your timesubscription data (this is only when you are a paper subscriber, in that case your iPadsubscription is complimentary). The login should be automatic if your iPad is logged in to iTunes, if not ,you will see the familiar iTunes loginbox in which you use your regular iTunes data. If the app asks you your credentials with a Time-loginbox, then there is still something wrong with the app. As you can see above, a lot of people have been experiencing problems, which they now seem to have resolved (my app is working OK again, no login data requiered).
Update: I just checked, and my app is not working again either! Back to square one. As we can see above, there is some time-app bug (or server problem or whatever). No use trying to solve it ourselves. I am sure they are aware of it and working on it, i guess we just have to be patient (again!). -
Conflict Resolver Sync Error - Unable to retrieve conflict information from the sync server
So I have been using iTunes with my iPhone 3GS and now my iPhone 4 to sync with my Outlook for many years now and it has been flawless.
I recently bought a new iPad and started syncing it as well.
Now as of late, after every 2 or 3 syncs, I get an error from iTunes displaying the Conflict Resolver and it says there are 42 sync conflicts.
When I try use the Review Now button it shows up and the issues are between my iPhone and Outlook and are only related to contacts.
As soon as I try to choose which record to resolve, the window immediately disappears without giving me a chance to finish and I get another dialog window with the error:
Unable to retrieve conflict information from the sync server.
Please try again the next time the conflict resolver window is presented.
When I try to sync again it seems to be fine. But then after I sync my iPad and theny iPhone again it shows up and it still won't let me resolve the conflicts.
I have tried the following:
1) Rest Sync History on all devices
2) I have had iTunes replace all the contacts on the iPad from iTunes
3) I have changed the conflict resolver to only notify when 50% of the data will be changed
I have had no such luck.
If I add a contact to Outlook or to my iPhone and then sync it seems to be syncing the new addtions correctly. However, I cannot get this issue with this 42 conflicts resolved for some reason. This has been going on for a month now.Here is the solution.
Rationale: You want to be able to have the dates on your items (notes, contacts) on your iphone to be the same as on outlook. This will eliminate any sync conflicts. You will also notice that if you modify something on the iphone and sync, you will lose the modification you made.
Steps:
1) In outlook, export the data (contacts, notes) to a CSV file
2) Delete you notes/contacts in outlook
3) Sync your iphone and select replace information on this iPhone (in iTunes)
4) Now your contacts and notes will be empty on both your iPhone and Outlook
5) Now import your contacts and notes from the CSV files back into outlook. What this does is put the current date and time on every individual item
6) Sync your iPhone to iTunes normally
7) everything will work correctly now with no sync issues and no conflicts.
Sherali -
Polymorphism - retrieving type information from thedatabase
Daniel,
Yes I have always thought, that modeling the real world can lead to objects
that are unnecessary or overly complex relationships that do exist in the
real world but may not have to in a computing environment. Many times,
business models could be greatly simplified if the modelers factored out
interfaces from objects so that these interfaces could be applied based on
need of behavior without having to always construct class hierarchies in a
particular behavioral structure. Or they could benefit greatly by applying
design patterns to enhance delegation. But the problem with both of these
pieces of advice is that they assume the modeler is well versed and
understands how to apply these concepts. Many application developments I
come across are being done by a group of people that have never used an OO
tool before. With an audience such as this, how are they supposed to get
started?
Usually they will look and analyze the real-world. This will give them a
starting point in which to conduct dialog for building an object model. I
think I do know how these advanced strategies I described above are applied,
yet I always ask a customer to explain the real-world example of something
before I attempt at understanding their model and make any attempts at
advising changes. This assures that I and they have a better physical
understanding of an interaction before we attempt to describe an abstract
model of the same interaction.
As far as sharing of business objects, it is quite routine for a company to
have one group of IT application developers create a subsystem with business
objects that must be SHARED by another group of IT application developers.
The different subsystems have points of interconnect. These points can be
at the architectural level or business object level. So I don't think this
situation is as rare as you state. Further, I can see that the marketplace
is pushing more for run-time object sharing and collaboration so that this
will be the norm and not the exception.
I agree on the importance of custom routing for performance. I think it is
complex enough that I would stop short of telling people to spend time
building such a scheme. I would hate to see an application miss delivery
because the developers got too entangled in technical problems like custom
routing. But I do happen to know of a Framework product that has this as
one of its features. :)
I agree 100% with you the complexity of Forte is the marrying of object and
distributed technologies. I don't agree that frameworks cannot provide the
answer. I look at a framework as more than just a technical solution. We
use our framework to help divide the responsibilities between Business
Analyst, GUI Architect, Back-end Architect, GUI Developers and Back-End
developers. At many customers, some people play all of these roles. At
some customers, a developer may play just the GUI Developer role until he
can come up to speed on how to build simple views that are used to build
more complex windows. In this way, a large problem can be broken down into
a set of much smaller problems to help the architects manage work load and
education of the team. Without a framework that supports this sort of
approach, the architects of the application would have to delay development
until boundaries could be put in place. This can be very time consuming and
cause application rewrites if the boundaries were guessed wrong. In the
Forte marketplace today, there are products to help people set up those
architectural boundaries. It simply is more cost effective to buy one of
these solutions then it is to have your team spend time on this and add risk
to your project. In other words, architecture for a Forte development can
be bought much more cheaply than it can be created.
Mark Perreira
Sage IT Partners.
-----Original Message-----
From: Daniel Nguyen [mailto:[email protected]]
Sent: Sunday, June 21, 1998 7:35 AM
To: Mark Perreira
Cc: [email protected]
Subject: Re: Polymorphism - retrieving type information from the
database
Mark,
The battle question was only a little provocation : it seems that Forte
people and yours don't have exactly the same point of view about the way
that distribution should be made.
The problem I see on modeling the real world is that the hypothesis
seems to
be wrong : the world will never be as static as the modeling in my point
of
view. The fact is that when you try to model real world you will add
many
concepts you don't really need for the application. Those concepts may
change
with time. In my own experience I have seen that if you don't have a
real
concrete objective, it is very easy to imagine many things which won't
be
usefull when the real aim will come. That's why I think that in a
pragmatic
point of view it is better (in a cost view that's right) to focus on a
good
modeling of the system you have to build. For instance, in an exotic
currencies options system, you can imagine modeling for the Front a
system
without the product concepts, but only rules, because it is the real
world.
But when you come to the Back Office, you realize that all is managed
through
product concept. Then you come back to the Front modeling and break a
lot
of work. In the real world, the product concept does not exist, that's
right.
But it is a way to manage operations.
We all speak about Business Objects (and rules) share and re-use. I
imagine
that it is only applicable on some specific domains where the concepts
are
already shared as Insurance, Banking or Risk management on shares. This
is
because we have common rules for all companies : some financial markets
are
organized with public rules and constraints for instance. So the
difference
between companies is only on the service and not really in the business
foundations. But, in most cases, the differences between competitors are
on their business, their know how.
I have some difficulties to imagine companies with specific know how
sharing
it with competitors! So I imagine that shared business objects will be
very poor.
The problem may be that Business components will be provided by editors
like
Microsoft or may be Forte (with Express evolutions may be). But, the
business of their clients is not in the job of those providers : they
may
have a wrong view of the business of their customers, because they don't
have their know how.
On routage capabilities of manager, I agree on the technical point of
view.
This should be inherited from a service definition from Forte or a
technical
component. But, I have seen (on financial markets) that you also need
business
routage for scalability and performance. This is unfortunatly not in
Forte and
may be not really in technical frameworks on the market. Just an example
You have a financial market which is managed on several physical sites
(let's
take 2 sites). When everything is ok, you have one instance of a service
on each
site, first one managing some kind of instances (futures for instance)
and the
second one managing other kinds of instances (options for instance). But
when the
first site falls, you need (at run-time and if possible without stopping
the market)
to reconfigure the second service to manage all the instances (futures
and options).
So this is linked to business really. That's right, I base the
reflection on a very
specific (and experienced) case where the cost of the IT system is very
low compared
to the money exchanged on the system : you can imagine very specific
solutions.
The main problem I see today is that people have real difficulties to
integrate
object and distribution concepts and that Forte is to hard for Cobol or
Visual
Basic developpers. So those kinds of product should be more encapsulated
and
packaged on a push button way. The solution of making frameworks may be
very
short term solution, because of the cost and limitations about coverage
of the
clients specific objectives. Those problems come from Client/server
architectures
and needs, in my opinion, and NOT specifically from Forte or other
competitors.
Daniel Nguyen
Freelance Forte Consultant
Mark Perreira wrote:
Daniel,
I hope not. For SCAFFOLDS works only because of Forte and when I make
someone a happy SCAFFOLDS customer then they are also a happy Forte
customer. So if we sell more SCAFFOLDS, Forte sells moreForte. If there
is a battle between us, I certainly don't understand why,because we are on
the same team with the same goal.
I have always found customer have a different role than you have pointed
out. While I agree with the objectives, I have found most clients do
actually try to model the real world. They do it because it is an easy
starting point. They also do it because most OO books on the subject of
modeling point people in that direction. So they do indeedplay the role of
God with the business object model. But I have found thesesame customers
unwilling to play the role of God with the architecture. Theyare either
new to Forte and distributed object systems or they feelcomfortable with
the architecture to be documented and supported beyond thetenure of a set
of consultants that could come in and build such a system. In this case
they buy a pre-defined and built architecture.
I also agree that a Forte Service Object in and of itself can be
problematic. But I depart where you say a manager can dothings like custom
routing. This is exactly why I think Forte can be too difficult for too
many people. Any custom routing scheme is not to be takenlightly in its
impact of the overall performance and makeup of a running system. The
manager pattern does not describe a run-time environment withthe checks and
balances needed to make sure a custom router can perform. I have talked
with you Daniel and have complete faith in your ability todevelop such a
system. I would be very concerned in having just anyone try toimplement
custom routing in manager objects without a run-time environment that
simplifies and protects the participants from the mountain of technical
problems that would follow.
Mark Perreira
Sage IT Partners.
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/> -
RE: Polymorphism - retrieving type information from thedatabase
I would disagree with your statement that either the object or data model
must be wrong. The problem is more fundamental-trying to store objects in a
relational database. The object and relational paradigms can be made to
work together, but usually only by compromising tenets of one or the other
(or both). Now granted, there are many ways of making them work
together-and some are definitely better than others.
CJ
Chris Johnson
612-594-2535 (direct)
612-510-4077 (pager)
-----Original Message-----
From: Rottier, Pascal [SMTP:[email protected]]
Sent: Monday, June 15, 1998 8:17 AM
To: Forte Users Mailing list
Subject: RE: Polymorphism - retrieving type information from
the database
> ----------
> From: Rottier, Pascal[SMTP:[email protected]]
> Sent: Monday, June 15, 1998 8:17:16 AM
> To: Forte Users Mailing list
> Subject: RE: Polymorphism - retrieving type information from
the database
> Auto forwarded by a Rule
>
This issue has already passed this mailing list a couple of
times in the past. To put it in more general terms, you have
different classes which you store in the same DB table.
This is always tricky. Nine out of ten times, this means
either your Object model or your DataBase model is wrong.
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>This issue has already passed this mailing list a couple of
times in the past. To put it in more general terms, you have
different classes which you store in the same DB table.
This is always tricky. Nine out of ten times, this means
either your Object model or your DataBase model is wrong.
If you can differentiate between different classes, this
means you're dealing with different entities, which should
be stored in different tables. What if one class has an
attribute the other one doesn't. This would mean you have
to add a column to the database which is filled it the row
represends one class and is NULL if the row represends
another class. This is not good database practice!
Differentiating between different classes by means of
a "type" attribute is the classic procedural approach.
The OO approach would be to create subclasses. How-
ever, a relational database doesn't support subclasses.
The best way, would be to have a different table for
each subclass. If this gives you problems with norma-
lizing your database, you can create a table with all
the attributes generic to vehicle, and a table for each
subclass with only the attributes relevant to this sub-
class and a foreign key relation to the main table. If all
of this is not feasable, you're left with the need to find
some mechanism to identify what kind of class a cer-
tain row represends and then instantiate this class. The
tree solutions you suggested all work. It doesn't really
matter which one you chose, they're all equally dirty.
Hope this helps,
Pascal.
-----Original Message-----
From: General [SMTP:[email protected]]
Sent: Monday 15 June 1998 12:20
To: [email protected]
Subject: Polymorphism - retrieving type information from the
database
Suppose I have a class structure containing one base class with
several specialisations. Say, "Vehicle", with specialisations of
"Car", "Van" and "Truck". All vehicles are persisted in the database,
in a rolled-up table, and I want a generic retrieval mechanism, which
fetches a vehicle based on the license plate number. (It will probably
be a service object, which I will call a Persistent Object Manager).
I wish to retrieve ALL vehicles, and calculate the road tax for each.
However, cars, vans and trucks are all subject to different tax rules,
and require a different method to calculate their road tax. To put it
another way, there is a polymorphic method 'CalculateRoadTax' on the
"Vehicle" class.
Q: As each vehicle is extracted from the database, how does the rest
of the Forte application know what type of vehicle it is?
I am sure that others must have solved this problem before, but it is
new to us. We have come up with the following solutions:
(1) Add a "sub-type" column to the "Vehicle" table. Use the type
information to instantiate a Forte object of the correct type
(2) Maintain a completely separate table linking the vehicle licence
plate to its sub-type.
(3) Deduce the type of the object from the pattern of null columns in
the row.
I think (1) is the best solution, but I'm interested to know what the
experts say!
Incidentally, if Express can help or hinder in this situation, I would
be interested in that as well.
regards,
Tim Kimber
EDS (UK)
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>
Maybe you are looking for
-
I am trying to download Adobe Creative Cloud on my new Computer but it wont run the program.
I try to download Adobe Creative Cloud then when the download is done I hit Run and nothing happens.
-
Some problem with IDoc's Settings while loading data
Hey Experts, Previously i tried data loading using LIS & LO, but i was not able to load data, i was taking it as some transfer structure problem. But just today i tried to load Master Data, and its displaying the same error. I feel its something rela
-
How do I view videos on YouTube on my New MacBook Pro?
How do I view videos on YouTube on my New MacBook Pro? Any help would be greatly appreciated. Thanks! Gary
-
I'm having trouble with my clone tool. When I am cloning it appears OK (the image within the brush circles is the correct colours) however once the cloning is done, it processes leaving me with a darkened blur. Any help with what's going on would be
-
Hi All Can we automate rounding up of Excise Duty amounts appearing, when capturing Excise Invoice via MIGO Goods receipt. Kind Regards Samson