Unable to compile nagios in Solaris 10
Hi group,
I am trying to compile nagios package on my solaris 10 box, but I am having some issues.
I have Solaris 10 with Solaris Studio 12.3 and nagios 3.3.1
This is the error message that I am getting when I execute "make all" command:
$ make all
cd ./base && make
gcc -Wall -g -O2 -I/usr/local/include/ -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -m64 -mcpu=v8 -D_TS_ERRNO -I/usr/perl5/5.8.4/lib/sun4-solaris-64int/CORE -DHAVE_CONFIG_H -DNSCORE -c checks.c
checks.c: In function `run_async_service_check':
checks.c:552: warning: dereferencing type-punned pointer will break strict-aliasing rules
checks.c:697: warning: dereferencing type-punned pointer will break strict-aliasing rules
checks.c:711: error: `n_a' undeclared (first use in this function)
checks.c:711: error: (Each undeclared identifier is reported only once
checks.c:711: error: for each function it appears in.)
checks.c:711: warning: left-hand operand of comma expression has no effect
checks.c:352: warning: unused variable `Perl___notused'
*** Error code 1
make: Fatal error: Command failed for target `checks.o'
Current working directory /na01/nag01/nagios/base
*** Error code 1
make: Fatal error: Command failed for target `all'
I execute configure command with next flags:
./configure with-nagios-user=nag01 with-nagios-group=nag with-command-group=nag enable-embedded-perl with-perlcache with-httpd-conf=/usr/local/apache2/conf with-gd-lib=/usr/local/lib with-gd-inc=/usr/local/include/
Any idea, help or advice will be really appreciated.
Thanks in advance.
Kind regards,
Francisco
hello, you don't have to use hme0, that may not be your NIC type. your NIC appears to be realtek adapter. download the drivers first [try here: http://homepage2.nifty.com/mrym3/taiyodo/rf-1.0.9.tar.gz] install them, then your NIC will have a name like rt0. you can then proceed to set its interface.i hope ifconfig -a, blah,blah is ok with u. If the adapter is ok then you can now do the zones - they are just automatic no strugling!
you can also find the drivers from realtek website at -- ftp://152.104.238.194/cn/nic/rtl8139abcd8130810xseries/rtls211.zip
here are sample instructions on how to install the driver
How to install Solaris/x86 version
1. This is the version 2.1.1 RTL8139 serials driver for Solaris/x86
version.
2. It support Speed/Duplex-Force mode, you can set it through rtls.conf file.
3. It supports 3 PCI-VID_DID cards, VID_10EC_DID_8139 for Realtek's
native, VID_1113_DID_1211 for Accton and VID_1186_DID_1301 for
D-Link in the install script.
4. Install method:
a. Power-off your PC and insert your RTL8139 adapter.
b. Boot-up you Solaris/x86 and login as "root".
c. Copy the "rtls211.zip" into the temporary location in your
hard-driver.
d. UNZIP the "rtls211.zip" and you will get 3 files, "rtls", "rtls.conf" and
"Install".
e. If the PCI ID for your RTL8139 adapter is not VID_10EC_DID_8139
or VID_1113_DID_1211 or VID_1186_DID_1301, you can modify the
"Install" file to match your PCI ID, VID_ABCD_DID_WXYZ for example,
modify the "pci1186,1301" to "pciABCD,WXYZ".
f. Run the "Install" from File Manager to install the driver, and
it will modify 2 files, "/etc/name_to_major" and "/etc/driver_aliases"
g. You need to create the "/etc/hostname.rtls0" file and modify some
other related files to make your networking environments working well.
h. You can execute "touch /reconfigure" then "shutdown -i5 -g0", so that
Solaris will reboot and scan changed hardware environment.
i. You can execute "ifconfig -a" to make sure the RTL8139 driver is up.
success. bye
Similar Messages
-
hi
can any one help me to install nagios on solaris 10.But i got a document from
www.totkat.org/pages/nagios.shtml. but it is giving errors.
i am expecting your valuable hints to doI've insaller SUNWlibm and the make is going further now but still ends in a fatal error:
then mv -f ".deps/pst3-pst3.Tpo" ".deps/pst3-pst3.Po"; else rm -f ".deps/pst3-pst3.Tpo"; exit 1; fi
pst3.c:1: sorry, unimplemented: 64-bit mode not compiled in
*** Error code 1
make: Fatal error: Command failed for target `pst3-pst3.o'
Current working directory /usr/share/src/nagios-plugins-1.4.13/plugins-root
*** Error code 1
The following command caused the error:
failcom='exit 1'; \
for f in x $MAKEFLAGS; do \
case $f in \
*=* | --[!k]*);; \
k) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo all-recursive | sed s/-recursive//`; \
list='gl lib plugins plugins-scripts plugins-root po'; for subdir in $list; do \
echo "Making $target in $subdir"; \
if test "$subdir" = "."; then \
dot_seen=yes; \
local_target="$target-am"; \
else \
local_target="$target"; \
fi; \
(cd $subdir && make $local_target) \
|| eval $failcom; \
done; \
if test "$dot_seen" = "no"; then \
make "$target-am" || exit 1; \
fi; test -z "$fail"
make: Fatal error: Command failed for target `all-recursive'
Current working directory /usr/share/src/nagios-plugins-1.4.13
*** Error code 1
make: Fatal error: Command failed for target `all'
another suggestion? the SUNWlibm was necessary so thank you for that. -
Unable to Compile .pll files in EBS R12 on PROD instance
Hi All,
We are facing Problem in our Prod instance. When we tried to compile pll files of any module we are not able to get compile in production, but these files easily compiled in our Test/DEV instance. We are not getting any solution from product support.
OS version: Solaris 10
EBS version 12.0.4 with 10.2.0.2.
Any body please help us.No error message is coming up, adadmin session got hung. frmcmp_batch process are not getting killed through kill -9 command. All the times we rebooted the server to release these processes.Can you find any errors in the database log file?
What if you move the file to any of the working instance, can you compile it then?
Please compile it manually as per these docs and check then.
How to Generate Form, Library and Menu for Oracle Applications (Doc ID 130686.1)
Unable To Compile Custom Form Using Frmcmp Utility Receive FRM-91500 (Doc ID 563655.1)
Thanks,
Hussein -
Unable to compile code referencing GV$AQ view
I am unable to compile code which has a select from the view GV$AQ. I have the AQ_ADMINISTRATOR_ROLE granted for myself, but this isn't being granted to the stored procedure. How do I go about granting select privileges on the GV$AQ view? My attempt follows:
SQL> select * from v$version;
BANNER
Oracle9i Enterprise Edition Release 9.0.1.1.0 - 64bit Production
PL/SQL Release 9.0.1.1.0 - Production
CORE 9.0.1.1.0 Production
TNS for Solaris: Version 9.0.1.1.0 - Production
NLSRTL Version 9.0.1.1.0 - Production
SQL> @queue_statistics_s
Package created.
SQL> @queue_statistics_b
Warning: Package Body created with compilation errors.
SQL> sho err
Errors for PACKAGE BODY QUEUE_STATISTICS:
LINE/COL ERROR
814/9 PL/SQL: SQL Statement ignored
821/16 PL/SQL: ORA-00942: table or view does not exist
SQL> l 813 824
813 -- Query the statistics view
814 SELECT v.waiting
815 ,v.ready
816 ,v.expired
817 INTO p_waiting
818 ,p_ready
819 ,p_expired
820 FROM dba_queues q
821 ,GV$AQ v
822 WHERE v.qid = q.qid
823 AND q.name = UPPER(p_q_name);
824*
SQL> SELECT v.waiting
2 ,v.ready
3 ,v.expired
4 FROM dba_queues q
5 ,GV$AQ v
6 WHERE v.qid = q.qid
7 AND q.name = UPPER ('test_queue');
WAITING READY EXPIRED
0 7 0
SQL> connect system
Enter password:
Connected.
SQL> grant select on gv$aq to queue_user;
grant select on gv$aq to queue_user
ERROR at line 1:
ORA-01031: insufficient privileges
SQL> grant select on dba_queues to queue_user;
grant select on dba_queues to queue_user
ERROR at line 1:
ORA-01031: insufficient privileges
SQL>manyal wrote:
You are right, if we are giving priviledges explicitly , it works .
can't we do anything else because in this way at start of the financial year we have to grant so many explicitly priviledges .Yes, don't create database objects that are named based on data (e.g. names with months and years in them).
Data should be inside the table and not used to distinguish the table. -
Unable to compile class for JSP
Please can anyone help me to solve this.
Actually,this is the condition.
In my db,there is a table called UserPassword, which has 4
fields(empNo,UserName,password,level). Now I want to do these things:
When the user submits the data to create a new account via HTML form, it submits the data to the file called CreateAcc.jsp. In this file it perform some logic,here are they.
1)To check the empNo,if it is already exist in the DB,
if empNo =exist then display error.(record already exist)
if empNo =notexist then do task 2).
2)check the UserName,if it is already exist in the db,
if UserName=exist then display error.(because it's a primary key)
if UserName=notexist then do task 3).
3)Create a new user account and save it to the db.
To do these tasks,I never create a new objects for the tasks 1) and 2).
only for task 3)create an object.
Is it the right way?
Here is the file CreateAcc.jsp
<%@ page language="java" %>
<%@ page import="core.UserAccManager" %>
<%@ page import="data.UserPassword" %>
<jsp:useBean id="UserAccManager" class="core.UserAccManager" scope="session"/>
<jsp:setProperty name="UserAccManager" property="*"/>
<jsp:useBean id="UserPassword" class="data.UserPassword" scope="session"/>
<jsp:setProperty name="UserPassword" property="*"/>
<%
String nextPage ="MainForm.jsp";
if(UserPassword.verifyEmpno()){
if(UserPassword.verifyUsername()){
if(UserPassword.createAcc()) nextPage ="MsgAcc.jsp";
}else{
nextPage="UserNameExist.jsp";
else{
nextPage="UserAccError.jsp";
%>
<jsp:forward page="<%=nextPage%>"/>The directory structure:
UserPassword.java- F:/Project/core/data/UserPassword.java
UserAccManager.java - F:/Project/core/UserAccManager.java
Now both are compiling.I put the class files into the TOMCAT,as follows.
UserAccManager.class - webapps/mySystemName/WEB-INF/classes/core/
UserPassword.class - webapps/mySystemName/WEB-INF/classes/core/data/
Here is the full code of the file UserAccManager.java.
package core; //Is this right?
import data.UserPassword; //Is this right?
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public final class UserAccManager{
private static final String DRIVER = "com.mysql.jdbc.Driver";
private static final String URL = "jdbc:mysql://localhost:3306/superfine";
private static Connection connection;
private static PreparedStatement pstmt1;
private static PreparedStatement pstmt2;
private static PreparedStatement pstmt3;
private UserAccManager(){
// Initializes the connection and statements
public static void initConnection() {
if (connection == null) {
try {
String sql;
// Open the database
Class.forName(DRIVER).newInstance();
connection = DriverManager.getConnection(URL);
// Prepare the statements
sql = "SELECT * FROM UserPassword where empNo= ?";
pstmt1 = connection.prepareStatement(sql);
sql = "SELECT UserName FROM UserPassword where UserName= ?";
pstmt2 = connection.prepareStatement(sql);
sql ="INSERT INTO UserPassword VALUES(?,?,?,?)";
pstmt3 = connection.prepareStatement(sql);
catch (Exception ex) {
System.err.println(ex.getMessage());
// Closes the connection and statements
// Method to be called by main class when finished with DB
public void closeConnection() {
//same as previous
public static boolean verifyEmpno(int empno) {
boolean emp_no_select_ok = false;
int emp = -1;
initConnection();
try {
pstmt1.setInt(1, empno);
ResultSet rs1 = pstmt1.executeQuery();
while(rs1.next()){
emp=rs1.getInt("empNo");
if(emp>0)
emp_no_select_ok = false;
} else{
emp_no_select_ok = true;
rs1.close();
pstmt1.close();
catch (Exception ex) {
System.err.println(ex.getMessage());
return emp_no_select_ok;
public static boolean verifyUsername(String username) {
boolean user_name_select_ok = false;
String user = "xxxx";
initConnection();
try {
pstmt2.setString(1, username);
ResultSet rs2 = pstmt2.executeQuery();
while(rs2.next()){
user=rs2.getString("UserName");
if(!user.equals("xxxx"))
user_name_select_ok = false;
} else{
user_name_select_ok = true;
rs2.close();
catch (Exception ex) {
System.err.println(ex.getMessage());
return user_name_select_ok;
public static boolean createAcc(int empno, String username, String password, int
level){
boolean create_acc_ok = false;
initConnection();
try{
//create a new object,from the UserPassword table.
UserPassword useraccount = new UserPassword();
useraccount.setEmpno(empno);
useraccount.setUsername(username);
useraccount.setPassword(password);
useraccount.setLevel(level);
//assign value for ???
pstmt3.setInt(1, useraccount.getEmpno());
pstmt3.setString(2, useraccount.getUsername());
pstmt3.setString(3, useraccount.getPassword());
pstmt3.setInt(4, useraccount.getLevel());
if(pstmt3.executeUpdate()==1) create_acc_ok=true;
pstmt3.close();
//con.close();
catch(SQLException e2){
System.err.println(e2.getMessage());
return create_acc_ok;
}here is the bean (part of it)
package data; //is it right?
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class UserPassword
private int empno;
private String username;
private String password;
private int level;
// Constructor
public UserPassword()
this.empno = empno;
this.username = username;
this.password = password;
this.level = level;
// setters and getters are here.
// public boolean verifyEmpno() {
// return UserAccManager.verifyEmpno(empno);
// public boolean verifyUsername(String username) {
// return UserAccManager.verifyUsername(username);
// These 2 methods not compile with or without para's.So I leave that job for the
//controll class UserAccManager.java.
Now my problem is this: When I submit data, there is an error;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:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:8:
cannot access core.data.UserPassword
bad class file: C:\Program Files\Apache Group\Tomcat
4.1\webapps\HRM\WEB-INF\classes\core\data\UserPassword.class
class file contains wrong class: data.UserPassword
Please remove or make sure it appears in the correct subdirectory of the classpath.
import core.data.UserPassword;
^
1 error
Are there any mistakes? If so tell me where is it and how to change them.Please help.I try it that way, but it don't compile.
Error:core\data\UserPassword.java:package javax.servlet does not exist
import javax.servlet.*;
core\data\UserPassword.java:package javax.servlet.http does not exist
import javax.servlet.http.*;
So,I comment them only in the UserPassword.java file,and compile it again.
Then it compile well.I goto the directory to get the .class files.
But there is only UserPassword.class inside the data folder. There is not
UserAccManager.class in the core folder.
Then I try this way,I put my 2 java files in to a new folder,
F:\SystemName\com
When I try it that way, but it don't compile.
javac -classpath . -d . com\*.javaError:com\UserPassword.java:package javax.servlet does not exist
import javax.servlet.*;
com\UserPassword.java:package javax.servlet.http does not exist
import javax.servlet.http.*;
So,I comment them only in the UserPassword.java file,and compile it again.
Now both are compiling well.There was 2 class files.
I put them in to the WEB-INF/classes/com directory.
Start the server.But it gave errors:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:68: cannot resolve symbol
symbol : variable empno
location: class org.apache.jsp.CreateAcc_jsp
if(UserPassword.verifyEmpno(empno)){
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:69: cannot resolve symbol
symbol : variable username
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.verifyUsername(username)){
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:69: non-static method
verifyUsername(java.lang.String) cannot be referenced from a static context
if(UserAccManager.verifyUsername(username)){
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable empno
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable username
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable password
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable level
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: non-static method
createAcc(int,java.lang.String,java.lang.String,int) cannot be referenced from a static
context
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
8 errorsTo solve the problem non-static method,I goto the UserAccManager.java file and do these
things.
package com;
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.sql.*;
//import javax.servlet.*; //otherwise it tells an error.(package
//javax.servlet does not exist)
//import javax.servlet.http.*;
public class UserAccManager {
private static final String DRIVER = "com.mysql.jdbc.Driver";
private static final String URL = "jdbc:mysql://localhost:3306/superfine";
private static Connection connection;
private static PreparedStatement pstmt1;
private static PreparedStatement pstmt2;
private static PreparedStatement pstmt3;
private UserAccManager() {
// Initializes the connection and statements
private static void initConnection() {
//same
// Closes the connection and statements
// Method to be called by main class when finished with DB
public static void closeConnection() {
//same
public static boolean verifyEmpno(int empno) {
// same.
public static boolean verifyUsername(String username) {
//same.
public static boolean createAcc(int empno, String username, String password, int
level){
//same
package com;
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.sql.*;
//import javax.servlet.*;
//import javax.servlet.http.*;
public class UserPassword {
// same
Again compile those files and put .class filses into the WEB-INF/classes/com directory.
When i submits the data via the form it generates an error:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
[javac] Compiling 1 source file
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:68: cannot resolve symbol
symbol : variable empno
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.verifyEmpno(empno)){
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:69: cannot resolve symbol
symbol : variable username
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.verifyUsername(username)){
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable empno
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable username
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable password
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable level
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
6 errorshere is the CreateAcc.jsp file
<%@ page language="java" %>
<%@ page import="com.UserAccManager" %>
<%@ page import="com.UserPassword" %>
<jsp:useBean id="userPassword" class="com.UserPassword" scope="request"/>
<jsp:setProperty name="userPassword" property="*" />
<%
String nextPage ="MainForm.jsp";
if(UserAccManager.verifyEmpno(empno)){
if(UserAccManager.verifyUsername(username)){
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
}else{
nextPage="UserNameExist.jsp";
else{
nextPage="UserAccError.jsp";
%>
<jsp:forward page="<%=nextPage%>"/>Please, anyone know how to send these parameters to the java file.
Thanks. -
Unable to Compile New Report.vi
Error 7
Error 1003
I am unable to compile the New Report.vi from the Report Generation Toolkit.
I have Windows 2000 and LV 7.1.
I have Forced Re-Compliation of all my VIs (Ctrl-Shift-Run)
I have tried adding Dynamic links in my App build.
What else can I try?Duplicate post, see original thread here.
-D
Darren Nattinger, CLA
LabVIEW Artisan and Nugget Penman -
Hi !
When I try to compile in JDev with javac and the java 1.3.1 library, I get the following error :
Error: javac: invalid flag: -source
The command line generated by JDev looks like :
C:\jdk1.3.1_03\bin\javac.exe -J-mx512m -verbose -deprecation -source 1.3 -target 1.3 -encoding Cp1252 -g -classpath [...] -sourcepath [...] -d [...] @C:\DOCUME~1\user\LOCALS~1\Temp\javac54193.tmp
It seems that -source and -target flags do not exist in this version of javac.
But it does not seem possible to remove these flags generated by JDev, so I'm unable to compile with javac 1.3.1 and JDev.
So i'm looking for :
- A workaround to prevent JDev from adding the -source and -target flags.
- A future release of JDev where you could disable these flags, or, much better, where JDev automatically disables these flags when it detects a 1.3.1 library (there may be other incompatible flags I did not mention).
Thank you for your answers :)Hi,
when you open the project properties and choose the compiler option to tht the compiler to "javac" and then the "source" and "target" to 1.3, wouldn't this compile it for Java 3? I don't think that it is necesary to use JDK 1.3 for compiling the sources
Cross-Compilation Options
By default, classes are compiled against the bootstrap and extension classes of the platform that javac shipped with. But javac also supports cross-compiling, where classes are compiled against a bootstrap and extension classes of a different Java platform implementation. It is important to use -bootclasspath and -extdirs when cross-compiling; see Cross-Compilation Example below.
-target version
Generate class files that will work on VMs with the specified version. The default is to generate class files to be compatible with the 1.2 VM in the Java 2 SDK. The versions supported by javac in the Java 2 SDK are:
1.1
Ensure that generated class files will be compatible with 1.1 and VMs in the Java 2 SDK.
1.2
Generate class files that will run on VMs in the Java 2 SDK, v 1.2 and later, but will not run on 1.1 VMs. This is the default.
1.3
Generate class files that will run on VMs in the Java 2 SDK, v 1.3 and later, but will not run on 1.1 or 1.2 VMs.
1.4
Generate class files that are compatible only with 1.4 VMs.
http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javac.html
Frank -
Unable to compile servlet files in javac
i am unable to compile servlet *.java files in javac.as far as i can see my path is correct.
Kindly provide a solution as soon as possible.
My jdk1.3 is in my c drive and my tomcat in my d drive.
if you are able to compile kindly let me know your path.
it says symbol not resolved.i think that it is unable to import from javaxAssuming that your jdk is in c drive as c:\jdk1.3 set the path and the classpath like as shown below. Remember that you have to set the classpath for the classes in the javax.servlet and javax.servlet.http packages. I know how to do it for JavaWebServer. JavaWebServer has a jar called servlet.jar that contains all these classes. What you need to do is to put this jar file in your classpath. There will be a similar jar file for Tomcat server also. You need to refer the Tomcat server documentation for that.
The path and the classpath have to be set like this...
d:\>path=%path%;.;c:\jdk1.3\bin;
d:\>set classpath=%classpath%;.;c:\jdk1.3\lib;c:\JavaWebServer2.0\lib\servlet.jar;
assuming tht JWS is installed in c:\JavaWebServer2.0
Also note that there should be no spaces in between while setting the classpath. In your case you have to change the last part of the classpath to customize your requirement.
Hope that will help.
Regards
Jaydeep -
Unable to compile class for JSP. apache-tomcat-6. What could be wrong?
Hello, I am new to JSP and I am trying a very basic jsp and class file on Windows XP. I get the Unable to compile class for JSP.
Steps that I have done:
javac ch06_01.java , placed the ch06_01.class under
C:\Apps\apache-tomcat-6.0.16\webapps\ch06\WEB-INF\classes
Then grabbed the ch06_02.jsp and placed it under
C:\Apps\apache-tomcat-6.0.16\webapps\ch06\
When I run it (by placing this into Explorer or Firefox URL
http://localhost:8080/ch06/ch06_02.jsp) I get the error further
below. Things I have done and made sure they are in place are:
set up JAVA_HOME to C:\Apps\jdk1.6.0_06
Using CATALINA_BASE: C:\Apps\apache-tomcat-6.0.16
Using CATALINA_HOME: C:\Apps\apache-tomcat-6.0.16
Using CATALINA_TMPDIR: C:\Apps\apache-tomcat-6.0.16\temp
Using JRE_HOME: C:\Apps\jre1.6.0_06
I did a google on the error and I found people saying to place the
tools.jar from the jsk into the lib directory under CATALINA_HOME. But
the examples still don't work. What step could I be missing? Your help is greatly
appreciated.
This is the simple jsp file:
<%@ page import="ch06_01" %>
<HTML>
<HEAD>
<TITLE>Using a JavaBean</TITLE>
</HEAD>
<BODY>
<H1>Using a JavaBean</H1>
<% ch06_01 messager = new ch06_01(); %>
The message is: <%= messager.msg() %>
</BODY>
</HTML>
this is the simple ch6_01 java file:
public class ch06_01
public ch06_01()
public String msg()
return "Hello from JSP!";
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented
it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 6 in the generated java file
The import ch06_01 cannot be resolved
An error occurred at line: 9 in the jsp file: /ch06_02.jsp
ch06_01 cannot be resolved to a type
6: <BODY>
7: <H1>Using a JavaBean</H1>
8:
9: <% ch06_01 messager = new ch06_01(); %>
10:
11: The message is: <%= messager.msg() %>
12:
An error occurred at line: 9 in the jsp file: /ch06_02.jsp
ch06_01 cannot be resolved to a type
6: <BODY>
7: <H1>Using a JavaBean</H1>
8:
9: <% ch06_01 messager = new ch06_01(); %>
10:
11: The message is: <%= messager.msg() %>
12:
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:423)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:316)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:294)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:281)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
Edited by: indikon1 on Jun 12, 2008 1:18 PM
I just updated the directories of the variables to reflect the current status of my system.What is wrong is that you are using an "old" jsp tutorial :-)
Since Java 1.4, JSPs have been unable to access classes in the "default" package.
What you need to do:
Put the java class ch06_01 in a package.
Steps to do this
- Edit ch06_01 and add the following to the very top of the file (without the quotes): "package mypackage;"
- create a folder "mypackage"
- move ch06_01.java into that folder
- compile that class (now in the mypackage package)
- place ch06_01.class under C:\Apps\apache-tomcat-6.0.16\webapps\ch06\WEB-INF\classes\mypackage
In your jsp:
<%@ page import="mypackage.ch06_01" %>
I would suggest using a more up-to-date tutorial that uses JSTL.
Take a look at this [Apache Tomcat tutorial|http://www.coreservlets.com/Apache-Tomcat-Tutorial/index.html] -
Unable to compil class for jsp
error is
HTTP Status 500 -
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 6 in the generated java file
Syntax error on token ".", Identifier expected after this token
An error occurred at line: 7 in the generated java file
Syntax error on token ".", Identifier expected after this token
An error occurred at line: 9 in the jsp file: /travel/issue.jsp
LibraryStudent cannot be resolved to a type
6: <BODY>
7: <H1>issue books</H1>
8: <CENTER>
9: <jsp:useBean id="student"
10: type="LibraryStudent"
11: scope="session" />
12: student name:
An error occurred at line: 9 in the jsp file: /travel/issue.jsp
LibraryStudent cannot be resolved to a type
6: <BODY>
7: <H1>issue books</H1>
8: <CENTER>
9: <jsp:useBean id="student"
10: type="LibraryStudent"
11: scope="session" />
12: student name:
An error occurred at line: 13 in the jsp file: /travel/issue.jsp
LibraryStudent cannot be resolved to a type
10: type="LibraryStudent"
11: scope="session" />
12: student name:
13: <jsp:getProperty name="student" property="studentName" />
14:
15: book name:
16: <jsp:getProperty name="student" property="bookName" />
An error occurred at line: 16 in the jsp file: /travel/issue.jsp
LibraryStudent cannot be resolved to a type
13: <jsp:getProperty name="student" property="studentName" />
14:
15: book name:
16: <jsp:getProperty name="student" property="bookName" />
17:
18: <jsp:getProperty name="student"
19: property="issueData" />
An error occurred at line: 18 in the jsp file: /travel/issue.jsp
LibraryStudent cannot be resolved to a type
15: book name:
16: <jsp:getProperty name="student" property="bookName" />
17:
18: <jsp:getProperty name="student"
19: property="issueData" />
20: </FORM>
21: </CENTER>LibraryStudent.java is
import java.util.*;
import java.text.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.util.*;
public class LibraryStudent {
private String emailAddress, s,password, sname,bname;
private String date,value;
public String getStudentName() {
return(sname);
public void setStudentName(String sname) {
this.sname = sname;
public String getEmailAddress() {
return(emailAddress);
public void setEmailAddress(String emailAddress) {
this.emailAddress = emailAddress;
public String getPassword() {
return(password);
public void setPassword(String password) {
this.password = password;
public String getBookName() {
return(bname);
public void setBookName(String bname) {
this.bname = bname;
public String getDate() {
return(date);
public void setDate(String date) {
this.date = date;
public String getIssueData() //method that create connection withh database
throws ServletException,IOException{
try{
getDate(); //and add a entry in database
getBookName();
getStudentName();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:db2");
Statement st=con.createStatement();
String sql =
"insert into table1 (bookname,studentname,date) values(bname,sname,date)";
st.executeUpdate(sql);
System.out.println(sql);
String s= "your book has been issued ";
return(s);
catch(Exception e)
e.printStackTrace();
return "failed";
public String getSumbitData()
throws ServletException,IOException{
try
getBookName();
getStudentName();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:db2");
Statement st=con.createStatement();
String sql =
"delete from db2 where bookname='bname' and studentname=sname";
st.executeUpdate(sql);
System.out.println(sql);
String s="your book has been sumbitted ";
return(s) ;
catch(Exception e)
e.printStackTrace();
return "failed";
public static int findStudent //to validate customer
(String emailAddress,
String password) throws ServletException,IOException{
try
if (emailAddress == null) {
return(0);
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:user");
Statement st=con.createStatement();
String sql="select * from user where name='"+emailAddress+"' and password='"+password+"'";
System.out.println(sql);
ResultSet rs=st.executeQuery(sql);
if(rs.next())
return(1);
else
return(0);
}catch(Exception e)
e.printStackTrace();
return (0);}
to be continued.............and Library.java is import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Library extends HttpServlet {
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
String emailAddress = request.getParameter("emailAddress");//use to email&pass
String password = request.getParameter("password");//from html page
LibraryStudent student = new LibraryStudent();//Make a student Object
int a=LibraryStudent.findStudent(emailAddress, password);//to validate student
if (a==0) {
gotoPage("/library/accounts.jsp", request, response);
else
student.setStudentName(request.getParameter("sname"));//use to sent other textbox
student.setBookName(request.getParameter("bname"));//data in librarystudent
student.setDate(request.getParameter("date"));//class after validation
HttpSession session = request.getSession(true);
session.putValue("student", student);
//for moving different page
if (request.getParameter("issue") != null) {
gotoPage("/travel/issue.jsp",
request, response);
} else if (request.getParameter("sumbit") != null) {
gotoPage("/travel/sumbit.jsp",
request, response);
} else if (request.getParameter("search") != null) {
gotoPage("/travel/search.jsp",
request, response);
} else if (request.getParameter("account") != null) {
gotoPage("/travel/EditAccounts.jsp",
request, response);
} else {
gotoPage("/travel/IllegalRequest.jsp",
request, response);
private void gotoPage(String address,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
RequestDispatcher dispatcher =
getServletContext().getRequestDispatcher(address);
dispatcher.forward(request, response);
} issue.jsp is
<%@page import="java.io.,java.util.,java.sql.*"%>
<HTML>
<HEAD>
<TITLE>issue books</TITLE>
</HEAD>
<BODY>
<H1>issue books</H1>
<CENTER>
<jsp:useBean id="student"
type="LibraryStudent"
scope="session" />
student name:
<jsp:getProperty name="student" property="studentName" />
book name:
<jsp:getProperty name="student" property="bookName" />
<jsp:getProperty name="student"
property="issueData" />
</FORM>
</CENTER>
</BODY>
</HTML> plz solve my problem .i m new to servlet and jsp and i have keen desire to learn this topic -
Unable to compile class for JSP--- help me plz!!!!!
hi friends;
Pease suggest me where i am wrong, i think javabean is not instantiated in jsp file.may be it is related to the classpath of javabean. i have not set any variable for javabean classpath. and i put javabean class file in
TOMCAT_HOME/webapps/test3/WEB-INF/UseDta.class
and all the jsp and html in /test3. my jsp an javabeans are--
1. GetName.html
<HTML>
<BODY>
<FORM METHOD=POST ACTION="SaveName.jsp">
What's your name? <INPUT TYPE=TEXT NAME=username SIZE=20><BR>
What's your e-mail address? <INPUT TYPE=TEXT NAME=email SIZE=20><BR>
What's your age? <INPUT TYPE=TEXT NAME=age SIZE=4>
<P><INPUT TYPE=SUBMIT>
</FORM>
</BODY>
</HTML>
2. SaveName.jsp
<jsp:useBean id="user" class="UserData" scope="session">
<jsp:setProperty name="user" property="*"/>
</jsp:useBean>
<HTML>
<BODY>
Continue
</BODY>
</HTML>
3. UserData.java
public class UserData {
String username;
String email;
int age;
public UserData(){}
public void setUsername( String value )
username = value;
public void setEmail( String value )
email = value;
public void setAge( int value )
age = value;
public String getUsername() { return username; }
public String getEmail() { return email; }
public int getAge() { return age; }
4. NextPage.jsp
<jsp:useBean id="user" class="UserData" scope="session"/>
<HTML>
<BODY>
You entered<BR>
Name: <%= user.getUsername() %><BR>
Email: <%= user.getEmail() %><BR>
Age: <%= user.getAge() %><BR>
</BODY>
</HTML>
url: http://localhost:8080/test3/GetName.html
is it related to context path??
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 2 in the jsp file: /SaveName.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\test3\org\apache\jsp\SaveName_jsp.java:44: cannot find symbol
symbol : class UserData
location: class org.apache.jsp.SaveName_jsp
UserData user = null;
^
An error occurred at line: 2 in the jsp file: /SaveName.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\test3\org\apache\jsp\SaveName_jsp.java:46: cannot find symbol
symbol : class UserData
location: class org.apache.jsp.SaveName_jsp
user = (UserData) jspxpage_context.getAttribute("user", PageContext.SESSION_SCOPE);
^
An error occurred at line: 2 in the jsp file: /SaveName.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\test3\org\apache\jsp\SaveName_jsp.java:48: cannot find symbol
symbol : class UserData
location: class org.apache.jsp.SaveName_jsp
user = new UserData();
^
3 errors
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:437)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:497)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:476)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:464)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.30 logs.
Apache Tomcat/5.0.30
please Reply me ASAP
i'll be glad if you reply. pleaseI am using Tomcat 6.0.
I have put my UserData class in user package and
used in below jsp(SaveName.jsp)
<%@ page import="user.UserData" %>
<jsp:useBean id="user" class="user.UserData" scope="session"/>
<jsp:setProperty name="user" property="*"/>
<HTML>
<BODY>
Continue
</BODY>
</HTML>
I have already set my classpath as C:\Documents and Settings\user\My Documents\Java\apache-tomcat-6.0.16\apache-tomcat-6.0.16\webapps\ROOT\WEB-INF\classes;
UserData class is in C:\Documents and Settings\user\My Documents\Java\apache-tomcat-6.0.16\apache-tomcat-6.0.16\webapps\ROOT\WEB-INF\classes\user
My UserData class is
package user;
public class UserData {
String username;
String email;
int age;
public UserData(){
this("","",0);
System.out.println("najn thanne puli");
public UserData(String username,String email,int age){
this.username=username;
this.email=email;
this.age=age;
public void setUsername( String value )
username = value;
public void setEmail( String value )
email = value;
public void setAge( int value )
age = value;
public String getUsername() { return username; }
public String getEmail() { return email; }
public int getAge() { return age; }
But running SaveName.jsp shows exception
org.apache.jasper.JasperException: /SaveName.jsp(2,0) The value for the useBean class attribute user.UserData is invalid.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1200)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1160)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2393)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2399)
org.apache.jasper.compiler.Node$Root.accept(Node.java:489)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
org.apache.jasper.compiler.Generator.generate(Generator.java:3372)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:294)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:281)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
Please help me.thanks in advance. -
Unable to compile the java class in the SQL PLUS
Hi Team,
I am unable to compile the java class in the SQL PLUS in dev1 and dev2. It is giving the following error.
But the same class get Compiled in the Toad(Tool) without any error and working fine. Could someone help me
What to do for this for your reference ,Attaching the java class file.
“ORA-29536: badly formed source: Encountered "<EOF>" at line 1, column 28.
Was expecting one of:
----------------------Here is the Java class Code.....................
create or replace and compile java source named "XXVM_ZipFileUtil_Ela"
as
import java.math.BigDecimal;
import java.util.zip.Deflater;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import oracle.sql.*;
import oracle.jdbc.*;
import java.sql.*;
import java.io.*;
public class XXVM_ZipFileUtil_Ela
public static oracle.sql.BLOB getZipFile(
oracle.sql.CHAR zipFilePathCHAR, oracle.sql.CHAR zipFileNameCHAR,
int fileBufferSize, int zipFileBufferSize,
boolean deleteZipFile, java.sql.Array fileNames, java.sql.Array fileContents, java.sql.Array fileContentsLength)
throws IllegalArgumentException, FileNotFoundException, IOException, java.sql.SQLException
String zipFilePath = (zipFilePathCHAR == null) ? null : zipFilePathCHAR.stringValue();
String zipFileName = (zipFileNameCHAR == null) ? null : zipFileNameCHAR.stringValue();
String zipPathAndFileName = new String(
new String(zipFilePath == null || zipFilePath == "" ? "/tmp/" : zipFilePath) +
new String(zipFileName == null || zipFileName == "" ? System.currentTimeMillis() + ".zip" : zipFileName));
byte[] buffer = new byte[fileBufferSize == 0 ? 100000000 : fileBufferSize];
try
Connection conn = DriverManager.getConnection("jdbc:default:connection:");
oracle.sql.CLOB[] fileContentsCLOB = (oracle.sql.CLOB[])fileContents.getArray();
String[] fileNamesString = (String[])fileNames.getArray();
BigDecimal[] fileContentsLengthNumber = (BigDecimal[])fileContentsLength.getArray();
ZipOutputStream zipOut = new ZipOutputStream(new FileOutputStream(zipPathAndFileName));
zipOut.setLevel(Deflater.DEFAULT_COMPRESSION);
for (int i = 0; i < fileNamesString.length; i++) {
System.out.println(i);
zipOut.putNextEntry(new ZipEntry(fileNamesString));
InputStream asciiStream = fileContentsCLOB[i].getAsciiStream(1L);
int asciiReadCount = asciiStream.read(buffer,0,fileContentsLengthNumber[i].intValue());
zipOut.write(buffer, 0, fileContentsLengthNumber[i].intValue());
zipOut.closeEntry();
zipOut.close();
byte zipFileContents[] = new byte[zipFileBufferSize == 0 ? 100000000 : zipFileBufferSize];
FileInputStream zipIn = new FileInputStream(zipPathAndFileName);
int byteCount = zipIn.read(zipFileContents);
zipIn.close();
byte returnFileContents[] = new byte[byteCount];
System.arraycopy(zipFileContents,0,returnFileContents,0,byteCount);
String returnFileContentsString = new String(returnFileContents);
if (deleteZipFile)
boolean deletedFile = (new File(zipPathAndFileName)).delete();
oracle.sql.BLOB returnFileContentsBLOB = null;
returnFileContentsBLOB = BLOB.createTemporary(conn, true, BLOB.DURATION_SESSION);
returnFileContentsBLOB.open(BLOB.MODE_READWRITE);
//OutputStream tempBlobWriter = returnFileContentsBLOB.getBinaryOutputStream();
OutputStream tempBlobWriter = returnFileContentsBLOB.setBinaryStream(1);
tempBlobWriter.write(returnFileContents);
tempBlobWriter.flush();
tempBlobWriter.close();
returnFileContentsBLOB.close();
return returnFileContentsBLOB;
catch (IllegalArgumentException ex) {
ex.printStackTrace();
throw ex;
catch (FileNotFoundException ex) {
ex.printStackTrace();
throw ex;
catch (IOException ex)
ex.printStackTrace();
throw ex;
catch (java.sql.SQLException ex)
ex.printStackTrace();
throw ex;860411 wrote:
Hi Team,
I am unable to compile the java class in the SQL PLUS in dev1 and dev2. It is giving the following error.
But the same class get Compiled in the Toad(Tool) without any error and working fine. Could someone help me
What to do for this for your reference ,Attaching the java class file.
“ORA-29536: badly formed source: Encountered "<EOF>" at line 1, column 28.
Was expecting one of:
I believe the error message is clear and self-explanatory.
----------------------Here is the Java class Code.....................
create or replace and compile java source named "XXVM_ZipFileUtil_Ela"
as
import java.math.BigDecimal;
import java.util.zip.Deflater;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import oracle.sql.*;
import oracle.jdbc.*;
import java.sql.*;
import java.io.*;
public class XXVM_ZipFileUtil_Ela
public static oracle.sql.BLOB getZipFile(
oracle.sql.CHAR zipFilePathCHAR, oracle.sql.CHAR zipFileNameCHAR,
int fileBufferSize, int zipFileBufferSize,
boolean deleteZipFile, java.sql.Array fileNames, java.sql.Array fileContents, java.sql.Array fileContentsLength)
throws IllegalArgumentException, FileNotFoundException, IOException, java.sql.SQLException
String zipFilePath = (zipFilePathCHAR == null) ? null : zipFilePathCHAR.stringValue();
String zipFileName = (zipFileNameCHAR == null) ? null : zipFileNameCHAR.stringValue();
String zipPathAndFileName = new String(
new String(zipFilePath == null || zipFilePath == "" ? "/tmp/" : zipFilePath) +
new String(zipFileName == null || zipFileName == "" ? System.currentTimeMillis() + ".zip" : zipFileName));
byte[] buffer = new byte[fileBufferSize == 0 ? 100000000 : fileBufferSize];
try
Connection conn = DriverManager.getConnection("jdbc:default:connection:");
oracle.sql.CLOB[] fileContentsCLOB = (oracle.sql.CLOB[])fileContents.getArray();
String[] fileNamesString = (String[])fileNames.getArray();
BigDecimal[] fileContentsLengthNumber = (BigDecimal[])fileContentsLength.getArray();
ZipOutputStream zipOut = new ZipOutputStream(new FileOutputStream(zipPathAndFileName));
zipOut.setLevel(Deflater.DEFAULT_COMPRESSION);
for (int i = 0; i < fileNamesString.length; i++) {
System.out.println(i);
zipOut.putNextEntry(new ZipEntry(fileNamesString));
InputStream asciiStream = fileContentsCLOB[i].getAsciiStream(1L);
int asciiReadCount = asciiStream.read(buffer,0,fileContentsLengthNumber[i].intValue());
zipOut.write(buffer, 0, fileContentsLengthNumber[i].intValue());
zipOut.closeEntry();
zipOut.close();
byte zipFileContents[] = new byte[zipFileBufferSize == 0 ? 100000000 : zipFileBufferSize];
FileInputStream zipIn = new FileInputStream(zipPathAndFileName);
int byteCount = zipIn.read(zipFileContents);
zipIn.close();
byte returnFileContents[] = new byte[byteCount];
System.arraycopy(zipFileContents,0,returnFileContents,0,byteCount);
String returnFileContentsString = new String(returnFileContents);
if (deleteZipFile)
boolean deletedFile = (new File(zipPathAndFileName)).delete();
oracle.sql.BLOB returnFileContentsBLOB = null;
returnFileContentsBLOB = BLOB.createTemporary(conn, true, BLOB.DURATION_SESSION);
returnFileContentsBLOB.open(BLOB.MODE_READWRITE);
//OutputStream tempBlobWriter = returnFileContentsBLOB.getBinaryOutputStream();
OutputStream tempBlobWriter = returnFileContentsBLOB.setBinaryStream(1);
tempBlobWriter.write(returnFileContents);
tempBlobWriter.flush();
tempBlobWriter.close();
returnFileContentsBLOB.close();
return returnFileContentsBLOB;
catch (IllegalArgumentException ex) {
ex.printStackTrace();
throw ex;
catch (FileNotFoundException ex) {
ex.printStackTrace();
throw ex;
catch (IOException ex)
ex.printStackTrace();
throw ex;
catch (java.sql.SQLException ex)
ex.printStackTrace();
throw ex;
The last two lines above should be
/Srini -
Unable to compile add.jsp
I am able to run the examples in the tomcat, but unable to run my own add.jsp which tries to connect to oracle9i. The following error is displayed. add.jsp file is copied at the end of this error message.
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
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 4.1\work\Standalone\localhost\examples\add_jsp.java:7: '.' expected
import DbConnect1;
^
1 error
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:130)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:293)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:353)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:370)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:473)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:190)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:193)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:589)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:666)
at java.lang.Thread.run(Thread.java:534)
The add.jsp contents are
<%@page contentType="text/html" import="DbConnect1,java.util.*,java.sql.*,java.lang.*"%>
<html>
<head><title>JSP Page</title></head>
<%
String no,name,c;
//int n;
no=request.getParameter("NUMBER");
//n=Integer.parseInt(no);
name=request.getParameter("NAME");
c=request.getParameter("check");
if(c==null) c="";
if(c.equals("1"))
out.println("Retry Again");
if(name==null )
{name="";}
if(!name.equals(""))
try{
DbConnect1 t=new DbConnect1();
t.insert(no,name);
response.sendRedirect("display.jsp");
}catch(Exception e){response.sendRedirect("add.jsp?check=1");
else {%>
<form action="add.jsp" method=post>
<input type=hidden name=check>
<BODY BGCOLOR=PURPLE>
<BR><PRE><FONT COLOR=WHITE SIZE=4 STYLE="WESTERN"><B><BR><BR><BR><BR> NUMBER <INPUT TYPE=TEXT SIZE=10 NAME="NUMBER">
<BR><BR> NAME <INPUT TYPE=TEXT SIZE=20 NAME="NAME"><BR>
<BR><BR><BR><BR> <INPUT TYPE="SUBMIT" VALUE="ADD" onClick="display()">
</FORM>
</form>
<%}%>
<SCRIPT LANGUAGE ="JavaScript">
function display()
window.location="/project/display.jsp"; }
</SCRIPT>
</html>
Any help would be greatly appreciated.
Thanks
Geethaif you want to know how to declare a package for your classes
Follow the steps to make your application work
Make this as the first statement in your DbConnect1 class
package DbConnect1;
Compile the class and place the DbConnect1.class file into
Tomcat/webapps/<yourapplication>\WEB-INF\classes\package\ directory
for eg : if your package name is test then place the class files under
Tomcat/webapps/<yourapplication>\WEB-INF\classes\test directory
This is where Tomcat looks for class files
If you have any doubts regarding directory dtructure to be followed in Tomcat please refer to some of the example packages under Root directory
In your JSP say
page import = packageName. DbConnect1
-Hope this helps
Regards
Manikantan -
JasperException: Unable to compile class for JSP HELP
I added couple of extra class files into the jar file.. and now its not able to find it! I am running JBoss latest version and using eclipse... any help wud be nice
org.apache.jasper.JasperException: Unable to compile class for JSP
Generated servlet error:
Only a type can be imported. org.jfree.chart.servlet.WebHitChart resolves to a package
Generated servlet error:
Only a type can be imported. org.jfree.chart.servlet.WebHitDataSet resolves to a package
An error occurred at line: 10 in the jsp file: /bar_chart.jsp
Generated servlet error:
WebHitChart cannot be resolved
An error occurred at line: 10 in the jsp file: /bar_chart.jsp
Generated servlet error:
WebHitDataSet cannot be resolved
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:397)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)just a random guess...
I had a ton of issues with JBoss and jfreechart. JBoss uses a different classloader, and its internal versions of the jfreechart classes will be loaded before yours, causing all sorts of issues. Dig through the jboss directories and you'll find a different, older version of jfreechart of one of its classes. Remove them and you'll be in better shape.
Alternatively, look around the JBoss docs for how to disable/turn off the unified classloader for your app (its a directive in jboss-web.xml IIRC). This should make the classloader for your webapp perform to spec, getting rid of the class colission issues. -
Unable to compile Pro C file in windows
Hi
I have installed oracle 11g rel1 in windows XP. But the problem is i am unable to compile Pro C file to produce executable. It is able to convert pro c file to .c file. But not able to produce any executable. My installation did not installed pro c GUI either. nor any demo file of pro c is available under precomp/ folder. Has this installation gone wrong or how can i produce executable?
Thanks
Sasy dont u try this...i m not sure if its a right way to do things, but seems like it can work
$ORACLE_HOME/bin/proc test.pc
cc -I${ORACLE_HOME}/precomp/public -c test.c
do : find /cisa -name "*clntsh*" -print
say u get sumthing lyk this
$ORACLE_HOME/lib32/libclntsh.so.10.1
// instead of this:
cc -o test test.c -L $ORACLE_HOME/lib -lclntsh
write:
cc -o test test.c -L $ORACLE_HOME/lib $ORACLE_HOME/lib32/libclntsh.so.10.1
so u r directly refering to the library while linking
Maybe you are looking for
-
My iMessage on my iPad 4 shows some contacts in red and I can't contact them
My iMessage on my iPad 4 was acting fine. Then suddenly I was getting a red message. One was an android phone and one was an iPhone that I had been writing to with no problem. I have tried everything that I have read when I have googled this question
-
Brief skip at the beginning of a song
I experience a skip (about 200-400ms in duration) at the beginning of most songs (about 2-10 seconds in) when playing in iTunes on my Mac. Disabling Crossfade and Sound Enhancer did nothing. This problem started after upgrading from iTunes 6 to iTune
-
Which TV recording cards do you recommend??
I guess the title says it all. Im looking to buy a TV card and use the Mega 180 as a VCR....but since nothing is easy with the MEGAS i just wanted to know from peoples experience which one work and are pretty easy to install and setup?? cheers Jon St
-
Java.io.StreamCorruptedException: Type code out of range, is 63
Hi, i ma using Weblogic 7.0 ......... I got one exception in the weblogic log, Exception is as follows - ####<Nov 28, 2006 3:15:54 PM EST> <Info> <EJB> <atnyprd5> <XXXServer1> <ExecuteThread: '83' for queue: 'default'> <kernel identity> <11864:d63651
-
Isn't it poss to print 3 6"x4" pic on a page?
It is physically possible, "Portraits & Prints" has that template. I'd like to be able to do it in Lightroom. How to do? Thanks for any help.