orelia hans

Ranch Hand
+ Follow
since Jan 29, 2004
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 orelia hans

I am using this query to get projects from my tables:
String sql = "SELECT * FROM Projects WHERE Status = '" +st+"' and EntryType='"+e+"' ";
The projects are coming sorted ou like P1 then P10 then P11,then P2 then P9,ect. i would like to be able to have P1, P2,P9,P10,P11. How do I do that with the code I already have. I want to sort by ProjectNumber but only with the second character witch is a number instead of considering the all thing as a string.
Thanks
I re-installed tomcat and now the default page on localhost:8089 works. But my own directory doesn't : The requested resource (/CoreData/index.jsp) is not available
And in my tomcat console window I have :
ChannelSocket init INFO: JK2: ajp13 listening on /0.0.0.0:8009
Does anyone know how to fix this?
I've removed all the configuration I've done on IIS and ininstalled JK2 as well(the connector).
THanks
15 years ago
there is something wrong somewhere.
My localhost:9080 is not even working anymore now that I've configured tomcat to work with IIS. When I type localhost:9080/mydirectory/myjsp i am having a The requested resource (/CoreData/) is not available. When I simply type localhost:9080 i am having a directory listing, everything I have under webapps/root.
Anyone can tell me what happened.
I used the tutorial on http://virtualict.net/support/kb/ii6-Tomcat5-JK2.html to configure tomcat with IIS. I have iis5 and tomcat 4.
Anyone help please
here
15 years ago
It works now . The Tomcat default page is showing.
But my own application doesn't . I put my folder under C: and also tried to put it under webapps\root\then my folder. Only the default page is showing but not the other ones. I am having this error now:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: -1 in the jsp file: null
Generated servlet error:
[javac] Compiling 1 source file
C:\Tomcat\Tomcat\work\Standalone\localhost\_\CoreData\Project_jsp.java:7: package Helper does not exist
import Helper.*;
^
C:\Tomcat\Tomcat\work\Standalone\localhost\_\CoreData\Project_jsp.java:11: cannot resolve symbol
symbol : class CoreDataDetails
location: class org.apache.jsp.Project_jsp
CoreDataDetails coredataDetails = new CoreDataDetails();
^
C:\Tomcat\Tomcat\work\Standalone\localhost\_\CoreData\Project_jsp.java:11: cannot resolve symbol
symbol : class CoreDataDetails
location: class org.apache.jsp.Project_jsp
CoreDataDetails coredataDetails = new CoreDataDetails();
^
3 errors


I did put the package Helper in my classpath but I am wondering why it's not seeing it.
Please help
Thanks
15 years ago
Hello,
I re-installed my jdk, and also tomcat, restarted the server, same error occured, the tomcat window flashes then close itself. Then I changed the "start" to a "run" as someone suggested. now it starting tomcat on the DOS window but then I am having this:

Mar 23, 2004 9:02:25 AM org.apache.coyote.http11.Http11Protocol init
SEVERE: Error initializing endpoint
java.net.BindException: Address already in use: JVM_Bind:8080
at org.apache.tomcat.util.net.PoolTcpEndpoint.initEndpoint(PoolTcpEndpoi
nt.java:302)
at org.apache.coyote.http11.Http11Protocol.init(Http11Protocol.java:184)
at org.apache.coyote.tomcat4.CoyoteConnector.initialize(CoyoteConnector.
java:1229)
at org.apache.catalina.core.StandardService.initialize(StandardService.j
ava:579)
at org.apache.catalina.core.StandardServer.initialize(StandardServer.jav
a:2246)
at org.apache.catalina.startup.Catalina.start(Catalina.java:511)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
Catalina.start: LifecycleException: Protocol handler initialization failed: jav
a.net.BindException: Address already in use: JVM_Bind:8080
LifecycleException: Protocol handler initialization failed: java.net.BindExcept
ion: Address already in use: JVM_Bind:8080
at org.apache.coyote.tomcat4.CoyoteConnector.initialize(CoyoteConnector.
java:1231)
at org.apache.catalina.core.StandardService.initialize(StandardService.j
ava:579)
at org.apache.catalina.core.StandardServer.initialize(StandardServer.jav
a:2246)
at org.apache.catalina.startup.Catalina.start(Catalina.java:511)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
Catalina.stop: LifecycleException: This server has not yet been started
LifecycleException: This server has not yet been started
at org.apache.catalina.core.StandardServer.stop(StandardServer.java:2213
)
at org.apache.catalina.startup.Catalina.start(Catalina.java:543)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)

what this mean?
Help. I've got only until friday to finish this.
Thanks
15 years ago
Maybe I dont understand what you mean but there is no exit on my setclasspath.bat file
This file looks like this:

rem
-----------------------------------------------------------------------
----
rem Set CLASSPATH and Java options
rem
rem $Id: setclasspath.bat,v 1.8 2003/01/17 10:07:21 remm Exp $
rem
-----------------------------------------------------------------------
rem Make sure prerequisite environment variables are set
if not "%JAVA_HOME%" == "" goto gotJavaHome
echo The JAVA_HOME environment variable is not defined
echo This environment variable is needed to run this program
goto end
:gotJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
if not exist "%JAVA_HOME%\bin\javaw.exe" goto noJavaHome
if not exist "%JAVA_HOME%\bin\jdb.exe" goto noJavaHome
if not exist "%JAVA_HOME%\bin\javac.exe" goto noJavaHome
goto okJavaHome
:noJavaHome
echo The JAVA_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end
kJavaHome
if not "%BASEDIR%" == "" goto gotBasedir
echo The BASEDIR environment variable is not defined
echo This environment variable is needed to run this program
goto end
:gotBasedir
if exist "%BASEDIR%\bin\setclasspath.bat" goto okBasedir
echo The BASEDIR environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end
kBasedir
rem Set the default -Djava.endorsed.dirs argument
set JAVA_ENDORSED_DIRS=%BASEDIR%\common\endorsed
rem Set standard CLASSPATH
rem Note that there are no quotes as we do not want to introduce random
rem quotes into the CLASSPATH
set
CLASSPATH=%JAVA_HOME%\lib\tools.jar;.;%JAVA_HOME%\jre\lib\rt.jar;.;%CAT
ALINA_HOME%\common\lib\servlet.jar;
rem Set standard command for invoking Java.
rem Note that NT requires a window name argument when using start.
rem Also note the quoting as JAVA_HOME may contain spaces.
set _RUNJAVA="%JAVA_HOME%\bin\java"
set _RUNJAVAW="%JAVA_HOME%\bin\javaw"
set _RUNJDB="%JAVA_HOME%\bin\jdb"
set _RUNJAVAC="%JAVA_HOME%\bin\javac"
REM Set path for Java Development Kit
SET PATH=C:\jdk1.4.2\bin
REM Set Tomcat home directory
SET TOMCAT_HOME=c:\Tomcat\tomcat
REM Set Java home directory
SET JAVA_HOME=c:\jdk1.4.2

