My JSP won`t compile
Hi,
This is my first day learning JSP and I`ve hit a wall already!
I`m trying to compile a JSP page using Visual Cafe, but, when I try to comile it I get: -
JSPC (13:22:33): [jspc] warning: expected file C:\Projects\VCafe\JSP\Name Echo" c:\Projects\VCafe\jsp\Name\WEB-INF\web.xml not found, tag libraries cannot be resolved.
JSPC (13:22:33): WebGain Java! JustInTime Compiler Version 4.00.007(x) for JDK 1.2
JSPC (13:22:33): Copyright (C) 2000 WebGain, Inc.
JSPC (13:22:33):
VisualCafe (13:22:33): Compilation of JSP Failed
VisualCafe (13:22:33): Build Failed
This confuses me as I`m not used to this kind of error message and I can`t find the answer after two hours of confusion.
Here`s my JSP code(which looks fine to me): -
<html>
<head>
<title>
Echo My Name
</title>
</head>
<body bgcolor="#FFFFFF">
<font face = "Arial, Helvetica"><font size="+2">
<br>
<br>
<br>
<center>
<b>
Well hello there,
<%= request.getParameter("userName")%>
</b>
</center>
</body>
</html>
Can you help?
Cheers,
Tom
The JSP looks fine to me too.
I haven't used VisualCafe before ; I'd think you are probably puting your jsp in the wrong directory or the JSP compiler wasn't set up correctly. Can you run any built-in examples that must be shipped with the VisulaCafe JSP compiler to see if its working correctly. Also, if it is, move your jsp page to the /examples directory and run it from there to see it.
Similar Messages
-
I get the follwing ereror when trying to run my JSP page. I know its the importing of a bean taht is acusing this error, but dont know how or why.
My JSP is in webapps/examples/caravansite/caravanbooking.jsp, and the bean in webapps/examples/WEB-INF/classes/anp/DetailsStoreBean.class
I am using the following code to try and access my bean:
<%@ page import="../WEB-INF/classes/anp.DetailsStoreBean" %>
<jsp:useBean id="booking" scope="session" class="DetailsStoreBean" />org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
import ../WEB-INF/classes/anp.DetailsStoreBean;
^
public class caravanbooking$jsp extends HttpJspBase {
^
2 errors, 1 warning
at org.apache.jasper.compiler.Compiler.compile(Unknown Source)
at org.apache.jasper.servlet.JspServlet.loadJSP(Unknown Source)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(Unknown Source)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(Unknown Source)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(Unknown Source)
at org.apache.jasper.servlet.JspServlet.service(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Unknown Source)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(Unknown Source)
at org.apache.catalina.core.StandardWrapperValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)
at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)
at org.apache.catalina.core.StandardContextValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source)
at org.apache.catalina.valves.CertificatesValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)
at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)
at org.apache.catalina.core.StandardContext.invoke(Unknown Source)
at org.apache.catalina.core.StandardHostValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source)
at org.apache.catalina.valves.AccessLogValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)
at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)
at org.apache.catalina.core.StandardEngineValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)
at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)
at org.apache.catalina.connector.http.HttpProcessor.process(Unknown Source)
at org.apache.catalina.connector.http.HttpProcessor.run(Unknown Source)
at java.lang.Thread.run(Thread.java:539)
Anybody have some ideas?i;m still have this error msg although my code same with above !!!
why ??
Apache Tomcat/4.0.5 - HTTP Status 500 - Internal Server Error
type Exception report
message Internal Server Error
description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
An error occurred at line: 3 in the jsp file: /sunAware_Project/EWSstep1.jsp
Generated servlet error:
/var/apache/tomcat/work/Standalone/localhost/marketing/sunAware_Project/EWSstep1$jsp.java:60: Class beans.RequireInfo2 not found.
beans.RequireInfo2 info = null;
^
An error occurred at line: 3 in the jsp file: /sunAware_Project/EWSstep1.jsp
Generated servlet error:
/var/apache/tomcat/work/Standalone/localhost/marketing/sunAware_Project/EWSstep1$jsp.java:63: Class beans.RequireInfo2 not found.
info= (beans.RequireInfo2)
^
An error occurred at line: 3 in the jsp file: /sunAware_Project/EWSstep1.jsp
Generated servlet error:
/var/apache/tomcat/work/Standalone/localhost/marketing/sunAware_Project/EWSstep1$jsp.java:68: Class beans.RequireInfo2 not found.
info = (beans.RequireInfo2) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "beans.RequireInfo2");
^
3 errors, 1 warning
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:285)
at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:548)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:176)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:188)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
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:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
at java.lang.Thread.run(Thread.java:534) -
Tomcat 5.0.3 JSP won't compile
I've just installed Java SDK 1.5.0 and Tomcat 5.0.3 on what I hope will be my test server. But whenever it tries to compile a JSP I get this error
javac : target release 1.3 conflicts with default source release 1.5
So obviously the JSP compiler is trying to compile 1.5 source into a 1.3 class. Why it's trying to do this I've no idea, because there isn't any java in the JSP , as I removed it to create an "empty" JSP just to see if it was my coding causing the problem.
I've tried altering the JSP servlet by setting an <init-param> called "target" to "1.5" but that had no effect that I could see.
I could really use some help here.If you want to use java 1.5, you are going to need to use Tomcat 5.5, which is basically Tomcat 5.0 but with JDK 1.5 support.
Why it's trying to do this I've no idea, because there isn't any java in the JSP All JSPs are translated into Servlets, which are Java classes, and then compiled before they are displayed the first time.
I've tried altering the JSP servlet by setting an <init-param> called "target" to "1.5" but that had no effect that I could see.There is a setting burried inside the Catalina startup scripts that set up how Jasper compiles the JSPs. I forget exactly where... but it doesn't matter. If you want to use JDK 1.5, you should go to Tomcat 5.5. -
Tomcat won't compile jsps if they are in any directory other than root
I'm running a new instance of Tomcat, and can't get a simple jsp file to compile, if it's in any directory other than the root.
The jsp is:
<%@ page import="test.Simple" %>
<%@ page contentType="text/html" language="java" %>
<html>
<body><%=Simple.makeText()%>
</body>
</html>
and the Simple class is:
package test;
import java.util.Random;
public class Simple {
public static String makeText() {
return String.valueOf(new Random().nextInt());
When I place the jsp in the root directory, it works fine.
When I place the jsp in any subfolder (eg: /debug/1b.jsp), I get the following error:
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
Generated servlet error:
Only a type can be imported. test.Simple resolves to a package
An error occurred at line: 14 in the jsp file: /1b.jsp
Generated servlet error:
Simple cannot be resolved
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
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:802)
root cause
org.apache.jasper.JasperException: Unable to compile class for JSP
Generated servlet error:
Only a type can be imported. test.Simple resolves to a package
An error occurred at line: 14 in the jsp file: /1b.jsp
Generated servlet error:
Simple 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:414)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:297)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
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:802)
Here's the server info:
Server version: Apache Tomcat/5.5.25
Server built: Sep 24 2007 11:31:18
Server number: 5.5.25.0
OS Name: Linux
OS Version: 2.6.20.20-071008a
Architecture: amd64
JVM Version: 1.5.0_10-b03
JVM Vendor: Sun Microsystems Inc.
Using fedora core 6.
I looked into the Tomcat work directory, and it looked as if the jsp was successfully converted to a java file. I'm not sure where to look, as all the settings are defaults.
Any help is greatly appreciated. Thanks:D :D :D...
My friend it'd be great idea if you can find google tutorial on TOMCAT/web application basics
anyways coming back to your problem
whenever,an application is deployed on tomcat a new folder is being created at the following location %CATILINA_HOME%/webapp/ with respect to application name.
Therefore try to maintain an architecture like the one below if you programmin any web application.
%CATILINA_HOME%/webapp/<applicationName>/(place all your .jsp files)
-----------------%CATILINA_HOME%/webapp/<applicationName>/META_INF/(Place your mainfest files & context specific configuration files)
-----------------%CATILINA_HOME%/webapp/<applicationName>/WEB_INF/ (Genrally used to save secured files which cannot be access directly and always make sure you prepare a web.xml file associated to the application)
-----------------%CATILINA_HOME%/webapp/<applicationName>/WEB_INF/lib (place where all your .jar file libraries are being placed)
-----------------%CATILINA_HOME%/webapp/<applicationName>/WEB_INF/classes (place where all your .class,resource files are being placed as the pacakage structure you have choosed in)
If this doesnot work even if you ensuring everything's right.Reading through tutorials & speding time on finding resources by yourself would be a great idea.
I hope there are no hard issue on this. :)
REGARDS,
RaHuL -
JDeveloper 10.1.2.1 won't compile my code?
Hi,
I'm pretty new to JDeveloper, and Java in general.
I've just downloaded and tried to run JDeveloper 10g (10.1.2.1.0, Build 1913) and I've having problems.
When the application loads, I get a dialog message titled "Java Virtual Machine Launcher", with the message "Could not find the main class. Program will exit"
JDeveloper then finishes loading.
I've knocked up a quick JSP page, but it won't compile. I get the message "Internal compilation error, terminated with a fatal exception."
Also, I've notived that if I go to Project Properties and try to look at Profiles->Development->Libraries, JDeveloper throws a NullPointerException.
I've got JDeveloper 10.1.3 on my machine, and it has none of these problems?
After looking around on the web, I'm thinking it might be a CLASS_PATH problem, but how can I confirm this, and how can I fix it?
Any ideas on what is wrong would be appreciated?
Thanks
ThomThanks thahn.
That fixed the "Java Virtual Machine Launcher" error - I would never have thought spaces in the directory name could have caused this problem!
The other problems remain though, so I still can't compile any code. -
I have had success in one of my servlets using JavaMail. I was able to send an email to my inbox to test it out. I proceeded to create another servlet based on that 1st one, and for reasons I can't explain, the servlet won't compile.
I get this error.
cannot resolve symbol :
variable : RecipientType
location : java.lang.String
msg.setRecipient(Message.RecipientType.TO, to); I get the same error when I switch out setRecipient for addRecipient.
However, through further testing, I've found that not only does my 1st servlet still compile, but I'm also able to run the code from the 2nd servlet, successfully in a JSP page. This is driving me nuts...how could there be a problem compiling? There's no reason why one servlet compiles (with similar if not almost exactly the same code) and the other won't. Plus this runs fine in a JSP page...what's going on??? I've spent hours on this and I can't figure it out...please help, any input is appreciated.
Here is the JSP page that runs successfully :
<%@page import="java.io.*"%>
<%@page import="java.util.Properties"%>
<%@page import="javax.mail.*"%>
<%@page import="javax.mail.Message.RecipientType"%>
<%@page import="javax.mail.internet.*"%>
<%@page import="javax.servlet.*"%>
<%@page import="javax.servlet.http.*"%>
<%@page import="javax.naming.*"%>
<%@page import="javax.sql.*"%>
<%@page import="java.sql.*"%>
<%
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try {
Context ctx = new InitialContext();
if(ctx == null )
throw new Exception("Boom - No Context");
DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/myDB");
conn = ds.getConnection();
stmt = conn.createStatement();
//get the POP3 and SMTP property values from db
rs = stmt.executeQuery("Select Tech_Support_Email, POP3, SMTP from sitewide_info");
String hostemailaddress = "";
String POP3 = ""; //mail.smtp.host, this one 1st
String SMTP = ""; //smtp.stratos.net, this one 2nd
if(rs.next()) {
hostemailaddress = rs.getString(1);
POP3 = rs.getString(2);
SMTP = rs.getString(3);
// Specify the SMTP Host
Properties props = new Properties();
//POP3 = mail.smtp.host & SMTP = smtp.stratos.net - must be in this order
props.put(POP3, SMTP);
// Create a mail session
Session ssn = Session.getDefaultInstance(props, null);
ssn.setDebug(true);
String subject = "Testing out Email";
String body = "hello";
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rs = stmt.executeQuery("Select Customer_Name, Email_Address from customer_profiles where "
+"Customer_Number=1111");
String fromName = "";
String fromEmail = "";
if(rs.next()) {
fromName = rs.getString(1);
fromEmail = rs.getString(2);
InternetAddress from = new InternetAddress(fromEmail,fromName);
String toName = "Bob";
InternetAddress to = new InternetAddress(hostemailaddress,toName);
// Create the message
Message msg = new MimeMessage(ssn);
msg.setFrom(from);
msg.addRecipient(Message.RecipientType.TO, to);
msg.setSubject(subject);
msg.setContent(body, "text/html");
Transport.send(msg);
}//try
catch (MessagingException mex) {
mex.printStackTrace(); }
catch(Exception e) {}
finally {
try {
if (rs!=null) rs.close();
catch(SQLException e){}
try {
if (stmt!=null) stmt.close();
catch(SQLException e){}
try {
if (conn!=null) conn.close();
catch(SQLException e){}
}//finally
%>
Here's the servlet that won't compile :
package testing.servlets.email;
import java.io.*;
import java.util.Properties;
import javax.mail.*;
import javax.mail.Message.RecipientType;
import javax.mail.internet.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.naming.*;
import javax.sql.*;
import java.sql.*;
public class MessageCenterServlet extends HttpServlet {
public Connection conn = null;
public Statement stmt = null;
public Statement stmt2 = null;
public ResultSet rs = null;
public ResultSet rss = null;
public PrintWriter out = null;
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
doPost(req,res);
public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
try {
out = res.getWriter();
Context ctx = new InitialContext();
if(ctx == null )
throw new Exception("Boom - No Context");
DataSource ds =
(DataSource)ctx.lookup(
"java:comp/env/jdbc/myDB");
conn = ds.getConnection();
stmt = conn.createStatement();
stmt2 = conn.createStatement();
HttpSession session = req.getSession();
String Subject = (String)session.getAttribute("Subject");
String Message = (String)session.getAttribute("Message");
sendAnEmail(rs,stmt,Subject,Message,res);
}//try
catch (Exception e) { }
finally { cleanup(rs,rss,stmt,stmt2,conn); }
}//post
public void cleanup(ResultSet r, ResultSet rs, Statement s, Statement s2, Connection c){
try {
if (r!=null) r.close();
catch(SQLException e){}
try {
if (rs!=null) rs.close();
catch(SQLException e){}
try {
if (s!=null) s.close();
catch(SQLException e){}
try {
if (s2!=null) s2.close();
catch(SQLException e){}
try {
if (c!=null) c.close();
catch(SQLException e){}
}//cleanUp
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
public void sendAnEmail(ResultSet rs, Statement stmt, String Subject,String Message, HttpServletResponse res) {
try {
//get the POP3 and SMTP property values from db
rs = stmt.executeQuery("Select Tech_Support_Email, POP3, SMTP from sitewide_info");
String hostemailaddress = "";
String POP3 = "";
String SMTP = "";
if(rs.next()) {
hostemailaddress = rs.getString(1);
POP3 = rs.getString(2);
SMTP = rs.getString(3);
// Specify the SMTP Host
Properties props = new Properties();
props.put(POP3, SMTP);
// Create a mail session
Session ssn = Session.getDefaultInstance(props, null);
ssn.setDebug(true);
String subject = "Testing out Email";
String body = "hello";
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rs = stmt.executeQuery("Select Customer_Name, Email_Address from customer_profiles where "
+"Customer_Number=1111");
String fromName = "";
String fromEmail = "";
if(rs.next()) {
fromName = rs.getString(1);
fromEmail = rs.getString(2);
InternetAddress from = new InternetAddress(fromDealerEmail,fromDealerName);
String toName = "Bob";
InternetAddress to = new InternetAddress(hostemailaddress,toName);
// Create the message
Message msg = new MimeMessage(ssn);
msg.setFrom(from);
msg.setRecipient(Message.RecipientType.TO, to);
msg.setSubject(subject);
msg.setContent(body, "text/html");
Transport.send(msg);
}//try
catch (MessagingException mex) {
mex.printStackTrace(); }
catch(Exception e) {}
}//end
}//class -Love2Java
Edited by: Love2Java on Mar 11, 2008 9:15 PMI have similar problem
I have the below code in Eclipse and I was able to compile and run it and everything works fine...
but I have code over in Oracle Jdev and jdev is complaining that "Message.RecipientType.TO" is not found....
I do have all the jars in the class path.... can't figure out what's wrong
can some one plz help me out.
import java.util.Date;
import java.util.Properties;
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import javax.mail.Authenticator;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Multipart;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import javax.mail.util.ByteArrayDataSource;
public void postMail( String recipients, String subject,
String message , String from) throws MessagingException
boolean debug = false;
//Set the host smtp address
Properties props = new Properties();
props.put("mail.smtp.host", "server");
props.put("mail.smtp.auth", "true");
Authenticator auth = new SMTPAuthenticator();
Session session = Session.getDefaultInstance(props, auth);
session.setDebug(debug);
// create a message
Message msg = new MimeMessage(session);
// set the from and to address
InternetAddress addressFrom = new InternetAddress(from);
msg.setFrom(addressFrom);
msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(recipients, false));
// Setting the Subject and Content Type
msg.setSubject(subject);
msg.setContent(message, "text/plain");
Transport.send(msg);
private class SMTPAuthenticator extends javax.mail.Authenticator
public PasswordAuthentication getPasswordAuthentication()
String username ="user";
String password = "pass";
return new PasswordAuthentication(username, password);
} -
This is my first in depth attempt to understand the code for enabling arrays. I THINK I have a fairly simple problem, but the code won't compile and NetBeans is telling me I'm missing a symbol &/or class, which I just don't get. Here is the code for the Inventory1 module as well as the main module - what am I not seeing?
Inventory1 module
import java.util.Scanner;
import static java.lang.System.out;
public class Inventory1
//declare and initialize variables
int[] itemNumber = new int [5];
String[] productName = new String[5];
int[] stockAmount = new int[5];
double[] productCost = new double[5];
double[] totalValue = new double[5];
int i;
//int i = 0;
//initialize scanner
Scanner sc = new Scanner(System.in);
Inventory1 info = new Inventory1
public void inventoryInput()
while (int i = 0; i < 5; i++)
out.println("Please enter item number: "); //prompt - item number
info.itemNumber[i] = sc.nextInt(); // input
out.println( "Enter product name/description: "); //prompt - product name
info.productName[i] = sc.nextLine(); // input
out.println("Quantity in stock: "); // prompt - quantity
int temp = sc.nextInt(); // capture temp number to verify
if( temp <=0 )
{ // ensure stock amount is positive number
out.println( "Inventory numbers must be positive. Please" +
"enter a correct value." ); // prompt for correct #
temp = sc.nextInt(); // exit if statement
else info.stockAmount[i] = temp; // input
out.println("What is the product cost for each unit? "); // prompt - cost
double temp2 = sc.nextDouble();
if( temp <=0 )
out.println( "Product cost must be a positive dollar " +
"amount. Please enter correct product cost." );
temp2 = sc.nextDouble();
else info.productCost[i] = temp2;
out.println( "We hope this inventory program was helpful. Thank you for " +
"using our program." );
} // end method inventoryInput
}main module
public class Main {
public static void main(String[] args) { //start main method
Inventory1 currentInventory = new Inventory1(); //call Inventory class
currentInventory.inventoryInput();
}init:
deps-jar:
Compiling 1 source file to C:\Documents and Settings\Tammy\My Documents\School\JavaProgramming\Inventory\build\classes
C:\Documents and Settings\Tammy\My Documents\School\JavaProgramming\Inventory\src\inventory\Inventory1.java:28: '(' or '[' expected
public void inventoryInput()
C:\Documents and Settings\Tammy\My Documents\School\JavaProgramming\Inventory\src\inventory\Inventory1.java:30: '.class' expected
while (int i = 0; i < 5; i++)
C:\Documents and Settings\Tammy\My Documents\School\JavaProgramming\Inventory\src\inventory\Inventory1.java:30: illegal start of type
while (int i = 0; i < 5; i++)
C:\Documents and Settings\Tammy\My Documents\School\JavaProgramming\Inventory\src\inventory\Inventory1.java:30: not a statement
while (int i = 0; i < 5; i++)
C:\Documents and Settings\Tammy\My Documents\School\JavaProgramming\Inventory\src\inventory\Inventory1.java:30: ';' expected
while (int i = 0; i < 5; i++)
5 errors
BUILD FAILED (total time: 0 seconds) -
Hi,
I'm trying to migrate my application from JDev 11.1.1.0.2 to 11.1.2.2.0 but even after Jdev migrate to new version, the application won't compile correct. Seems that some classes wont recognize dependecies from other package. If i have a class in Web that import a class from Model, in compile time the console give me this kind a error: "package 'xxx.yyy.www' does not exist". If i open any class that gave me this error there isn't any warning or red line showing errors, in the line of the import i can use Ctrl + right click and go to the class without problems. The dependecies between projects (web, model and ejb) are correct. I dont know what is, any help will be appreciated.
Thanks in advance,
Alexandre Rocco.Hi
I am facing the same problem when migrating from JDev 11.1.1.4.0 to JDev 11.1.2.2.0. Any idea?
Regards,
Ferez -
DG4ODBC MSSQL query works in sql, but won't compile in PL/SQL.
I'm using DG4ODBC from 11g to query a SQL Server database. The query I'm using works in a SQL DEveloper SQL worksheet and sqlplus, but won't compile in a PL/SQL procedure.
The query is
INSERT
INTO crm_labels
accountid,
label_name,
cir_labelcode,
cir_knownasname,
cir_countryidname,
parentaccountidname,
cir_customertypecode1,
cir_customertypecode2,
cir_dealstatus
SELECT "AccountId",
REPLACE("Name",chr(0)) label_name,
REPLACE("Cir_labelcode",chr(0)) ,
REPLACE("Cir_knownasname",chr(0)),
REPLACE("cir_countryidName",chr(0)),
REPLACE("ParentAccountIdName",chr(0)),
"Cir_customertypecode1",
"Cir_customertypecode2",
"Cir_dealstatus"
FROM "dbo"."Account"@crmsvc
WHERE "Cir_labelcode" IS NOT NULL;The error message is
Error(1): ORA-04052: error occurred when looking up remote object dbo.Account@CRMSVC ORA-01948: identifier's name length (34) exceeds maximum (30)I'm guessing that it is attempting to describe additional columns in the Account table.
If I remove the dbo,
FROM "Account"@crmsvcI get
Error(1): ORA-04052: error occurred when looking up remote object PUBLIC.Account@CRMSVC ORA-00604: error occurred at recursive SQL level 1 ORA-28500: connection from ORACLE to a non-Oracle system returned this message: [Microsoft][ODBC SQL Server Driver][SQL Serve which is less than helpful. However, if I try to use the same query to create a materialized view, I get.
SQL Error: ORA-04052: error occurred when looking up remote object PUBLIC.Account@CRMSVC
ORA-00604: error occurred at recursive SQL level 1
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'Address1_TimeZoneRuleVersionNu'. {42S22,NativeErr = 207}[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'Address1_UTCConversionTimeZone'. {42S22,NativeErr = 207}[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'Address2_TimeZoneRuleVersionNu'. {42S22,NativeErr = 207}[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'Address2_UTCConversionTimeZone'. {42S22,NativeErr = 207}[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'Pias_NewLabelInDealNotificatio'. {42S22,NativeErr = 207}
ORA-02063: preceding 2 lines from CRMSVCwhich seems to confim that in some circumstance, oracle will attempt to parse more than was asked for.
Any work arounds?
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for 64-bit Windows: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
DG4ODBC is also 11.2.0.3The gateway claims about this column "Address1_TimeZoneRuleVersionNu" which is not listed in your select list.
When a gateway connection is established it first checks out all columns of the table you want to select to determine the data types and then it fetches the data for the columns you want to select. But there's also an exception - when you use functions the gateway is not able to translate into the syntax of the foreign database. in this case ALL columns will be fetched into the Oracle database and the result is processed locally (post processing).
You're using replace function which won't be mapped to the foreign database equivalent using DG4ODBC so it will post process the result and fetch from all columns all the data into the Oracle database. Your table contains a column which exceeds the 30 character limitation of Oracle, hence the select will fail.
The only work around is to create a view on the foreign database side which reduces the column name length to 30 characters or less. -
SQL query won't compile based on DB role privileges
Can someone give me an explanation why the SQL query in a report won't compile if an object is owned by another schema and the parsing schema is given privileges to the table via a role grant?
Or to phrase it another way, why do we have to make direct grants on tables to the parsing schema for reports based on SQL queries that access tables in other schemas?
Thanks in advance,
PaulPaul - In Oracle, roles are not enabled during the execution of definer's rights stored procedures which is the environment in which all Application Express application code is parsed/executed. There are scads of posts about this topic in this forum.
Scott -
Robohelp for Word won't compile
Hi,I've been trying to get one of my projects to work in Robohelp for Word. But the minute I create a second topic the compiled doen't work. there are no errors. the compilation just never starts. This also happens when I rename the first topic to something else.
I have the following configurations:
Robphelp for Word 7 build 145
MS Office Work 2007
windows XP professional with service pack 3
I have deleted and started the project from scratch several times without any success. Any help would be highly appreciated
Thanks
EdnaHi,
Thanks for your reply. The problem is there even with tutorial files and dummy projects.
It seems that there is a problem with saving the document. If I don’t add anything the projects will compile problery. But the minute I change something it won't compile. When I want to close the word document I get a meesage saying if I would like Robohelp to save the document. If I press on "yes" nothing happens. If I press on "yes to all" nothing happens. Pressing on "no" closes the document.
I have setup my word 2007 in a way so it will save .doc formats instead of .docx. But either way it makes no different the problem is with both file formats. -
I have a flash builder 3 project but I done something but it won't compile now. How can I resolve this. Tried clean project and no luck
what are the compile errors u r getting ?
-
Some jsps will not compile FC5+Tomcat
Hello,
I cannot compile SOME jsp pages for some reason.
I have something like this:
http://www.mydomain.net:8080/WEB/index.jsp - this comiles
http://www.mydomain.net:8080/WEB/BLAH/BLAH/index.jsp - will not compile where BLAH is a bunch of different folders.
I have it all working on Win XP. Now I am trying to make it work on FC5.
I took the page that can compile and moved it to BLAH/BLAH folder and it does not compile now!
OS: Fedora Core 5 (if it matters)
What is going on? Any ideas?
Thanks.sure, here it is
Thanks for help.
org.apache.jasper.JasperException: Unable to compile class for JSP
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:97)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:342)
org.apache.jasper.compiler.AntCompiler.generateClass(AntCompiler.java:248)
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:296)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
Compile failed; see the compiler error output for details.
org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:944)
org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:764)
org.apache.jasper.compiler.AntCompiler.generateClass(AntCompiler.java:216)
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:296)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802) -
Pre-compiled JSPs getting re-compiled by the server
For our project we are using wlappc to pre-compile JSPs and generate EJB classes. We are using the split directory format, so this is what the task looks like -
<target name="appCompile" depends="init" >
<delete dir="${ear.dist}" />
<mkdir dir="${ear.dist}" />
<wlpackage srcdir="${ear.src}" destdir="${ear.build}"
toDir="${ear.dist}" />
<wlappc source="${ear.dist}" verbose="true" classpath="${classpath}" />
</target>
After this, we are using wldeploy to deploy the application to another server.
This is how the task looks like -
<target name="beadeploy" depends="init" >
<wldeploy action="deploy"
source="${src.dir}/dist/myapp.ear"
name="myApplication" remote="true"
user="${deploy.username}" password="${deploy.password}"
verbose="true" adminurl="t3://${deploy.host}:${deploy.port}"
upload="true"
debug="true" targets="${deploy.target}"/>
</target>
The problem that I am facing is that, even after re-compiling the JSPs, they get compiled again by the server when accessed for the first time !
We using Weblogic 8.1.2.0. Can you please provide a soplution for this ?Hi,
The following steps help you troubleshoot why you may be having problems with JSPs recompiling:
1. When invoking jspc, your classpath must contain the same release, service-pack, and any temporary patches as the servers you wish to deploy on. Otherwise, the Server will read the JSPs as being compiled on a different version of the WebLogic, and will recompile them all.
2. You should invoke jspc from the root directory of your open-directory exploded) WebApp or specify -webapp) and use the -d option to deploy the generated classes to the WEB-INF/classes directory. You can then archive these JSP classes into a JAR if you wish from the WEB-INF/classes directory.
3. The JSPs should then be deployed either individually to the WEB-INF/classes/jsp_servlet directory or in a JAR file under the WEB-INF/lib directory.
4. One other thing that could cause JSPs to be recompiled is if the timestamp of the class is different from that of the source.
Also, if your ant classpath is different from whatever WLS-related classpath entries you use to run WLS, this may cause problems, too.
-- Prasanna
Prasanna Yalam -
[SOLVED] ruby-panelapplet2 won't compile (i686 & x86_64)
Hi!
I already wrote forum post in 64 bit section, but today I got to i686 machine and the error is the same, that damned package won't compile
Can anyone help getting this compiled? Any hints?
Errors are as follows:
Package 'glipper' has no Name: field
checking for GCC... yes
checking for rb_define_alloc_func() in ruby.h... yes
checking for rb_block_proc() in ruby.h... yes
checking for new allocation framework... yes
checking for attribute assignment... no
checking for libpanelapplet-2.0 version (>= 2.6.0)... yes
checking for G_PLATFORM_WIN32... no
creating rbpanelappletversion.h
creating Makefile
creating Makefile
/tmp/yaourt-tmp-user/aur-ruby-panelapplet2/ruby-panelapplet2/src/ruby-gnome2-all-0.19.1/glib/src/lib/pkg-config.rb:85:in `name': undefined method `[]' for nil:NilClass (NoMethodError)
from /tmp/yaourt-tmp-user/aur-ruby-panelapplet2/ruby-panelapplet2/src/ruby-gnome2-all-0.19.1/glib/src/lib/mkmf-gnome2.rb:165:in `create_pkg_config_file'
from /tmp/yaourt-tmp-user/aur-ruby-panelapplet2/ruby-panelapplet2/src/ruby-gnome2-all-0.19.1/panel-applet/extconf.rb:30:in `<main>'
extconf.rb: Leaving directory 'panel-applet'
That is driving me crazy, coz I can't get SSHMenu work properly and that is one of the tools I use all the time
If someone has that package in x86_64, please send that to me (edzis123[@]inbox.lv). Please remove all numbers and brackets from there
If the package is not available, alternate way is sending the files in the package, I suppose these should be like this (I took sample from i686):
/usr/lib/ruby/site_ruby/1.9.1/panelapplet2.rb
/usr/lib/ruby/site_ruby/1.9.1/x86_64-linux/panelapplet2_main.so
/usr/lib/ruby/site_ruby/1.9.1/x86_64-linux/panelapplet2.so
Thanx in advance.
Last edited by Kirurgs (2010-02-21 21:32:26)Hi!
After spending quite a lot of time on this, I found the error why I couldn't compile almost any of ruby packages including ruby-gnomepanel2.
To my big surprise, pacman -R glipper fixed the issue and I'm now using sshmenu w/o any issues.
Ruby seems to broke if some additional (possibly incorrect) packages are installed, which it shouldn't!! Uff...
regards
Kirurgs
Last edited by Kirurgs (2010-02-21 21:32:57)
Maybe you are looking for
-
How can i print logo in all the page
i've created a form(SAP script) which have five page.pls can anybody tell me how can i print logo in all the five page?
-
Allocation of production order to sales order
Hi Gurus Problem: Currently if there is a order that has line item with say a qty of 8 but the production order is to only fill a qty of 7, the allocation is directly given to another order leaving the one it should go to behind. The process keeps ha
-
As recently as yesterday, I have noticed that when I go to open a new tab in a firefox window, instead of opening a new one, the screen goes white. And then when I press "open new tab" again, a new one opens, but but instead of the first one staying
-
Previously; I have been using control center with no problems; i.e. I would run/execute mapping directly. I've attempted to install Workflow 2.6.4 With DB 10g R2 (10.2.0.1); Everything seemd to go ok; today I have tried to open control center and now
-
Hi- I'm trying to use a c:forEach tag and am having some problems. Basically, I want to use an iterator that I get from a helper class to loop over, but I don't want to use EL (this is not a possibility at the moment). Is there any way to do this? Ev