Precompiling a JSP that uses a bean

Hi,
          I am facing a problem when I startup Weblogic with precompiling ON.
          I have a JSP that uses a bean. When the JSP is being compiled, Weblogic is
          actually trying to instantiate the bean and is executing code in the
          constructor of the bean !
          When I use the weblogic.jspc compiler to compile the JSP, no such thing
          happens.
          So this happens only when I precompile such a JSP when starting up Weblogic
          server.
          - Why does weblogic attempt to instantiat the bean ?
          - Is there any way to tell weblogic "dont instantiate this bean now" ?
          Also, the compiler is unable to find a class that is required by the bean. However, this class is there in the /applications/..../WEB-INF/lib in a JAR file. So why is the class not being found ?
          Thanks,
          Jay
          

Do a stack trace from the constructor to determine who is calling it, and
          maybe why ...
          Peace,
          Cameron Purdy
          Tangosol Inc.
          << Tangosol Server: How Weblogic applications are customized >>
          << Download now from http://www.tangosol.com/download.jsp >>
          "Jayakumar Nandakumar" <[email protected]> wrote in message
          news:3bb0f6d6$[email protected]..
          > Hi,
          > I am facing a problem when I startup Weblogic with precompiling ON.
          >
          > I have a JSP that uses a bean. When the JSP is being compiled, Weblogic is
          > actually trying to instantiate the bean and is executing code in the
          > constructor of the bean !
          >
          > When I use the weblogic.jspc compiler to compile the JSP, no such thing
          > happens.
          >
          > So this happens only when I precompile such a JSP when starting up
          Weblogic
          > server.
          >
          > - Why does weblogic attempt to instantiat the bean ?
          > - Is there any way to tell weblogic "dont instantiate this bean now" ?
          >
          > Also, the compiler is unable to find a class that is required by the bean.
          However, this class is there in the /applications/..../WEB-INF/lib in a JAR
          file. So why is the class not being found ?
          >
          > Thanks,
          > Jay
          