:end
And my startup.bat file look like this:
@echo off
if "%OS%" == "Windows_NT" setlocal
rem ---------------------------------------------------------------------------
rem Start script for the CATALINA Server
rem
rem $Id: startup.bat,v 1.4 2002/01/15 02:55:38 patrickl Exp $
rem ---------------------------------------------------------------------------
rem Guess CATALINA_HOME if not defined
if not "%CATALINA_HOME%" == "" goto gotHome
set CATALINA_HOME=c:\Tomcat\Tomcat.
if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
set CATALINA_HOME=..
:gotHome
if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
echo The CATALINA_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end
kHome
set EXECUTABLE=%CATALINA_HOME%\bin\catalina.bat
set JAVA_HOME=c:\j2sdk_nb\j2sdk1.4.2
rem Check that target executable exists
if exist "%EXECUTABLE%" goto okExec
echo Cannot find %EXECUTABLE%
echo This file is needed to run this program
goto end
kExec
rem Get remaining unshifted command line arguments and save them in the
set CMD_LINE_ARGS=
:setArgs
if ""%1""=="""" goto doneSetArgs
set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
shift
goto setArgs
oneSetArgs
call "%EXECUTABLE%" start %CMD_LINE_ARGS%
:end

[B]I am using the same tomcat on my own machine and it's working fine but on this server pc, it just doesn't take it.Can't start tomcat. I am so fustrated, I only have two weeks left for my contract to end, I have to have this working by then. I can't make the console window not shut itself.I am sure someone else has maybe ecountered this same problem before.
please help me.
15 years ago
I just installed jdk and tomcat on the server of the company i work for. I've configured tomcat,set the classpath properly and everything but when i start up tomcat , the console window just open, does some stuff then stops and close itself. Can someone tell me why it's doing this and how I can fix this problem?
THanks
15 years ago
I read on the internet about JK2 connector connecting tomcat with IIS(internet infromation services). Is it the only way for me to implement my website?
I will install java on the server and also tomcat, but i am not sure about this jk2 connector(jakarta connector).
Please tell me if you know anything about this
Thanks
15 years ago
JSP
The web application I was working on is working fine.... on my machine. I would like to move everything on the server so that everything would be available on the company's intranet.
Do I have to install tomcat on the server all over again? Do I have to have console window running 24/7? Do I have to change my classpath again? Anyone know a website that have a tutorial on all this for my implementation.
Thanks for any help.
15 years ago
JSP
I give up. I am not gonna try to retrieve the files from the database. Instead, I will se the code bellow. The lines that confuse me are bolded. Frist the problem is that even when my publication number is equal to NB10, or anything else the line system.out.println(path) gives me path=nothing.It always falls to path=nothing. Why is that?
And also am having a "unclosed character litteral" error when I write
new File('"+path+"'); How do I do it instead

<%!String publicationNumber="";%>
<%!String path;%>
<%@ page contentType="octet/stream" %>
</p>
<%
try {
String st = request.getParameter("id");
System.out.println(st);
path="";
if(st=="NB10")
{
path="C:\\My Documents\\competition.pdf";
}
else if(st=="NP2")
{
path="C:\\My Documents\\proletion.pdf";
}
else
{
path="nothing";
}
System.out.println(path);
response.setContentType("application/pdf");
response.addHeader("Content-Disposition", "filename=competition.pdf");

File f = new File(path);
FileInputStream fis = new FileInputStream(f);
byte[] buffer = new byte[(int)f.length()];
fis.read(buffer,0,(int)f.length());
fis.close();
ServletOutputStream os = response.getOutputStream();
os.write(buffer);
os.close();

}
catch (Exception e3) {

System.out.println(e3.toString());
}
%>
Thanks
15 years ago
JSP
I actually also have a servlet but the thing is I am not using it because of this
out.write("<a td img href='PublicationDetails.jsp?id=" + publicationNum + "'><font face= verdana size=-1>"+publicationNum+"</td>");
I can't send the id to the servlet, it's giving me an error. Plus if I just just use <form action=servlet method post>on my jsp, there is no href .
My servlet is in my previous messages. please help. I am so desperate now and I am running out of time. My contract is finishing next month and this is my last problem before implementation(well, I guess).
15 years ago
JSP
I am getting this error now :
org.apache.jasper.JasperException: getOutputStream() has already been called for this response
I tried to catch the java.lang.IllegalStateException but it's then complains of catching it twice.
My code still same:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc dbc:AcessCore");
String st = request.getParameter("id");
String sql = "SELECT Document FROM NEPRUPublications WHERE PublicationID = '" +st+"'";
Statement s= con.createStatement();
ResultSet rs=null ;
response.setContentType("application/pdf");
ServletOutputStream o= response.getOutputStream();
BufferedInputStream bis = new BufferedInputStream(rs.getBinaryStream("sql"));
byte bindata[] = new byte[2048];
int bytesread = 0;
while ( (bytesread = bis.read(bindata,0,bindata.length)) != -1 )
{
o.write(bindata);
o.close();}
rs.close();
s.close();
con.close();
}
catch (ClassNotFoundException e1) {
// JDBC driver class not found, print error message to the console
System.out.println(e1.toString());
System.out.println("oh lala!");
}
catch (SQLException e2) {
// Exception when executing java.sql related commands, print error message to the console
System.out.println(e2.toString());
System.out.println("try again");
}
catch (Exception e3) {
// other unexpected exception, print error message to the console
System.out.println(e3.toString());
15 years ago
JSP
People, you saw the servlet I have and also the jsp. None of them work so far. The jsp tries to open the Example.pdf file which I don't have. How do I make it open the file contained in my database??
Waiting for your help
Thanks :roll:
15 years ago
JSP
Thanks for your replies.
I would like to know what represents the "word.exe" in the code you just gave me. Or "Example.pdf". Because I want my documents to be opened as pdf but there is a different file for each publication number. So how do I make it general so that it's opens the document it actually finds on the select method.Because it's trying to look for the example.exe document. I can't name each and every document.
Here is the code again:
response.addHeader("Content-disposition",
"attachment; filename=" +
"Example.pdf" );
File f = new File("c:\\Example.pdf");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc dbc:AcessCore");
String st = request.getParameter("id");
String sql = "SELECT Document FROM NEPRUPublications WHERE PublicationID = '" +st+"'";
Statement s= con.createStatement();
ResultSet rs = s.executeQuery(sql);
;
FileInputStream fis = new FileInputStream(f);
ServletOutputStream o= response.getOutputStream();
BufferedInputStream bis = new BufferedInputStream(rs.getBinaryStream("sql"));

byte bindata[] = new byte[2048];
int bytesread = 0;

while ( (bytesread = bis.read(bindata,0,bindata.length)) != -1 )
{
fis.close();
o.write(bindata);
o.close();}

rs.close();
s.close();
con.close();

Note that my files are in the database. How do Ido for this : File f = new File("c:\\Example.pdf");
Thanks
15 years ago
JSP
My classpath :
CLASSPATH=.;C:\j2sdk1.4.2\bin;.;%CATALINA_HOME%/webapps/CoreData/web-inf/classes;. %CATALINA_HOME%/webapps/coredata;. C:/tomcat/tomcat/webapps/coredata/web-inf/classes/Helper;%CATALINA_HOME%\common\lib\servlet.jar;.;%JAVA_HOME%\jre\lib\rt.jar;.;%JAVA_HOME%\lib\tools.jar;.;
15 years ago
JSP