Win a copy of Java Challengers this week in the Java in General forum!

Jesus Fernandez

Greenhorn
+ Follow
since Aug 11, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jesus Fernandez

Thanks for the reply Kerry.
But my goal is obtain a DataSource when my application startup ro retrieve some data from a BD. That's why i need the DataSource. My question is how can i obtain this one from the init method of a class that implements Plugin and execute both the init(..) and destroy() methods
Thanks in advance
15 years ago
Hi all, how can i obtain a datasource from de init(ActionServlet, ModuleConfig) methos inside a class that implements Plugin
Here is the code:


Thanks in advance
15 years ago
Hi there,
i am trying to obtain the headers from a HTTP request and show their values, but the output don't show the values of the header:
Here is the output:

Headers:
1host
2user-agent
3accept
4accept-language
5accept-encoding
6accept-charset
7keep-alive
8connection
9referer
10cookie
11content-type
12content-length

In the code i have defined three columns (id, header name and header value), but the header value column is empty



Any help on this would be appreciated
Thanks in advance
16 years ago
JSP
I have read the manual before bus i can't find out what i am looking for. I think i understand almost all the lines, but in some of them i am not sure about its meaning. I am going to put comment above the lines and if someone find a mistake, please correct me.
Thanks in advance
16 years ago
<target name="warfile" depends="build,docs" description="Build the web application archive">


<property name="jboss.root" value="${war.dir}/WEB-INF"/>

<mkdir dir="${dist.dir}"/>

<war warfile="${dist.dir}/${name}.war" basedir="${war.dir}" webxml="${war.dir}/WEB-INF/web.xml">
<!-- MEANING OF THE LINE BELOW --> <include name="*"/>

<!-- MEANING OF THE LINE BELOW -->
<include name="WEB-INF/*.*"/>
<!-- Exclude the given file -->
<exclude name="WEB-INF/web.xml"/>
<!-- MEANING OF THE LINES BELOW -->
<include name="WEB-INF/lib/**"/>
<include name="WEB-INF/jsp/**"/>
<include name="WEB-INF/defs/**"/>
<include name="WEB-INF/classes/**"/>
<!-- MEANING OF THE LINE BELOW -->
<exclude name="**/.*"/>
</war>

</target>
16 years ago
Hi there, some lines in this target are unknown for me.
Anyone can help me?



Thanks in advance
16 years ago
Hello all, please i need help.
I wonder if there is a method to detect if a browser has cookies disabled.
Thanks in advance.
16 years ago
Hello, is Tomcat 5.X.XX supported by W98??
I am in trouble with the instalation. When a try to start the service, the system shows me a message like this
File TOMCAT5W.EXE is linked to NETAPI32.DLL:NetWkstaGetInfo of exportation that dont exist.

Pleade, help me.
Thanks in advance
17 years ago
Hello, when i try to execute the following code:
package trilcejf;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.sql.*;
import javax.sql.DataSource;
public class EjemploDataSource{
public static void main(String args[]){
Connection con=null;
try{

InitialContext initialContext=new InitialContext();

Context context=(Context)initialContext.lookup("java:comp/env");

DataSource ds=(DataSource) context.lookup("jdbc/ejemploDS");

con=ds.getConnection();

//Obtenci�n de un objeto Statement para ejecutar sentencias SQL
Statement stmt=con.createStatement();

//Ejecuci�n de la sentencia SQL y obtenci�n de resultados en un objeto ResultSet
String sentenciaSQL="SELECT * from DatosAlumnos";
ResultSet rs=stmt.executeQuery(sentenciaSQL);

//Muestra de resultados mediante un bucle que recorre los registros que verifican la sentencia
String nombre,apellido,telefono;
while(rs.next()){
nombre=rs.getString("nombre");
apellido=rs.getString("apellidos");
telefono=rs.getString("telefono");
System.out.println("Nombre :"+nombre+". Apellido :"+apellido+". Telefono: "+telefono);
}
}catch(NamingException e){
System.out.println("Error en el DataSource: "+e.toString());
}catch(SQLException e){
System.out.println("Excepcion capturada de SQL: "+e.toString());

//Cierre de la conexi�n
}finally{
try{
con.close();
}catch(SQLException e){
System.out.println("No se puede cerrar la conexion: "+e.toString());
}
}
}
}
I get
Error en el DataSource: javax.naming.NoInitialContextException: Need to specify
class name in environment or system property, or as an applet parameter, or in a
n application resource file: java.naming.factory.initial
Exception in thread "main" java.lang.NullPointerException
at trilcejf.EjemploDataSource.main(EjemploDataSource.java:64)
I have defined in tomcat_home\webapps
JNDIDataSource.xml with the following:
<?xml version="1.0" encoding="iso-8859-1"?>
<Context path="/JNDIDataSource" docBase="JNDIDataSource" debug="1" reloadable="true"
crossContext="true">

<Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_JNDIDataSource_log."
suffix=".txt" timestamp="true"/>

<Resource name="jdbc/ejemploDS" auth="Container" type="javax.sql.DataSource" scope="Shareable"
description="DBCP Connection Pool DataSource" />

<ResourceParams name="jdbc/ejemploDS">
<parameter><name>factory</name><value>org.apache.commons.dbcp.BasicDataSourceFactory</value></parameter>
<parameter><name>driverClassName</name><value>org.hsqldb.jdbcDriver</value></parameter>
<parameter><name>username</name><value>trilcejf</value></parameter>
<parameter><name>password</name><value>profe</value></parameter>
<parameter><name>url</name><value>jdbc:hsqldb:http://localhost/Alumnos</value></parameter>
<parameter><name>maxActive</name><value>10</value></parameter>
<parameter><name>maxIdle</name><value>30000</value></parameter>
<parameter><name>maxWait</name><value>100</value></parameter>
<parameter><name>removeAbandoned</name><value>true</value></parameter>
<parameter><name>removeAbandonedTimeout</name><value>60</value></parameter>
<parameter><name>logAbandoned</name><value>true</value></parameter>
</ResourceParams>
</Context>
And my application is under tomcat_home\webapps and its name is JNDIDataSource
Any suggestions about why the javax.naming.NoInitialContextException is thrown??
Thanks in advance
17 years ago
Hi there,
i have an audioconferencing JMF application that works between PCs if i know their IPs, but ...
when i try to connect between a PC in a LAN that conects to Internet through on a router, i dont know its IP. I just known router's IP, and it doesn't work.
I solved the problem modifying configuration of the router, basically with NAPT, using port forwarding in the router. You can say the router that all incoming UDP data through a port xxxx from external PC was forwarding to a node with its IP LAN 192.168.0.xxx through a port yyyy
But this is not a good solution because the application's users usually dont allow to access the router
Any suggestions?? I think Messenger and Netmeeting use a code to scan free ports or anything else.
Thanks in advance
17 years ago
Hi there,
i have an audioconferencing JMF application that works between PCs if i know their IPs, but ...
when i try to connect between a PC in a LAN that conects to Internet through on a router, i dont know its IP. I just known router's IP, and it doesn't work.
I solved the problem modifying configuration of the router, basically with NAPT, using port forwarding in the router. You can say the router that all incoming UDP data through a port xxxx from external PC was forwarding to a node with its IP LAN 192.168.0.xxx through a port yyyy
But this is not a good solution because the application's users usually dont allow to access the router
Any suggestions?? I think Messenger and Netmeeting use a code to scan free ports or anything else.
Thanks in advance
Hi there,
i have an audioconferencing JMF application that works between PCs if i know their IPs, but ...
when i try to connect between a PC in a LAN that conects to Internet through on a router, i dont know its IP. I just known router's IP, and it doesn't work.
I solved the problem modifying configuration of the router, basically with NAPT, using port forwarding in the router. You can say the router that all incoming UDP data through a port xxxx from external PC was forwarding to a node with its IP LAN 192.168.0.xxx through a port yyyy
But this is not a good solution because the application's users usually dont allow to access the router
Any suggestions?? I think Messenger and Netmeeting use a code to scan free ports or anything else.
Thanks in advance
17 years ago
Need the ip of machines that are in a LAN, to transmit audio from another external machine. All goes OK if machines are not in a LAN and i get ip using the method getRemoteAddr(), but when a machine belongs to a LAN the program doesn't work, because ip i get is not the correct. It is from the router.
Is it possible obtain these IPs?
Thanks in advance
17 years ago