Similar Messages

  • Insert data into table from JSP page using Entity Beans(EJB 3.0)

    I want to insert data into a database table from JSP page using Entity Beans(EJB 3.0).
    1. I have a table 'FRIENDS', (in Oracle 10g database).
    2. It has two columns, 'NAME' and 'CITY'. Both have datatype strings(varchar2).
    3. Now from a JSP page, having two textfields, 'NAME' and 'CITY', I want to insert data into table 'FRIENDS'.
    4. In between JSP and database is a Entity Bean(EJB 3.0) and a stateless session bean.
    5. I am using JDev as editor.
    Please provide me code ASAP or link with similar example.
    Thank you.
    Anurag

    Hi,
    I am also trying that scenario. So u can
    Post the jsp form data to a Servlet which will act as a Controller.
    In the servlet invoke the business method.
    Similar kind of app is in www.roseindia.net
    Hope this would help u.
    Meanwhile if u get any optimal solution, pls post it.
    Thanks,
    Happy Java Coding.

  • JSP on BEA  Weblogic: random error when loading a jsp page that uses a Bean

    Hi!
    I wrote a simple jsp page that stores a String in a JavaBean, and then forwards to another jsp page to display that String. The jsp pages are deployed on a BEA Weblogic 6 Server, but I get a weird behaviour when loading the page into my browser. Usually I get an error message:
    /Response.jsp(9): class 'query.jsp.QueryBean' could not be loaded
    probably occurred due to an error in /Query.jsp line 9:
    <jsp:useBean id = "queryBean" scope = "request" class = "query.jsp.QueryBean" />
    But the funny thing is that after reloading the page a few times it eventually works. The bahaviour seems to be totally random - sometimes it works, sometimes it claims not finding the JavaBean class.
    Anyone experienced something similar?
    Thank you very much,
    Charlie

    Is QueryBean.class located under '<appname>/Web_inf/query/jsp/'?
    If it is please try changing the package name to something else like com.myclass or something like that.

  • " ')' expected " Error when compile jsp that use useBean tag

    I'm using JDeveloper 10.1.3 and I have a page with a next jsp tag
    <jsp:useBean id="objectid" type="package.MyClass" scope="application"/>
    When I compile this JSP page, I got the error:
    ')' expected
    If the application is deployed in the J2EE container like Tomcat or OC4J, the page works fine.
    Is this a JDeveloper bug?? What Can I do?

    The JSP page works fine in OC4J 10.1.2, but in the OC4J 10.1.3 it throws the same error.
    The soruce code that the container generates is this:
    if ((objectid= (package.MyClass) pageContext.getAttribute( "objectid", PageContext.APPLICATION_SCOPE)) == null) {
    throw new InstantiationException("No se ha encontrado el bean "objectid" en el ámbito "application"");
    The bug consist in the generation of the servlet source code. The double quotation is the problem, for that, the compiler generates the error ')' expected...

  • Need help with jsp that uses a java program

    Hi, sorry for my english but i am italian.
    I've got a problem: i use java builder and i have a java program(this program has got a main and includes libraries) about graphich on tree, this program visualizes these trees and makes operations on these.
    Now i must use JSP so that a client can see this program (this program is on the server) and can interact with it.
    I can't use applet.I must use only jsp.
    Who can tell me how can i start???
    Thanks.

    If you are not allowed to use an applet, then you are limited by what can be achieved with HTML in a browser.
    You would have to figure out how to render it with HTML, then program your jsp to write out this html programatically.

  • Problem using a bean in JSP on Tomcat 5.0.28

    Hi,
    I'm new to JSP, I've installed Tomcat 5.0.28 and I'm able to run JSP but when I try an asp wich uses a bean it gives me this error, the directory structure is
    testingProject with the first.jsp
    testingProject\WEB-INF\classes\myPackage with the test.class
    the first.asp
    <%@ page import="myPackage.Test" %>
    <html><head><title>Test</title></head>
    <body bgcolor=white>
    <jsp:useBean id="list" class="myPackage.Test"> </jsp:useBean>
    <jsp:getProperty name="list" property="value1" />
    <%=list.value1%>
    <p>
    </body></html>
    the Test.java
    package myPackage;
    public class Test{
    String value1="testinggggggggg";
    public void Test(){
    public String getValue1(){ return value1}
    the error
    thanks in advance
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 6 in the jsp file: /first.jsp
    Generated servlet error:
    C:\Program Files\Apache Group\Tomcat 5.0\work\Catalina\localhost\testingProject\org\apache\jsp\first_jsp.java:60: cannot resolve symbol
    symbol : variable value1
    location: class myPackage.Test
    out.print(list.value1);
    ^
    1 error
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
         org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)

    There are two ways of getting info from the bean.
    1) the jsp:getProperty tag, which seems correct in your code
    2) the <%= ... tag. In that case you must write a valid java expression. In your case: list.getValue1()

  • How to upload a file into server using j2ee jsp and servlet with bean?

    How to upload a file into server using j2ee jsp and servlet with bean? Please give me the reference or url about how to do that. If related to struts is more suitable.
    Anyone help me please!

    u don't need j2ee and struts to do file uploading. An example is as such
    in JSP. u use the <input> file tag like
    <input type="file"....>You need a bean to capture the file contents like
    class FileUploadObj {
        private FormFile srcFile;
        private byte[] fileContent;
        // all the getter and setter methods
    }Then in the servlet, you process the file for uploading
        * The following loads the uploaded binary data into a byte Array.
        FileUploadObj form = new FileUploadObj();
        byte[] byteArr = null;
        if (form.signFile != null) {
            int filesize = form.srcFile.getFileSize();
            byteArr = new byte[filesize];
            ByteArrayInputStream bytein = new ByteArrayInputStream (form.srcFile.getFileData());
            bytein.read(byteArr);
            bytein.close();
            form.setFileContent(byteArr);
        // Write file content using Writer class into the destination file in the server.
        ...

  • Using custom classes that are not beans

    Hi folks,
    Is it possible to use java classes that are not beans. I mean, on a page, could you say Customer cust = new Customer("Jones", 25);
    if you had a Customer class with a constructor that took a name and age (String and int).
    If so, how do you go about this- do you need to import the class, or put it in a standard location? I'm using Tomcat, and would guess that this would go in WEB-INF/classes?
    I hope it's not a stupid question, all the literature seems to be focused on JavaBeans
    Any advice on this would be great!

    Beans are used as putting Java code into a JSP is generally considered bad practice. The advantage of the bean pattern is that you use things like:
    <jsp:setProperty name="laBean" property="someSetter" value="someValue" />so that you aren't embedding Java directly into the JSP. I'm not very religious about this particular topic personally and will throw a line or two in here and there.
    Having said that though, you can easily use any Java class in a JSP. You'll have to import it first:
    <%@ page import="java.util.*" %>And then you can easily use it like in a real Java program.

  • Using java bean with jsp

    hello friends,
    i'm new to jsp. i want to create an html form that accepts username and a value from four radio buttons and display back the entered name and checked radio button's value using java bean.
    i use the <jsp:setProperty id="" property="*"> method. i don't know how to access the radio buttons value from the html.
    also when i use an additional field other than username the jsp page is showing error.
    Please give me the correct method to use java bean with jsp in this circumstance.
    thank you.

    thank you, but i have a problem left. the case is like this.
    i got the jsp and bean worked fine when i have a sinle input text field.
    but when i added a second text field i recieved the following error.
    javax.servlet.ServletException: basket.newbean.getUserPass()Ljava/lang/String;
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
         org.apache.jsp.newform.process_jsp._jspService(process_jsp.java:69)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    where userPass is the new form element. I have made the subsequent chanes in my bean program and jsp file.
    pls hlp.

  • Using web beans in JSP

    I would like to know how create a tree using Web Beans that Jdeveloper provides. Using the web object editor I could add two Beans which mapped to JSTree and JSTreeData(in oracle.jdeveloper.jsp.wb package), though I don't know the difference between them. I tried to include Both these beans in the JSP(which appear as tags) but I am unable to render the tree. Let's say I have a parent node (text: row1, url: url1, 3 childs) and 3 child nodes (text: row2..row4, url: url2..url4, each with no childs). How do I write it in the JSP to render it properly
    -Rajeev

    I would like to know how create a tree using Web Beans that Jdeveloper provides. Using the web object editor I could add two Beans which mapped to JSTree and JSTreeData(in oracle.jdeveloper.jsp.wb package), though I don't know the difference between them. I tried to include Both these beans in the JSP(which appear as tags) but I am unable to render the tree. Let's say I have a parent node (text: row1, url: url1, 3 childs) and 3 child nodes (text: row2..row4, url: url2..url4, each with no childs). How do I write it in the JSP to render it properly
    -Rajeev

  • Using BI Bean in JSP

    Hi,
    Can anyone please provider some pointers on using BIBeans in a JSP page. There are few options in my knowledge.
    1)Using BI-Beans API for writing our own JSP tags.
    2)In Jdev(10g) there seems to be some support for Graphs through ADF.
    3)JSP and UIX tags provided BI-Graph beans.
    thanks
    Rahul

    U may be used the code similar to following :
    Context context = new InitialContext.();
    Object obj = (Object)context.lookup("Your JNDI name");
    YourHome home = (YourHome)obj.portableRemoteObject.narrow(obj,
    YourHome.class);
    YourRemote remote = home.create();
    System.out.println("your Business methods : "+remote.businessMethod1());
    Put this code or whatever code used in ur console client in JSP and invoke the businessMethods using remote object.
    I worked with BEAWeblogic 5.1, I think similar case may be there with BEA Weblogic7 also.
    First, make a jar file with ome.Remote and Bean by using the deploymenttool, then compile with ejb compiler, the new Jar is the complete deployable file. Take this file and register in weblogic.properties file that is specify the path of the Jar file in the weblogic.properties file. and put the JSP in public-html directory and start the server. if the bean is deployed successfully, open JSP file in a browser then it will work.... if the bean is not deployed you won't get any result.
    I can say, just placing the initialContext part of code on the JSP and running the JSP. I think, this may helps u...
    Ramana

  • JSP using a bean to do output?

    One thing I haven't seen much mention of is the possibility of using a Java Bean to
    do some output for a JSP. I'm porting a page I wrote a while back that uses a
    JHTML page to call a servlet which is just a thin wrapper around a bean which
    actually writes the HTML output (the bean is actually a network client to a server
    that generates the HTML page). The natural line of attack seems to be to have a
    JSP call the bean which will write the output, but I haven't seen mention of that
    technique anywhere and wonder why I'm so strange in thinking of this. The bean
    method to do the output currently takes a PrintWriter as a parameter to output to,
    but that can be changed to something similar if desired.
    Can anyone give me a snippet of code that would best implement taking the output
    stream for a JSP page and passing it to a bean for output?
    Thanks
    Steve

    eh? It sounds like your bean is doing all the output? If that's the case, then why do you want to use a JSP? - use a servlet as you already are.
    If you have a bean declared in the page and you just want to pass it the page's output stream to output part of the pages content, then use this:
    <jsp:useBean id='myBean' class='com.mycompany.MyBeanClass'/>
    <%
      PrintWriter beanOut = new PrintWriter(out);
      myBean.writeContent(beanOut);
      beanOut.close()
    %>
      ...where writeContent is your method that takes a PriontWriter. out is a JspWriter, which extends Writer, so you need to create a PrintWriter from it. You may or may not need to close/flush the PrintWriter deppending upon your bean implementation.

  • Defining the path for the use of beans in a JSP

              Hello,
              I would like to use a bean in a JSP file, via the <jsp:usebean> directive.
              I didn't find any property (weblogic property) which could define the path
              to the directory of my beans classes.
              So :
              1) i have put the path of this directory in the weblogic classpath in the weblogic
              start script.
              2) i made the same with the java classpath.
              Both solutions don't work at all.
              Any suggestion would be appreciated.
              Thanks in advance.
              

              We use the \weblogic\myserver\serverclasses for beans..
              of course we pack beans into jar files, and these jar files are included into
              the wls classpath..
              "Sylvain R." <[email protected]> wrote:
              >
              >Hello,
              >I would like to use a bean in a JSP file, via the <jsp:usebean> directive.
              >I didn't find any property (weblogic property) which could define the
              >path
              > to the directory of my beans classes.
              >So :
              >1) i have put the path of this directory in the weblogic classpath in
              >the weblogic
              >start script.
              >2) i made the same with the java classpath.
              >
              >Both solutions don't work at all.
              >
              >Any suggestion would be appreciated.
              >Thanks in advance.
              >
              

  • Drop-down in JSP using a bean as back-end

    Hi everyone,
    I like to create a dynamic drop-down (reading from a database) using JSP but accessing a bean. My code on the bean is:
    public void DepartmentName() {
    try
    stmt1 = tConnection.createStatement();
    rs1 = stmt1.executeQuery ("select DEPT_NAME from DEPARTMENT");
    while ( rs1.next() )
    String DptName = rs1.getString("DEPT_NAME");
    System.out.println(DptName);
    Can anybody tell me how to call this DepartmentName bean in JSP? So far my JSP looks like this...
    <table width="100%"><tr>
    <form action="next.jsp" method="POST">
    <input type="hidden" name="type" value="listemp">
    <td width="100">
    <b>Department</b></td>
    <td wifth="100">
    <SELECT name=cust multiple size=4>
    <option>??????? HELP ???????????</option>
    </SELECT>
    </td>
    <td><input type="submit" value="Submit" name="dept">
    </td></tr></table>
    Many thanks.

    First you need to modify your bean to return some sort of data structure of String objects. How about a Vector? Then you could call Vector.elements() on the return statement of the DepartmentName() method, like this...
    public Enumeration DepartmentName()
      Vector myVector = new Vector(0);
      while(rs.next())
        myVector.add(rs.getString(1));
      return myVector.elements();
    }Then in your JSP you'll need to use the JSP useBean tag
    <jsp:useBean id="myBean" class="com.myco.myapp.MyBean" scope="page|request|session|application" />And before the option tag call the bean and get the enumeration of String objects, then loop through them like this:
    while(enum.hasMoreElements())
      out.println(((String) enum.nextElement()));
    }

  • Simple jsp example of using BI Bean in Myeclipse

    hi
    anyone can show me a simple jsp example of using BI Bean in Myeclipse
    or how to import BI Bean into Myeclipse
    I would so thankful for who can answer me.. please its urgent
    thanks

    Sorry, I was not very clear in my last message.
    I need all my webservices to share the same bean during one user session.
    Then, if a page calls 2 different web services, only 1 database connection is made instead of 2. And if the user opens other pages which call other webservices, they will use the connection kept into the session bean.
    Anyway, I tried to do like it is said in your website but I can not build my project. I have an error : java.lang.LinkageError: JAXB 2.0 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/C:/.../build/web/WEB-INF/lib/jaxb-impl.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.class) needs 2.1 API. Use the endorsed directory mechanism to place jaxb-api.jar in the bootstrap classloader. I do not understand because I have downloaded the jax-ws 2.1.1 api and no other libraries are imported in my project. :-(
    I wonder if it is not related to netbeans...

Maybe you are looking for

  • RENAME/COPY/DELETE a file using FTP Adapter in 11g using dynamic values

    Hi All We have a requirement to do the above for a client. I was able to find a post\blog that tells you to add the below properties in FTP adapter JCA file and it works but, <interaction-spec className="oracle.tip.adapter.ftp.outbound.FTPIoInteracti

  • OSB EJB business service performance

    A friend reported me that accessing a EJB via OSB EJB business service is twice as slow as accessing the EJB remotely in Java code. Unfortunately he didn't run any profiling tool to determine the Hot Methods and Heap consumption. The EJB receives a s

  • WFM_Op does not return when iterating indefinite​ly?

    I'm using the WFM_Op function with a DAQPad 6020E with the WFMsingleBufRegenerate.C that is provided with NI-DAQ. If I change the number of iterations to zero (i.e., indefinite iterations), it never proceeds to the next instruction. I'd ideally like

  • Updated to 10.1 now old project opens in TextEdit instead

    So I updated FCPX and libraries to 10.1. My problem is an old client just emailed me to do a new edit on a project that was using the last version of FCPX.  No problem right?  It's on a portable hard drive.  I plug it in expecting an Update prompt an

  • BEX Filter is not working

    Hi, I have a BEX query with filters on Special Procurement Key 10,20,Y7,ZV,XY and #. When we run this query, result is displayed for above keys along with Z7 which is not part of the filter. Any idea why Z7 is shown in the result even though it is no