JSP send mail exception,plz help
Hi,
I have written code for mail program in jsp but it gives "javax.mail.MessagingException: Exception reading response; nested exception is: java.net.SocketException: Connection reset "
what will be the reason for this plz help.
thanks
restart your machine then it s will be corrected...i mean socketexception
i have found my problem...its a problem about delaying emails like spam protection...ur mail server and and script must run on the same ip...and so my problem solved...
maybe there is a trick for delaying emails even they dont run under the same ip but i dont know..!
Similar Messages
-
JSP Send Mail Application, plz help
Hi,
I have written a jsp send mail application, but it is giving error that NoSuchProviderException. What to do? Plz help. I m sending the code as below:
<%@ page import="java.util.*, javax.mail.*,javax.mail.internet.*" %>
<html>
<head>
<title>E-Mail Us</title>
</head>
<body bgcolor="white" text="#003399" >
<%
if(request.getMethod().equals("POST") )
boolean status = true;
String mailServer ="SMTP_HOST";
String fnm = request.getParameter("fnm");
String lnm = request.getParameter("lnm");
String facility = request.getParameter("facility");
String subject = request.getParameter("select");
String fromEmail = "[email protected]";
String toEmail = "[email protected]";
String bccEmail = "[email protected]";
String contact =request.getParameter("select2");
String way =request.getParameter("way");
String messageEnter = request.getParameter("message");
try
Properties props = new Properties();
props.put("mail.smtp.host", mailServer);
props.put("mail.smtp.auth", "true");
Session s = Session.getInstance(props,null);
MimeMessage message = new MimeMessage(s);
InternetAddress from = new InternetAddress(fromEmail);
message.setFrom(from);
InternetAddress to = new InternetAddress(toEmail);
InternetAddress bcc = new InternetAddress(bccEmail);
message.addRecipient(Message.RecipientType.TO, to);
message.addRecipient(Message.RecipientType.BCC, bcc);
message.setSubject(subject);
message.setSentDate(new Date());
message.setText(messageEnter);
message.setText(way);
message.setText(contact);
message.setText(facility);
message.setText(fnm);
message.setText(lnm);
Transport transport = s.getTransport(mailServer);
transport.connect(mailServer, "USER", "PASSWORD");
transport.sendMessage(message, message.getAllRecipients());
transport.close();
catch(NullPointerException n)
System.out.println(n.getMessage() );
out.println(n.getMessage());
out.println("<br><br><br><br><center><b>"+"ERROR!!!"+"</b></center>");//you need to enter a message"+"</b></center>");
out.println("<br><br><center><b>"+"You need to Enter a message"+"</b></center>");
status = false;
catch (Exception e)
System.out.println(e.getMessage() );
out.println("<br><br><br><br><center><b>"+"ERROR!!!"+"</b></center>");
out.println("<br><br><center><b>"+"Your Message to " + toEmail +" and "+ bccEmail+ " failed, reason is: " + e);
status = false;
if (status == true)
out.println("<br><br><center><b>"+"Your message to " + toEmail +" and "+ bccEmail+ " was sent successfully!"+"</b></center>");
else
%>
<center>
<h1>Contact Us</h1>
<form method="post" name="mail" action="mail.jsp">
<table border="0">
<tr>
<td><b>First Name :</b></td>
<td><input type="text" name="fnm" size=24></td>
</tr>
<tr>
<td><b>Last Name :</b></td>
<td><input type="text" name="lnm" size=24></td>
</tr>
<tr>
<td><b>Facility :</b></td>
<td><input type="text" name="facility" size=24></td>
</tr>
<tr>
<td><b>Subject :</b></td>
<td> <select name="select">
<option>-------------------------------</option>
<option>Missing File</option>
<option>Correction Issue</option>
<option>Refer Us</option>
<option>Miscellaneous</option>
</select></td>
</tr>
<p>
<tr>
<td><b>Comments :</b></td>
<td><textarea name="message" rows = "10" cols="50"></textarea></td>
</tr>
<tr>
<td><b>Best way to contact :</b></td>
<td>
<select name="select2">
<option>--------------</option>
<option>Phone</option>
<option>Email</option>
<option>Fax</option>
</select>
<input type="text" name="way" size=24></td>
</tr>
</table>
<p>
<font face="Helvetica"><input type="submit"
value="Submit" name="Command">
</font>
</form></center>
<%
%>
</body>
</html>Ur messaging server will not be up..
regards
shanu -
Why I can Send Mail Here -- Plz Help
Hi All,
I m trying to send Mails to multiple users with the MailerBackp.java. But it is trowing some exception in parsing the InternetAddress
import java.util.*;
import java.util.concurrent.*;
public class MailerBackup {
private final FileCollection to;
private static ArrayList<String> emails ;
public MailerBackup(String addressFile){
to = new FileCollection(addressFile);
emails = new ArrayList<String>();
//No of remaining emails.
int remaining = to.size();
System.out.println("Remaining is: "+remaining);
int noOfmailAtATime = 500;
int counter = remaining/noOfmailAtATime;
System.out.println("Counter is == "+counter + " no of Mails at a time =="+noOfmailAtATime);
String email= "";
int start = 0;
int end = 0;
if(to.size()> noOfmailAtATime){
end = noOfmailAtATime;
}else{
end = to.size();
if(counter>=1){
for(int i=0; i<counter; i++) {
System.out.println("i is : "+i);
System.out.println("Start is "+start+" and end is "+end);
for(int j=start; j<end; j++ ){
email = email + "," +to.get(j);
start = end;
email = email.substring(1);
emails.add(email);
email = "";
if(i< counter-1){
end = end + noOfmailAtATime;
System.out.println("End is :"+end);
if(end < to.size()){
int count = 0;
System.out.println("Inside if");
for(int i= end; i<to.size(); i++){
System.out.println();
email = email + "," +to.get(i);
count = i;
email = email.substring(1);
emails.add(email);
email="";
System.out.println("End is =="+count+" and to size is "+to.size());
public static void main(String[] args) {
try{
BlockingQueue<Runnable> queue = new ArrayBlockingQueue<Runnable>(200);
ThreadPoolExecutor executor = new ThreadPoolExecutor(50, 50, 1, TimeUnit.SECONDS, queue);
if (args.length != 1) {
System.err.println("Usage: java ExecutorExample address_file" );
System.exit(1);
MailerBackup mailer = new MailerBackup(args[0]);
MailBean bean = null ;
MailSender sender = null;
long time = -System.currentTimeMillis();
time += System.currentTimeMillis();
//Here Emails is an ArrayCollection<String>, where each String consist of
//multiple comma seperated emails .
for(int i = 0; i < emails.size(); i++){
bean = new MailBean();
bean.setSubject("Mail Bean Test");
bean.setMessage("Hi This is a Test Message, Please Ignore this Message");
System.out.println(emails.get(i));
bean.setTo(emails.get(i));
executor.execute(new MailSender(bean));
System.out.println(time + "ms");
System.out.println("Finished");
}catch(Exception ex){
ex.printStackTrace();
}For sending Mails, My MailBeans send method is :
public Message createMessage(){
try{
Message msg = new MimeMessage(session);
msg.setFrom(InternetAddress.parse(FROM, false)[0]);
msg.setHeader("X-Mailer", "VMailer");
msg.setSentDate(new Date());
if(getTo() != null || getTo() !="")
msg.setRecipients(Message.RecipientType.TO,InternetAddress.parse(getTo(), false));
if(getCc() != null || getCc() !="")
msg.setRecipients(Message.RecipientType.CC,InternetAddress.parse(getCc(), false));
if(getBcc() != null || getBcc() !="")
msg.setRecipients(Message.RecipientType.BCC,InternetAddress.parse(getBcc(), false));
msg.setSubject(getSubject());
msg.setText(getMessage());
return msg;
}catch(Exception ex){
ex.printStackTrace();
return null;
public void sendMessage(){
try{
Message msg = createMessage();
transport.send(msg, msg.getAllRecipients());
}catch(Exception ex){
ex.printStackTrace();
}Error is while parsing the Mails.
java.lang.NullPointerException
at javax.mail.internet.InternetAddress.parse(InternetAddress.java:595)
at javax.mail.internet.InternetAddress.parse(InternetAddress.java:555)
at MailBean.createMessage(MailBean.java:123)
at MailBean.sendMessage(MailBean.java:138)
at MailSender.run(MailSender.java:11)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)DEBUG: setDebug: JavaMail version 1.4ea
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "email.vsginc.com", port 25, isSSL false
at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
at MailBean.sendMessage(MailBean.java:139)
at MailSender.run(MailSender.java:11)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
220 email.vsginc.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.1830 ready at Fri, 7 Sep 2007 09:19:00 -0400
DEBUG SMTP: connected to host "email.vsginc.com", port: 25So what's in FROM?
-
Problem sending mail. Plz help me
i need to send mails to the registered users.
the mail server details are given as a part of it. i dont know how to use the given username/password for the mail server. using mail server name without the username and password resulted in the following exception.
javax.mail.SendFailedException: Sending failed; nested exception is: javax.mail.MessagingException: Could not connect to SMTP host: mail.symphonicringtones.com, port: 25; nested exception is: java.net.ConnectException: Connection timed out: connect
so how can i use the given username and password.
regards,
ureshFirst of all, this error is not an authentication error, it's a network error.
The exception is telling you that java can't open a TCP socket to the given host on the given port. This is most likely due to one of two reasons:
1. There is no process listening on that port on that host
2. There is a firewall somewhere in between blocking tcp traffic
First resolve the connection issue. To test if you are able to connect, just try to telnet in on port 25:
telnet mail.symphonicringtones.com 25
I just did this and got:
220 helena.eroute.net ESMTP Sendmail 8.12.10/8.12.10; Thu, 18 Nov 2004 03:47:36 +1300
So this means either it wasn't up when you tried, or your firewall is blocking it.
Once you have solved this, then tackle your authentication issues. In order to authenticate you need to create a javax.mail.Authenticator instance, then use this when you create the javamail session.
See:
http://java.sun.com/products/javamail/javadocs/javax/mail/Authenticator.html
and
http://java.sun.com/products/javamail/javadocs/javax/mail/Session.html#getInstance(java.util.Properties,%20javax.mail.Authenticator) -
Jaxrpc compilation exception(plz Help very Urgent Plz)
Hello there....
while deploying a simple webservice using deploytool i m getting this error while the application that is being deployed is not even using ejbs....
i m trying to compile the example given on the forum by Qusay H. Mahmoud, so plz help me to get out from this......
Thank u ....alll
distribute: C:\Sun\AppServer\apps\Add.war
deployment started : 0%
Deploying application in domain failed; Error while running ejbc -- Fatal Error from EJB Compiler -- jaxrpc compilation exception
; requested operation cannot be completed
!!! Operation Failed !!!
!!! With The Following Failure Messages !!!
Deploying application in domain failed; Error while running ejbc -- Fatal Error from EJB Compiler -- jaxrpc compilation exception
; requested operation cannot be completed
Error while running ejbc -- Fatal Error from EJB Compiler -- jaxrpc compilation exception
[Completed (time=24.0sec, status=13)]
**********************************************************************I had a similar problem with Sun App Server.If you can check the domain/log/Server.log.It explains a valid endpoint address is missing in the deployment.To do this open the deployment tool and click the Implementation class in the tree(Bean Shaped).
You can see a endpoint tab within which you need to configure the Endpoint address.
The deployment went fine after this.
Good Luck !!! -
Can't send mail...HELP
Hi
I just reasently moved, now I'm using sprint 2wire gateway to go online. I'm online I can surf and also receive mail. but I just can't send any mail.
This is the error message I receive
This message could not be delivered and will remain in your Outbox until it can be delivered.
Verify that you have addressed this message correctly. Check your SMTP server settings in Mail Preferences and verify any advanced settings with your system administrator.
the address is correct, but I'm not sure if I need to change some of my SMTP settings, since I'm using the sprint service now.
Can anyone help me???This indicates you have a .Mac account which is provided by Apple.
Most, if not all Internet Service Providers now block the use of SMTP servers that are outside of the ISP's network or not provided by the ISP on Port 25 which is the the standard or most common port used by SMTP servers to send mail.
Some ISPs allow the use of an authenticated SMTP server only (such as the .Mac SMTP server) on Port 25 but some block its use regardless. These restrictions are part of an overall effort to prevent or restrict spam emanating from the ISP's domain.
Something to try.
Go to Mail > Preferences > Accounts and under the Account Information tab for your .Mac account preferences at the SMTP server selection, select the Server Settings button below. Enter 587 in place of 25 in the Server Port field and when finished, select OK to save the changed setting.
Test if this resolves the problem.
If not and if Sprint provides an email account and SMTP server as part of their monthly service (which they should), you will need to create and select/use Sprint's SMTP server to send mail with your .Mac account which is invisible to all recipients. -
Migrating from Entourage and now can't send mail except from Mac account
I've just started using Mail after using Entourage for many years and I must say it's been a frustrating start (having separate applications for Mail, Address Book and Calendar is a pita so far). But most importantly I can't get Mail to allow me to send mail from any account other than from my .Mac account (no problems receiving mail). I'm using the same outgoing server settings as in Entourage but no joy - I get an error message saying it can't use the outgoing server. I have no problems with this in Entourage. For example, from Entourage I can send mail using my BT Internet account or my Bulldog Home account using the following outgoing mail server settings:
SMTP SERVER: mail.bulldoghome.com
ACCOUNT ID: [email protected]
PASSWORD: my email password
Also, how do I access my hotmail?Ok here's another one. When I delete a mail retrieved from a non Mac mail account (eg my BT Internet account) and empty my Trash in Mail it does not delete the email off the (BT Internet) server. I have not checked "remove copy from server after retrieving a message" so that I can access the email from multiple locations. But when I do delete it I obviously want it removed from the server.
-
I only recieve n not able to send text messages,,plz help
i only recieve n not able to send text messages,,plz help
Try this: Go to Settings > General > Reset > Reset Network Settings. After that, check if you can already sends SMS
-
hai guys,
i am getting the following exception when i try to execute my program which i have given below. can u guys sort this out for me
javax.mail.SendFailedException: Sending failed;
nested exception is:
class javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
class javax.mail.SendFailedException: 552 You must authenticate via SMTP
AUTH or you must POP first. See http://SoftHome.net/help/popfirst.html .
program:
import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;
import java.io.UnsupportedEncodingException;
public class MailExample {
public static void main (String args[]) {
String host = "mail.softhome.net";
String from = "[email protected]";
String to = "[email protected]";
try {
// Get system properties
Properties props = System.getProperties();
// Setup mail server
Authenticator auth = new PopupAuthenticator();
props.put("mail.smtp.host", host);
// Get session
Session session = Session.getInstance(props, auth);
//session.setDebug(true);
// Define message
MimeMessage message = new MimeMessage(session);
// Set the from address
message.setFrom(new InternetAddress(from,"FromName"));
// Set the to address
message.addRecipient(Message.RecipientType.TO,new InternetAddress(to,"ToName"));
// Set the subject
message.setSubject("Hello JavaMail");
// Set the content
message.setText("Welcome to JavaMail");
// Send message
Transport.send(message);
System.out.println("OK Man");
} catch (MessagingException e) {e.toString();System.out.println(e);
} catch (UnsupportedEncodingException e) {e.toString();System.out.println(e);
} catch (Exception e) {e.toString();System.out.println(e);}
static class PopupAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("UserName", "Password");
} }}try to add auth attribute to properties
eg.
props.put("mail.smtp.auth", "true"); -
Problem with Configuring Tomcat for running jsp web applications..Plz HELP
I am using Tomcat 5.5 and Jdk 1.5.0_12 and Oracle 10g. I am using jdbc-odbc bridge connection
to connect to the database. I have placed my project folder called
tdm under the webapps folder in Tomcat. This 'tdm' folder consists of
a collection of html pages,jsp pages and images of my project. Also I created a
WEB-INF folderand in that I have lib folder which contains catalina-root.jar
, classes12.jar and nls_charset.jar files. And also in the WEB-INF folder I have the web.xml
file which looks like this
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Copyright 2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<web-app>
<resource-ref>
<description>Oracle Datasource example</description>
<res-ref-name>jdbc/gdn</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>
My Server.xml file in Tomcat\conf folder is as follows
<!-- Example Server Configuration File -->
<!-- Note that component elements are nested corresponding to their
parent-child relationships with each other -->
<!-- A "Server" is a singleton element that represents the entire JVM,
which may contain one or more "Service" instances. The Server
listens for a shutdown command on the indicated port.
Note: A "Server" is not itself a "Container", so you may not
define subcomponents such as "Valves" or "Loggers" at this level.
-->
<Server port="8005" shutdown="SHUTDOWN">
<!-- Comment these entries out to disable JMX MBeans support used for the
administration web application -->
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<!-- Global JNDI resources -->
<GlobalNamingResources>
<!-- Test entry for demonstration purposes -->
<Environment name="simpleValue" type="java.lang.Integer" value="30"/>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users -->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
<Resource name="jdbc/gdn" auth="Container"
type="javax.sql.DataSource" driverClassName="sun.jdbc.odbc.JdbcOdbcDriver"
url="jdbc:odbc:gdn"
username="system" password="tiger" maxActive="20" maxIdle="10"
maxWait="-1"/>
</GlobalNamingResources>
<!-- A "Service" is a collection of one or more "Connectors" that share
a single "Container" (and therefore the web applications visible
within that Container). Normally, that Container is an "Engine",
but this is not required.
Note: A "Service" is not itself a "Container", so you may not
define subcomponents such as "Valves" or "Loggers" at this level.
-->
<!-- Define the Tomcat Stand-Alone Service -->
<Service name="Catalina">
<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Each Connector passes requests on to the
associated "Container" (normally an Engine) for processing.
By default, a non-SSL HTTP/1.1 Connector is established on port 8080.
You can also enable an SSL HTTP/1.1 Connector on port 8443 by
following the instructions below and uncommenting the second Connector
entry. SSL support requires the following steps (see the SSL Config
HOWTO in the Tomcat 5 documentation bundle for more detailed
instructions):
* If your JDK version 1.3 or prior, download and install JSSE 1.0.2 or
later, and put the JAR files into "$JAVA_HOME/jre/lib/ext".
* Execute:
%JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows)
$JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA (Unix)
with a password value of "changeit" for both the certificate and
the keystore itself.
By default, DNS lookups are enabled when a web application calls
request.getRemoteHost(). This can have an adverse impact on
performance, so you can disable it by setting the
"enableLookups" attribute to "false". When DNS lookups are disabled,
request.getRemoteHost() will return the String version of the
IP address of the remote client.
-->
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector
port="5050" maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
<!-- Note : To disable connection timeouts, set connectionTimeout value
to 0 -->
<!-- Note : To use gzip compression you could set the following properties :
compression="on"
compressionMinSize="2048"
noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/html,text/xml"
-->
<!-- Define a SSL HTTP/1.1 Connector on port 8443 -->
<!--
<Connector port="8443"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
-->
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009"
enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
<!-- Define a Proxied HTTP/1.1 Connector on port 8082 -->
<!-- See proxy documentation for more information about using this. -->
<!--
<Connector port="8082"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" acceptCount="100" connectionTimeout="20000"
proxyPort="80" disableUploadTimeout="true" />
-->
<!-- An Engine represents the entry point (within Catalina) that processes
every request. The Engine implementation for Tomcat stand alone
analyzes the HTTP headers included with the request, and passes them
on to the appropriate Host (virtual host). -->
<!-- You should set jvmRoute to support load-balancing via AJP ie :
<Engine name="Standalone" defaultHost="localhost" jvmRoute="jvm1">
-->
<!-- Define the top level container in our container hierarchy -->
<Engine name="Catalina" defaultHost="localhost">
<!-- The request dumper valve dumps useful debugging information about
the request headers and cookies that were received, and the response
headers and cookies that were sent, for all requests received by
this instance of Tomcat. If you care only about requests to a
particular virtual host, or a particular application, nest this
element inside the corresponding <Host> or <Context> entry instead.
For a similar mechanism that is portable to all Servlet 2.4
containers, check out the "RequestDumperFilter" Filter in the
example application (the source for this filter may be found in
"$CATALINA_HOME/webapps/examples/WEB-INF/classes/filters").
Request dumping is disabled by default. Uncomment the following
element to enable it. -->
<!--
<Valve className="org.apache.catalina.valves.RequestDumperValve"/>
-->
<!-- Because this Realm is here, an instance will be shared globally -->
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
<!-- Comment out the old realm but leave here for now in case we
need to go back quickly -->
<!--
<Realm className="org.apache.catalina.realm.MemoryRealm" />
-->
<!-- Replace the above Realm with one of the following to get a Realm
stored in a database and accessed via JDBC -->
<!--
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="org.gjt.mm.mysql.Driver"
connectionURL="jdbc:mysql://localhost/authority"
connectionName="test" connectionPassword="test"
userTable="users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name" />
-->
<!--
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="oracle.jdbc.driver.OracleDriver"
connectionURL="jdbc:oracle:thin:@ntserver:1521:ORCL"
connectionName="scott" connectionPassword="tiger"
userTable="users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name" />
-->
<!--
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="sun.jdbc.odbc.JdbcOdbcDriver"
connectionURL="jdbc:odbc:CATALINA"
userTable="users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name" />
-->
<!-- Define the default virtual host
Note: XML Schema validation will not work with Xerces 2.2.
-->
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<!-- Defines a cluster for this node,
By defining this element, means that every manager will be changed.
So when running a cluster, only make sure that you have webapps in there
that need to be clustered and remove the other ones.
A cluster has the following parameters:
className = the fully qualified name of the cluster class
name = a descriptive name for your cluster, can be anything
mcastAddr = the multicast address, has to be the same for all the nodes
mcastPort = the multicast port, has to be the same for all the nodes
mcastBindAddr = bind the multicast socket to a specific address
mcastTTL = the multicast TTL if you want to limit your broadcast
mcastSoTimeout = the multicast readtimeout
mcastFrequency = the number of milliseconds in between sending a "I'm alive" heartbeat
mcastDropTime = the number a milliseconds before a node is considered "dead" if no heartbeat is received
tcpThreadCount = the number of threads to handle incoming replication requests, optimal would be the same amount of threads as nodes
tcpListenAddress = the listen address (bind address) for TCP cluster request on this host,
in case of multiple ethernet cards.
auto means that address becomes
InetAddress.getLocalHost().getHostAddress()
tcpListenPort = the tcp listen port
tcpSelectorTimeout = the timeout (ms) for the Selector.select() method in case the OS
has a wakup bug in java.nio. Set to 0 for no timeout
printToScreen = true means that managers will also print to std.out
expireSessionsOnShutdown = true means that
useDirtyFlag = true means that we only replicate a session after setAttribute,removeAttribute has been called.
false means to replicate the session after each request.
false means that replication would work for the following piece of code: (only for SimpleTcpReplicationManager)
<%
HashMap map = (HashMap)session.getAttribute("map");
map.put("key","value");
%>
replicationMode = can be either 'pooled', 'synchronous' or 'asynchronous'.
* Pooled means that the replication happens using several sockets in a synchronous way. Ie, the data gets replicated, then the request return. This is the same as the 'synchronous' setting except it uses a pool of sockets, hence it is multithreaded. This is the fastest and safest configuration. To use this, also increase the nr of tcp threads that you have dealing with replication.
* Synchronous means that the thread that executes the request, is also the
thread the replicates the data to the other nodes, and will not return until all
nodes have received the information.
* Asynchronous means that there is a specific 'sender' thread for each cluster node,
so the request thread will queue the replication request into a "smart" queue,
and then return to the client.
The "smart" queue is a queue where when a session is added to the queue, and the same session
already exists in the queue from a previous request, that session will be replaced
in the queue instead of replicating two requests. This almost never happens, unless there is a
large network delay.
-->
<!--
When configuring for clustering, you also add in a valve to catch all the requests
coming in, at the end of the request, the session may or may not be replicated.
A session is replicated if and only if all the conditions are met:
1. useDirtyFlag is true or setAttribute or removeAttribute has been called AND
2. a session exists (has been created)
3. the request is not trapped by the "filter" attribute
The filter attribute is to filter out requests that could not modify the session,
hence we don't replicate the session after the end of this request.
The filter is negative, ie, anything you put in the filter, you mean to filter out,
ie, no replication will be done on requests that match one of the filters.
The filter attribute is delimited by ;, so you can't escape out ; even if you wanted to.
filter=".*\.gif;.*\.js;" means that we will not replicate the session after requests with the URI
ending with .gif and .js are intercepted.
The deployer element can be used to deploy apps cluster wide.
Currently the deployment only deploys/undeploys to working members in the cluster
so no WARs are copied upons startup of a broken node.
The deployer watches a directory (watchDir) for WAR files when watchEnabled="true"
When a new war file is added the war gets deployed to the local instance,
and then deployed to the other instances in the cluster.
When a war file is deleted from the watchDir the war is undeployed locally
and cluster wide
-->
<!--
<Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
managerClassName="org.apache.catalina.cluster.session.DeltaManager"
expireSessionsOnShutdown="false"
useDirtyFlag="true"
notifyListenersOnReplication="true">
<Membership
className="org.apache.catalina.cluster.mcast.McastService"
mcastAddr="228.0.0.4"
mcastPort="45564"
mcastFrequency="500"
mcastDropTime="3000"/>
<Receiver
className="org.apache.catalina.cluster.tcp.ReplicationListener"
tcpListenAddress="auto"
tcpListenPort="4001"
tcpSelectorTimeout="100"
tcpThreadCount="6"/>
<Sender
className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
replicationMode="pooled"
ackTimeout="15000"/>
<Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"
filter=".*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;"/>
<Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
tempDir="/tmp/war-temp/"
deployDir="/tmp/war-deploy/"
watchDir="/tmp/war-listen/"
watchEnabled="false"/>
</Cluster>
-->
<!-- Normally, users must authenticate themselves to each web app
individually. Uncomment the following entry if you would like
a user to be authenticated the first time they encounter a
resource protected by a security constraint, and then have that
user identity maintained across all web applications contained
in this virtual host. -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- Access log processes all requests for this virtual host. By
default, log files are created in the "logs" directory relative to
$CATALINA_HOME. If you wish, you can specify a different
directory with the "directory" attribute. Specify either a relative
(to $CATALINA_HOME) or absolute path to the desired directory.
-->
<!--
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="localhost_access_log." suffix=".txt"
pattern="common" resolveHosts="false"/>
-->
<!-- Access log processes all requests for this virtual host. By
default, log files are created in the "logs" directory relative to
$CATALINA_HOME. If you wish, you can specify a different
directory with the "directory" attribute. Specify either a relative
(to $CATALINA_HOME) or absolute path to the desired directory.
This access log implementation is optimized for maximum performance,
but is hardcoded to support only the "common" and "combined" patterns.
-->
<!--
<Valve className="org.apache.catalina.valves.FastCommonAccessLogValve"
directory="logs" prefix="localhost_access_log." suffix=".txt"
pattern="common" resolveHosts="false"/>
-->
<Context path="/tdm" docBase="tdm" debug="0" reloadable="true" />
</Host>
</Engine>
</Service>
</Server>
I have set the context path to /tdm in the server.xml file. Should this be placed in context.xml?
My first page in the project is called Homepage.html. To start my project I give http://localhost:5050/tdm/homepage.html
in a browser. Here I accept a username and password from the user and then do the validation in
a valid.jsp file, where I connect to the database and check and use jsp:forward to go to next pages
accordingly. However when I enter the username and password and click Go in the homepage, nothing is
displayed on the next page. The URL in the browser says valid.jsp but a blank screen appears.
WHY DOES IT HAPPEN SO? DOES IT MEAN THAT TOMCAT IS NOT RECOGNIZING JAVA IN MY SYSTEM OR IS IT A PROBLEM
WITH THE DATABASE CONNECTION OR SOMETHING ELSE? I FEEL THAT TOMCAT IS NOT EXECUTING JSP COMMANDS?
IS IT POSSIBLE?WHY WILL THIS HAPPEN?
I set the JAVA_HOME and CATALINA_HOME environment to the jdk and tomcat folders resp.
Is there any other thing that I need to set in classpath? Should I have my project as a
WAR file in the webapps of TOMCAT or just a folder i.e. directory structure will fine?I am using Tomcat 5.5 and Jdk 1.5.0_12 and Oracle 10g. I am using jdbc-odbc bridge connection
to connect to the database. I have placed my project folder called
tdm under the webapps folder in Tomcat. This 'tdm' folder consists of
a collection of html pages,jsp pages and images of my project. Also I created a
WEB-INF folderand in that I have lib folder which contains catalina-root.jar
, classes12.jar and nls_charset.jar files. And also in the WEB-INF folder I have the web.xml
file which looks like this
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Copyright 2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<web-app>
<resource-ref>
<description>Oracle Datasource example</description>
<res-ref-name>jdbc/gdn</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>
My Server.xml file in Tomcat\conf folder is as follows
<!-- Example Server Configuration File -->
<!-- Note that component elements are nested corresponding to their
parent-child relationships with each other -->
<!-- A "Server" is a singleton element that represents the entire JVM,
which may contain one or more "Service" instances. The Server
listens for a shutdown command on the indicated port.
Note: A "Server" is not itself a "Container", so you may not
define subcomponents such as "Valves" or "Loggers" at this level.
-->
<Server port="8005" shutdown="SHUTDOWN">
<!-- Comment these entries out to disable JMX MBeans support used for the
administration web application -->
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<!-- Global JNDI resources -->
<GlobalNamingResources>
<!-- Test entry for demonstration purposes -->
<Environment name="simpleValue" type="java.lang.Integer" value="30"/>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users -->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
<Resource name="jdbc/gdn" auth="Container"
type="javax.sql.DataSource" driverClassName="sun.jdbc.odbc.JdbcOdbcDriver"
url="jdbc:odbc:gdn"
username="system" password="tiger" maxActive="20" maxIdle="10"
maxWait="-1"/>
</GlobalNamingResources>
<!-- A "Service" is a collection of one or more "Connectors" that share
a single "Container" (and therefore the web applications visible
within that Container). Normally, that Container is an "Engine",
but this is not required.
Note: A "Service" is not itself a "Container", so you may not
define subcomponents such as "Valves" or "Loggers" at this level.
-->
<!-- Define the Tomcat Stand-Alone Service -->
<Service name="Catalina">
<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Each Connector passes requests on to the
associated "Container" (normally an Engine) for processing.
By default, a non-SSL HTTP/1.1 Connector is established on port 8080.
You can also enable an SSL HTTP/1.1 Connector on port 8443 by
following the instructions below and uncommenting the second Connector
entry. SSL support requires the following steps (see the SSL Config
HOWTO in the Tomcat 5 documentation bundle for more detailed
instructions):
* If your JDK version 1.3 or prior, download and install JSSE 1.0.2 or
later, and put the JAR files into "$JAVA_HOME/jre/lib/ext".
* Execute:
%JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows)
$JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA (Unix)
with a password value of "changeit" for both the certificate and
the keystore itself.
By default, DNS lookups are enabled when a web application calls
request.getRemoteHost(). This can have an adverse impact on
performance, so you can disable it by setting the
"enableLookups" attribute to "false". When DNS lookups are disabled,
request.getRemoteHost() will return the String version of the
IP address of the remote client.
-->
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector
port="5050" maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
<!-- Note : To disable connection timeouts, set connectionTimeout value
to 0 -->
<!-- Note : To use gzip compression you could set the following properties :
compression="on"
compressionMinSize="2048"
noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/html,text/xml"
-->
<!-- Define a SSL HTTP/1.1 Connector on port 8443 -->
<!--
<Connector port="8443"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
-->
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009"
enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
<!-- Define a Proxied HTTP/1.1 Connector on port 8082 -->
<!-- See proxy documentation for more information about using this. -->
<!--
<Connector port="8082"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" acceptCount="100" connectionTimeout="20000"
proxyPort="80" disableUploadTimeout="true" />
-->
<!-- An Engine represents the entry point (within Catalina) that processes
every request. The Engine implementation for Tomcat stand alone
analyzes the HTTP headers included with the request, and passes them
on to the appropriate Host (virtual host). -->
<!-- You should set jvmRoute to support load-balancing via AJP ie :
<Engine name="Standalone" defaultHost="localhost" jvmRoute="jvm1">
-->
<!-- Define the top level container in our container hierarchy -->
<Engine name="Catalina" defaultHost="localhost">
<!-- The request dumper valve dumps useful debugging information about
the request headers and cookies that were received, and the response
headers and cookies that were sent, for all requests received by
this instance of Tomcat. If you care only about requests to a
particular virtual host, or a particular application, nest this
element inside the corresponding <Host> or <Context> entry instead.
For a similar mechanism that is portable to all Servlet 2.4
containers, check out the "RequestDumperFilter" Filter in the
example application (the source for this filter may be found in
"$CATALINA_HOME/webapps/examples/WEB-INF/classes/filters").
Request dumping is disabled by default. Uncomment the following
element to enable it. -->
<!--
<Valve className="org.apache.catalina.valves.RequestDumperValve"/>
-->
<!-- Because this Realm is here, an instance will be shared globally -->
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
<!-- Comment out the old realm but leave here for now in case we
need to go back quickly -->
<!--
<Realm className="org.apache.catalina.realm.MemoryRealm" />
-->
<!-- Replace the above Realm with one of the following to get a Realm
stored in a database and accessed via JDBC -->
<!--
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="org.gjt.mm.mysql.Driver"
connectionURL="jdbc:mysql://localhost/authority"
connectionName="test" connectionPassword="test"
userTable="users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name" />
-->
<!--
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="oracle.jdbc.driver.OracleDriver"
connectionURL="jdbc:oracle:thin:@ntserver:1521:ORCL"
connectionName="scott" connectionPassword="tiger"
userTable="users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name" />
-->
<!--
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="sun.jdbc.odbc.JdbcOdbcDriver"
connectionURL="jdbc:odbc:CATALINA"
userTable="users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name" />
-->
<!-- Define the default virtual host
Note: XML Schema validation will not work with Xerces 2.2.
-->
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<!-- Defines a cluster for this node,
By defining this element, means that every manager will be changed.
So when running a cluster, only make sure that you have webapps in there
that need to be clustered and remove the other ones.
A cluster has the following parameters:
className = the fully qualified name of the cluster class
name = a descriptive name for your cluster, can be anything
mcastAddr = the multicast address, has to be the same for all the nodes
mcastPort = the multicast port, has to be the same for all the nodes
mcastBindAddr = bind the multicast socket to a specific address
mcastTTL = the multicast TTL if you want to limit your broadcast
mcastSoTimeout = the multicast readtimeout
mcastFrequency = the number of milliseconds in between sending a "I'm alive" heartbeat
mcastDropTime = the number a milliseconds before a node is considered "dead" if no heartbeat is received
tcpThreadCount = the number of threads to handle incoming replication requests, optimal would be the same amount of threads as nodes
tcpListenAddress = the listen address (bind address) for TCP cluster request on this host,
in case of multiple ethernet cards.
auto means that address becomes
InetAddress.getLocalHost().getHostAddress()
tcpListenPort = the tcp listen port
tcpSelectorTimeout = the timeout (ms) for the Selector.select() method in case the OS
has a wakup bug in java.nio. Set to 0 for no timeout
printToScreen = true means that managers will also print to std.out
expireSessionsOnShutdown = true means that
useDirtyFlag = true means that we only replicate a session after setAttribute,removeAttribute has been called.
false means to replicate the session after each request.
false means that replication would work for the following piece of code: (only for SimpleTcpReplicationManager)
<%
HashMap map = (HashMap)session.getAttribute("map");
map.put("key","value");
%>
replicationMode = can be either 'pooled', 'synchronous' or 'asynchronous'.
* Pooled means that the replication happens using several sockets in a synchronous way. Ie, the data gets replicated, then the request return. This is the same as the 'synchronous' setting except it uses a pool of sockets, hence it is multithreaded. This is the fastest and safest configuration. To use this, also increase the nr of tcp threads that you have dealing with replication.
* Synchronous means that the thread that executes the request, is also the
thread the replicates the data to the other nodes, and will not return until all
nodes have received the information.
* Asynchronous means that there is a specific 'sender' thread for each cluster node,
so the request thread will queue the replication request into a "smart" queue,
and then return to the client.
The "smart" queue is a queue where when a session is added to the queue, and the same session
already exists in the queue from a previous request, that session will be replaced
in the queue instead of replicating two requests. This almost never happens, unless there is a
large network delay.
-->
<!--
When configuring for clustering, you also add in a valve to catch all the requests
coming in, at the end of the request, the session may or may not be replicated.
A session is replicated if and only if all the conditions are met:
1. useDirtyFlag is true or setAttribute or removeAttribute has been called AND
2. a session exists (has been created)
3. the request is not trapped by the "filter" attribute
The filter attribute is to filter out requests that could not modify the session,
hence we don't replicate the session after the end of this request.
The filter is negative, ie, anything you put in the filter, you mean to filter out,
ie, no replication will be done on requests that match one of the filters.
The filter attribute is delimited by ;, so you can't escape out ; even if you wanted to.
filter=".*\.gif;.*\.js;" means that we will not replicate the session after requests with the URI
ending with .gif and .js are intercepted.
The deployer element can be used to deploy apps cluster wide.
Currently the deployment only deploys/undeploys to working members in the cluster
so no WARs are copied upons startup of a broken node.
The deployer watches a directory (watchDir) for WAR files when watchEnabled="true"
When a new war file is added the war gets deployed to the local instance,
and then deployed to the other instances in the cluster.
When a war file is deleted from the watchDir the war is undeployed locally
and cluster wide
-->
<!--
<Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
managerClassName="org.apache.catalina.cluster.session.DeltaManager"
expireSessionsOnShutdown="false"
useDirtyFlag="true"
notifyListenersOnReplication="true">
<Membership
className="org.apache.catalina.cluster.mcast.McastService"
mcastAddr="228.0.0.4"
mcastPort="45564"
mcastFrequency="500"
mcastDropTime="3000"/>
<Receiver
className="org.apache.catalina.cluster.tcp.ReplicationListener"
tcpListenAddress="auto"
tcpListenPort="4001"
tcpSelectorTimeout="100"
tcpThreadCount="6"/>
<Sender
className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
replicationMode="pooled"
ackTimeout="15000"/>
<Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"
filter=".*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;"/>
<Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
tempDir="/tmp/war-temp/"
deployDir="/tmp/war-deploy/"
watchDir="/tmp/war-listen/"
watchEnabled="false"/>
</Cluster>
-->
<!-- Normally, users must authenticate themselves to each web app
individually. Uncomment the following entry if you would like
a user to be authenticated the first time they encounter a
resource protected by a security constraint, and then have that
user identity maintained across all web applications contained
in this virtual host. -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- Access log processes all requests for this virtual host. By
default, log files are created in the "logs" directory relative to
$CATALINA_HOME. If you wish, you can specify a different
directory with the "directory" attribute. Specify either a relative
(to $CATALINA_HOME) or absolute path to the desired directory.
-->
<!--
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="localhost_access_log." suffix=".txt"
pattern="common" resolveHosts="false"/>
-->
<!-- Access log processes all requests for this virtual host. By
default, log files are created in the "logs" directory relative to
$CATALINA_HOME. If you wish, you can specify a different
directory with the "directory" attribute. Specify either a relative
(to $CATALINA_HOME) or absolute path to the desired directory.
This access log implementation is optimized for maximum performance,
but is hardcoded to support only the "common" and "combined" patterns.
-->
<!--
<Valve className="org.apache.catalina.valves.FastCommonAccessLogValve"
directory="logs" prefix="localhost_access_log." suffix=".txt"
pattern="common" resolveHosts="false"/>
-->
<Context path="/tdm" docBase="tdm" debug="0" reloadable="true" />
</Host>
</Engine>
</Service>
</Server>
I have set the context path to /tdm in the server.xml file. Should this be placed in context.xml?
My first page in the project is called Homepage.html. To start my project I give http://localhost:5050/tdm/homepage.html
in a browser. Here I accept a username and password from the user and then do the validation in
a valid.jsp file, where I connect to the database and check and use jsp:forward to go to next pages
accordingly. However when I enter the username and password and click Go in the homepage, nothing is
displayed on the next page. The URL in the browser says valid.jsp but a blank screen appears.
WHY DOES IT HAPPEN SO? DOES IT MEAN THAT TOMCAT IS NOT RECOGNIZING JAVA IN MY SYSTEM OR IS IT A PROBLEM
WITH THE DATABASE CONNECTION OR SOMETHING ELSE? I FEEL THAT TOMCAT IS NOT EXECUTING JSP COMMANDS?
IS IT POSSIBLE?WHY WILL THIS HAPPEN?
I set the JAVA_HOME and CATALINA_HOME environment to the jdk and tomcat folders resp.
Is there any other thing that I need to set in classpath? Should I have my project as a
WAR file in the webapps of TOMCAT or just a folder i.e. directory structure will fine? -
Cannot Send Mail - Error, Need help!
I can not send e-mail. Error message reads,
"The recipient "[email protected]"was rejected by the server."
Initialy I was getting an error message about "Authentication" but when I took User Name and Password for SMTP, that error disappered, but now I'm getting the above message.
Did anyone figure out the trick to get around this and send e-mails out?
eMachine Windows XP
eMachine Windows XPAlexMaeda,
This article has more information:
http://docs.info.apple.com/article.html?artnum=305634
As for an email provider allowing customers to relay outside of their network, many email providers, set up an authenticating SMTP server on different port. The article above includes information on specifying the port to use.
For example, .Mac accounts can use port 587 as discussed in this article:
http://docs.info.apple.com/article.html?artnum=75124
You may want to check with your email provider if they offer an authenticating smtp server for people who are traveling or using mobile devices. Many do so without any additional cost, some may charge for access to that service.
Hope this helps,
Nathan C. -
Sending mail problem (please help)
I have downloaded all necessary components javamail-1_2.zip and jaf1_0_1.zip. I included them in my classpath too (activation.jar and mail.jar). I used Exchange Server 2000 as smtp server. But when i try sending an email the message appears like this:
sending error cannot relay for sending [email protected]
When i tried the same code in my ISP (www.mycgiserver.com) it work very fine. Here is the code. Where is the problem? Please help me...
<%
// Take massege properties
String mBody = request.getParameter("mBody");
String from1 = request.getParameter("from");
String to1 = request.getParameter("to");
String subject = request.getParameter("subject");
Properties props = new Properties();
props.put("ipNo.........:25", "smtp.mail.blah.com");
Session s = Session.getInstance(props,null);
Message message = new MimeMessage(s);
InternetAddress from = new InternetAddress(from1);
message.setFrom(from);
InternetAddress to = new InternetAddress(to1);
message.setRecipient(Message.RecipientType.TO, to);
message.setText(mBody);
message.setSubject(subject);
Transport.send(message);
%>the problem i feel is in your smtp relay and probably not in ur code . some smtp relay servers are configured such that they relay only on authentication or from a specific IP or from a specific subnet mask only to prevent spammers . check out the info on ur local relay server and also see other postings specific on relay ....that shud be of help i guess
-
suppose, uploading a pic in facebook from hard drive. after i choose the pic or even if do not choose the pic. click on ok of the select picture dialog box. BANG!! the firefox window stops responding.
You can easily delete your old Website data from your iDisk, and start 'fresh'. In the finder:
Go/iDisk/My iDisk/Web/Sites/iWeb
You will see an index.html file and a folder for iWeb. If you highlight these and Command+delete, they will be deleted from your iDisk.
(BTW, I don't know if you still have the dead HD, but if you do and you feel adventurous, here's an interesting thread on that subject:)
http://discussions.apple.com/thread.jspa?messageID=2051344� -
Unknown exception in sending mail
Hi,
I have written a jsp send mail application, but it is giving error that NoSuchProviderException. What to do? Plz help. I m sending the code as below:
<%@ page import="java.util.*, javax.mail.*,javax.mail.internet.*" %>
<html>
<head>
<title>E-Mail Us</title>
</head>
<body bgcolor="white" text="#003399" >
<%
if(request.getMethod().equals("POST") )
boolean status = true;
String mailServer ="SMTP_HOST";
String fnm = request.getParameter("fnm");
String lnm = request.getParameter("lnm");
String facility = request.getParameter("facility");
String subject = request.getParameter("select");
String fromEmail = "[email protected]";
String toEmail = "[email protected]";
String bccEmail = "[email protected]";
String contact =request.getParameter("select2");
String way =request.getParameter("way");
String messageEnter = request.getParameter("message");
try
Properties props = new Properties();
props.put("mail.smtp.host", mailServer);
props.put("mail.smtp.auth", "true");
Session s = Session.getInstance(props,null);
MimeMessage message = new MimeMessage(s);
InternetAddress from = new InternetAddress(fromEmail);
message.setFrom(from);
InternetAddress to = new InternetAddress(toEmail);
InternetAddress bcc = new InternetAddress(bccEmail);
message.addRecipient(Message.RecipientType.TO, to);
message.addRecipient(Message.RecipientType.BCC, bcc);
message.setSubject(subject);
message.setSentDate(new Date());
message.setText(messageEnter);
message.setText(way);
message.setText(contact);
message.setText(facility);
message.setText(fnm);
message.setText(lnm);
Transport transport = s.getTransport(mailServer);
transport.connect(mailServer, "USER", "PASSWORD");
transport.sendMessage(message, message.getAllRecipients());
transport.close();
catch(NullPointerException n)
System.out.println(n.getMessage() );
out.println(n.getMessage());
out.println("<br><br><br><br><center><b>"+" ERROR!!!"+"</b></center>");//you need to enter a message"+"</b></center>");
out.println("<br><br><center><b>"+"You need to Enter a message"+"</b></center>");
status = false;
catch (Exception e)
System.out.println(e.getMessage() );
out.println("<br><br><br><br><center><b>"+" ERROR!!!"+"</b></center>");
out.println("<br><br><center><b>"+"Your Message to " + toEmail +" and "+ bccEmail+ " failed, reason is: " + e);
status = false;
if (status == true)
out.println("<br><br><center><b>"+"Your message to " + toEmail +" and "+ bccEmail+ " was sent successfully!"+"</b></center>");
else
%>
<center>
<h1>Contact Us</h1>
<form method="post" name="mail" action="mail.jsp">
<table border="0">
<tr>
<td><b>First Name :</b></td>
<td><input type="text" name="fnm" size=24></td>
</tr>
<tr>
<td><b>Last Name :</b></td>
<td><input type="text" name="lnm" size=24></td>
</tr>
<tr>
<td><b>Facility :</b></td>
<td><input type="text" name="facility" size=24></td>
</tr>
<tr>
<td><b>Subject :</b></td>
<td> <select name="select">
<option>-------------------------------</option>
<option>Missing File</option>
<option>Correction Issue</option>
<option>Refer Us</option>
<option>Miscellaneous</option>
</select></td>
</tr>
<p>
<tr>
<td><b>Comments :</b></td>
<td><textarea name="message" rows = "10" cols="50"></textarea></td>
</tr>
<tr>
<td><b>Best way to contact :</b></td>
<td>
<select name="select2">
<option>--------------</option>
<option>Phone</option>
<option>Email</option>
<option>Fax</option>
</select>
<input type="text" name="way" size=24></td>
</tr>
</table>
<p>
<font face="Helvetica"><input type="submit"
value="Submit" name="Command">
</font>
</form></center>
<%
%>
</body>
</html>unkHi,
Have you configured the SMTP server settings in the various config files for the new version that you are using? Your log seems to suggest that it is still set to 'mail' which I think is the default.
I think the minimum you need to do is Essbase, Financial Reporting and Workspace, files as detailed below (paths may vary depending upon platform, windows & tomcat provided below even though it sounds like you've done this before).
Essbase: C:\Hyperion\AnalyticAdministrationServices\server\ OlapAdmin.properties
Financial Reporting: C:\Hyperion\BIPlus\lib\ fr_global.properties
Workspace: log in and select Navigate > Administer > Notifications
You may also need to restart the related services.
Hope this helps
Stuart Game
www.analitica.co.uk -
Adding "window to a container:illegal argument exception".error plz help
Thanks to Mr.Andrew and sun for developing the following code for a
mediaplayer which is implemented in jmf.This is working in core java. But
when i have converted it to Applet it compiles but an error adding "window
to a container:illegal argument exception".code is given below plz point
me where is the error;
import javax.media.*;
import java.text.DecimalFormat;
import java.awt.*;
import java.awt.FileDialog;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
import java.io.*;
import java.net.*;
import java.util.*;
class nwa extends WindowAdapter{
frameclass frame;
public nwa(frameclass frame){
this.frame=frame;
public void windowClosing (WindowEvent e)
//User selected close from System menu.
//Call dispose to invoke windowClosed.
frame.dispose ();
public void windowClosed (WindowEvent e)
//if (player != null)
//player.close ();
System.exit (0);
class frameclass extends JFrame
frameclass(){
nwa n=new nwa(this);
this.addWindowListener(n);
public class PlayerApplet extends JApplet
implements
ActionListener,ControllerListener,ItemListener, KeyListener
frameclass frame=new frameclass();
Player player;
Component vc, cc;
JProgressBar volumeBar;
JButton fastRewind;
JButton fastForward;
JButton play;
int sizeIncrease = 2;
boolean invokedStop = false;
/** Big */
int progressFontSize=30;
boolean first = true, loop = false;
String currentDirectory;
public void init(){
JMenu m = new JMenu ("File");
JMenuItem mi = new JMenuItem ("Open...");
mi.addActionListener (this);
m.add (mi);
m.addSeparator ();
JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem ("Loop", false);
cbmi.addItemListener (this);
m.add (cbmi);
m.addSeparator ();
mi = new JMenuItem ("Exit");
mi.addActionListener (this);
m.add (mi);
JMenuBar mb = new JMenuBar ();
mb.add (m);
frame.setJMenuBar (mb);
setSize (200, 200);
final JPanel p = new JPanel(new GridLayout(1,0,5,5));
p.setBorder(new EmptyBorder(3,5,5,5) );
fastRewind = new JButton("<html><body><font size=+"+
sizeIncrease+ "><<");
fastRewind.setToolTipText("Fast Rewind");
fastRewind.addActionListener( new ActionListener(){
public void actionPerformed(ActionEvent ae) {
if (player!=null) {
invokedStop = false;
skipBack();
} else {
JOptionPane.showMessageDialog(play,
new JLabel("Open a sound file
first!"));
fastRewind.addKeyListener(this);
p.add(fastRewind);
JButton stop = new JButton("<html><body><font size=+"+
sizeIncrease+ ">■");
stop.setToolTipText("Stop");
stop.addActionListener( new ActionListener(){
public void actionPerformed(ActionEvent ae) {
invokedStop = true;
//player.stop();
sp();
stop.addKeyListener(this);
p.add(stop);
play = new JButton("<html><body><font size=+"+
sizeIncrease+ ">>");
play.setToolTipText("Play");
play.addActionListener( new ActionListener(){
public void actionPerformed(ActionEvent ae) {
if (player!=null) {
invokedStop = false;
player.setRate(1);
st();
} else {
JOptionPane.showMessageDialog(play,
new JLabel("Open a sound file
first!"));
play.addKeyListener(this);
p.add(play);
fastForward = new JButton("<html><body><font size=+"+
sizeIncrease+ ">>>");
fastForward.setToolTipText("Fast Forward");
fastForward.addActionListener( new ActionListener(){
public void actionPerformed(ActionEvent ae) {
if (player!=null) {
invokedStop = false;
skipForward();
} else {
JOptionPane.showMessageDialog(play,
new JLabel("Open a sound file
first!"));
fastForward.addKeyListener(this);
p.add(fastForward);
p.addKeyListener(this);
frame.add(p,BorderLayout.CENTER);
add(frame);
// pack ();
setVisible (true);
public void start(){
st();
public void stop(){
sp();
public void destroy(){
player.stop();
player.deallocate();
public void actionPerformed (ActionEvent e)
if (e.getActionCommand().equals("Exit"))
// Call dispose to invoke windowClosed.
frame.dispose ();
return;
FileDialog fd = new FileDialog (frame, "Open File",
FileDialog.LOAD);
fd.setDirectory (currentDirectory);
fd.show ();
// If user cancelled, exit.
if (fd.getFile() == null)
return;
currentDirectory = fd.getDirectory ();
if (player != null)
player.close ();
try
player = Manager.createPlayer (new MediaLocator
("file:" +
fd.getDirectory() +
fd.getFile()));
catch (java.io.IOException e2)
System.out.println (e2);
return;
catch (NoPlayerException e2)
System.out.println ("Could not find a player.");
return;
if (player == null)
System.out.println ("Trouble creating a player.");
return;
first = false;
frame.setTitle (fd.getFile ().toString());
player.addControllerListener (this);
player.prefetch ();
public void controllerUpdate (ControllerEvent e)
if (e instanceof ControllerClosedEvent)
if (vc != null)
remove (vc);
vc = null;
if (cc != null)
remove (cc);
cc = null;
return;
if (e instanceof EndOfMediaEvent)
if (loop)
player.setMediaTime (new Time (0));
player.start ();
return;
if (e instanceof PrefetchCompleteEvent)
player.start ();
return;
if (e instanceof RealizeCompleteEvent)
vc = player.getVisualComponent ();
if (vc != null)
add (vc);
cc = player.getControlPanelComponent ();
if (cc != null){
this.add (cc, BorderLayout.SOUTH);
this.show();
public void keyReleased(KeyEvent ke) {
int keycode = ke.getKeyCode();
if (keycode==KeyEvent.VK_LEFT) {
skipBack();
} else if (keycode==KeyEvent.VK_RIGHT) {
skipForward();
public void keyTyped(KeyEvent ke) {
int keycode = ke.getKeyCode();
if (keycode==KeyEvent.VK_LEFT) {
skipBack();
} else if (keycode==KeyEvent.VK_RIGHT) {
skipForward();
public void keyPressed(KeyEvent ke) {
int keycode = ke.getKeyCode();
if (keycode==KeyEvent.VK_LEFT) {
skipBack();
} else if (keycode==KeyEvent.VK_RIGHT) {
skipForward();
}else if (keycode==KeyEvent.VK_UP) {
st();
}else if (keycode==KeyEvent.VK_DOWN) {
sp();
public void skipForward() {
double secs=5;
double playersecs = player.getMediaTime().getSeconds();
Time settime = new javax.media.Time(playersecs + secs);
player.setMediaTime(settime);
public void skipBack() {
double secs1=5;
double playersecs1 = player.getMediaTime().getSeconds();
Time settime1 = new javax.media.Time(playersecs1 - secs1);
player.setMediaTime(settime1);
public void st() {
player.start();
public void sp() {
player.stop();
public void itemStateChanged (ItemEvent e)
loop = !loop;
When i comment add(frame) this error goes but i got a null poiter
exception
Plz help
manuHi Andrew,
Thanks for ur reply.Sorrry that my code not included in the code block.
My problem have been solved partly.Now playerapplet is working properly.It can play files from local machine(through open menuitem from file menu) as well as local network (through url menuitem from file menu).
There is no requirement to play file from internet at present.
I have given arrow keys to forward/backward/open/close.
I have now completed my first part of project.Now i have to start the second part ie Controlling arrow keys using a joystick like instrument.The instrument and driver will be provided by my co. and the user is using only this device.Plz help me how to do that.
The code is given below
import javax.media.*;
import java.text.DecimalFormat;
import java.awt.*;
import java.awt.FileDialog;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
import java.io.*;
import java.net.*;
import java.util.*;
<APPLET CODE=PlayerApplet.class
WIDTH=320 HEIGHT=300>
</APPLET>
class nwa extends WindowAdapter
frameclass frame;
Player player;
public nwa(frameclass frame,Player player)
this.player=player;
this.frame=frame;
public void windowClosing (WindowEvent e)
//User selected close from System menu.
//Call dispose to invoke windowClosed.
frame.dispose ();
public void windowClosed (WindowEvent e)
if (player != null)
player.stop();
player.close ();
player.deallocate();
System.exit (0);
class frameclass extends JFrame
Player player;
frameclass(Player player)
nwa n=new nwa(this,player);
this.addWindowListener(n);
public class PlayerApplet extends JApplet
implements ActionListener,ControllerListener,ItemListener, KeyListener
Player player=null;
frameclass frame=new frameclass(player);
Component vc, cc;
Container f;
JProgressBar volumeBar;
JButton fastRewind;
JButton fastForward;
JButton play;
int sizeIncrease = 2;
boolean invokedStop = false;
/** Big */
int progressFontSize=30;
boolean first = true, loop = false;
String currentDirectory;
public void init()
f=frame.getContentPane();
JMenu m = new JMenu ("File");
JMenuItem mi = new JMenuItem ("Open...");
mi.addActionListener (this);
m.add (mi);
m.addSeparator ();
mi = new JMenuItem ("URL");
mi.addActionListener (this);
m.add (mi);
m.addSeparator ();
JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem ("Loop", false);
cbmi.addItemListener (this);
m.add (cbmi);
m.addSeparator ();
mi = new JMenuItem ("Exit");
mi.addActionListener (this);
m.add (mi);
JMenuBar mb = new JMenuBar ();
mb.add (m);
frame.setJMenuBar (mb);
setSize (500, 500);
JPanel p = new JPanel(new GridLayout(1,0,5,5));
p.setBorder(new EmptyBorder(3,5,5,5) );
fastRewind = new JButton("<html><body><font size=+"+ sizeIncrease+ "><<");
fastRewind.setToolTipText("Fast Rewind");
fastRewind.addActionListener( new ActionListener(){
public void actionPerformed(ActionEvent ae) {
if (player!=null) {
invokedStop = false;
skipBack();
} else {
JOptionPane.showMessageDialog(play,
new JLabel("Open a sound file first!"));
fastRewind.addKeyListener(this);
p.add(fastRewind);
JButton stop = new JButton("<html><body><font size=+"+ sizeIncrease+ ">■");
stop.setToolTipText("Stop");
stop.addActionListener( new ActionListener(){
public void actionPerformed(ActionEvent ae) {
invokedStop = true;
sp();
stop.addKeyListener(this);
p.add(stop);
play = new JButton("<html><body><font size=+"+ sizeIncrease+ ">>");
play.setToolTipText("Play");
play.addActionListener( new ActionListener()
public void actionPerformed(ActionEvent ae) {
if (player!=null) {
invokedStop = false;
player.setRate(1);
st();
} else {
JOptionPane.showMessageDialog(play,
new JLabel("Open a sound file first!"));
play.addKeyListener(this);
p.add(play);
fastForward = new JButton("<html><body><font size=+"+ sizeIncrease+ ">>>");
fastForward.setToolTipText("Fast Forward");
fastForward.addActionListener( new ActionListener(){
public void actionPerformed(ActionEvent ae) {
if (player!=null) {
invokedStop = false;
skipForward();
} else {
JOptionPane.showMessageDialog(play,
new JLabel("Open a sound file first!"));
fastForward.addKeyListener(this);
p.add(fastForward);
frame.getContentPane().add(p,BorderLayout.CENTER);
frame.setVisible (true);
frame.pack();
frame.setResizable(false);
public void stop(){
sp();
public void destroy(){
player.stop();
player.deallocate();
public void actionPerformed (ActionEvent e)
if (e.getActionCommand().equals("Exit"))
// Call dispose to invoke windowClosed.
player.stop();
player.close();
player.deallocate();
frame.dispose ();
return;
if (e.getActionCommand().equals("Open..."))
FileDialog fd = new FileDialog (frame, "Open File",
FileDialog.LOAD);
fd.setDirectory (currentDirectory);
fd.show ();
// If user cancelled, exit.
if (fd.getFile() == null)
return;
currentDirectory = fd.getDirectory ();
if (player != null){
player.close ();
player.deallocate();
try
player = Manager.createPlayer (new MediaLocator
("file:" +
fd.getDirectory() +
fd.getFile()));
catch (java.io.IOException e2)
System.out.println ("file not found :"+e2);
return;
catch (NoPlayerException e2)
System.out.println ("Could not find a player.");
return;
if (player == null)
System.out.println ("Trouble creating a player.");
return;
first = false;
frame.setTitle (fd.getFile ().toString());
player.addControllerListener (this);
player.prefetch ();
return;
if (e.getActionCommand().equals("URL"))
FileDialog fd = new FileDialog (frame, "Open File",
FileDialog.LOAD);
fd.setDirectory (currentDirectory);
fd.show ();
// If user cancelled, exit.
if (fd.getFile() == null)
return;
currentDirectory = fd.getDirectory ();
if (player != null){
player.close ();
player.deallocate();
try
URL url = new URL ("file://"+fd.getDirectory()+fd.getFile());
MediaLocator mediaLocator = new MediaLocator (url);
player = Manager.createPlayer (mediaLocator);
catch (java.io.IOException e2)
System.out.println ("file not found :"+e2);
return;
catch (NoPlayerException e2)
System.out.println ("Could not find a player.");
return;
if (player == null)
System.out.println ("Trouble creating a player.");
return;
first = false;
frame.setTitle (fd.getFile ().toString());
player.addControllerListener (this);
player.prefetch ();
return;
public void controllerUpdate (ControllerEvent e)
if (e instanceof ControllerClosedEvent)
if (vc != null)
frame.getContentPane().remove (vc);
vc = null;
if (cc != null)
frame.getContentPane().remove (cc);
cc = null;
return;
if (e instanceof EndOfMediaEvent)
if (loop)
player.setMediaTime (new Time (0));
player.start ();
return;
if (e instanceof PrefetchCompleteEvent)
player.start();
return;
if (e instanceof RealizeCompleteEvent)
if (vc != null)
remove (vc);
vc = null;
if (cc != null)
remove (cc);
cc = null;
vc = player.getVisualComponent ();
if (vc != null)
frame.getContentPane().add(vc,BorderLayout.NORTH);
cc = player.getControlPanelComponent ();
if (cc != null){
frame.getContentPane().add (cc, BorderLayout.SOUTH);
frame.setVisible(true);
frame.pack();
public void keyReleased(KeyEvent ke) {
int keycode = ke.getKeyCode();
if (keycode==KeyEvent.VK_LEFT) {
skipBack();
} else if (keycode==KeyEvent.VK_RIGHT) {
skipForward();
public void keyTyped(KeyEvent ke) {
int keycode = ke.getKeyCode();
if (keycode==KeyEvent.VK_LEFT) {
skipBack();
} else if (keycode==KeyEvent.VK_RIGHT) {
skipForward();
public void keyPressed(KeyEvent ke) {
int keycode = ke.getKeyCode();
if (keycode==KeyEvent.VK_LEFT) {
skipBack();
} else if (keycode==KeyEvent.VK_RIGHT) {
skipForward();
}else if (keycode==KeyEvent.VK_UP) {
st();
}else if (keycode==KeyEvent.VK_DOWN) {
sp();
public void skipForward() {
Time settime;
double secs=5;
double playersecs = player.getMediaTime().getSeconds();
double duration = player.getDuration().getSeconds();
if((playersecs+secs) < duration){
settime = new javax.media.Time(playersecs + secs);
player.setMediaTime(settime);
}else {
player.setMediaTime(new Time(duration));
public void skipBack() {
double secs1=5;
double secs2=0;
double playersecs1 = player.getMediaTime().getSeconds();
Time settime1;
if((playersecs1 - secs1) > secs2){
settime1 = new javax.media.Time(playersecs1 - secs1);
player.setMediaTime(settime1);
}else {
player.setMediaTime(new Time(0));
public void st() {
player.start();
public void sp() {
player.stop();
public void itemStateChanged (ItemEvent e)
loop = !loop;
With Thanks
manuEdited by: mm_mm on Nov 27, 2007 11:09 PM
Maybe you are looking for
-
Problem when syncing with MobileMe
I am using iPhone 3G, software 2.1. I use GMail for email (no problems) but my contacts, and only my contacts, sync through MobileMe. The problem is that with MobileMe active, my Contact list, "Mail, Contacts and Calendars" settings and several other
-
Please help, need to install photoshop cs6 on new macbook pro
I just purchased a macbok pro and would like to install photoshop cs6 on it which i purchased last year for my imac but can't figure out how to do it without a cd drive. I really don't want to have to purchase it again since we are allowed to install
-
How can I determine what is stored under "other" on my iphone
When I synch my iPhone 4S, there is a fair amount of memory tied up in "other", but I don't know what is in there. How can I see and manage what is being stored in "other"?
-
3 beeps from comp. itunes won't read
I plug my 3rd gen. ipod into my Windows XP after not using it for a couple of weeks, I then hear three quick, low beeps from the computer. Then I decide to wait a while and nothing happens, itunes won't pop up. I click on the little USB icon on the b
-
Script Task output in Chinese???
I added some error logging to my package and now my script task output looks like Chinese. This is not the error file I set up for the error logging but another text file that I was sending results too. Next I took out the logging stuff and it still