JSP won't compile my bean

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)

Similar Messages

  • 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.

  • 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.

  • Cannot compile java beans in my jsp page

    Hi all
    I have created jsp pages which contains java beans. Now its working fine on my machine(XP OS) but when i put it on windows 2000 server it gives the following error:
    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] Since fork is true, ignoring compiler setting.
    [javac] Compiling 1 source file
    [javac] Since fork is true, ignoring compiler setting.
         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.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:2415)
         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:223)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
         at java.lang.Thread.run(Unknown Source)
    please help

    Ok, jsp pages to not contain java beans, java beans are separate classes which you access from a jsp.
    Is this what you have done, i.e. created classes under classes/yourPackage ?
    If so, you do not need to recompile the class when you move it, you can move the pre-compiled class file.
    In terms of your error, I have no idea, but it looks interesting!!
    The most likely cause is a difference in the JDK versions you are running on the different machines. If the JDK on windows 2000 is older, you may need to upgrade it.

  • 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
    Thom

    Thanks 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.

  • Msg.addRecipient(Message.RecipientType.TO,to) - won't compile in program

    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 PM

    I 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);
    }

  • Jsp:include directives compilation errors

    hi,
    we have lot of <%@ include file="" %> files in out jsp page. when we trying to change this to <jsp:include page="" %>. we r getting lot of comilation errors
    The file size is increasing more than 64mb.
    Can u tell how to contain them within 64mb .
    thank you.

    The stack trace isn't very indicative of whatever problem you may be having.
    However, there is a major difference between <%@ include %> and <jsp:include />. The include directive <%@ include %> slams the content of the included resource into your JSP at compilation time, it is "static". No individual evaluation of the included resource is done, it becomes a part of the JSP that included it.
    <jsp:include /> is a dynamic include--it is evaluated at run-time. The content of the included resource is accessed and written to the output stream with the JSP is accessed. If the included content is a JSP, it is compiled and accessed as a separate servlet.
    So, it looks like your included JSPs do not qualify as valid, standalone JSPs. Typically, this is because of some dependency on variables or beans declared in the including JSP.
    Good luck.
    -brian

  • Code won't compile - array

    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)

  • Migrate Application Jdeveloper 11.1.1.0.2 to 11.1.2.2.0 - won´t compile

    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.3

    The 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,
    Paul

    Paul - 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
    Edna

    Hi,
    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.

  • Flash builder 3 won't compile

    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)

Maybe you are looking for

  • Printing Dark Background Converted PPT

    Hello, I have got a Power Point presentation in PDF format send by my professor, i have to print it out but it has got dark bakground and will use a lot of ink so to resolve i search out the method to change background and reached to the option of Ac

  • Connecting TracFone with Macbook Pro

    I have a new TracFone (LG420G) with Bluetooth. I have (I think) successfully "paired" the phone with my Mackbook Pro--the devices are described as paired on both the phone & the computer. But I cannot get them to connect. In System Preferences the Bl

  • Stock report by WBS element

    Dear All, is there any report existing in SAP through which we can see stock existing under wbs element for PS, for project stock. regards, qsm sap

  • Export crystal report to html in java

    Hello Friends, Could you please tell how how can i export my crytsal reports to html in java. Thanks & Regards, Aru

  • What's in Service Upadte #2???

    all, It looks like there is a new service pack for CQ 5.5 in the package share.  Does any know (or point me to the documentation) as to what's included in the service packs - both from a bug fix and enhancement perspective? Thanks