problem in weblogic(jsp calling bean)

Discussions

EJB design: problem in weblogic(jsp calling bean)

  1. problem in weblogic(jsp calling bean) (14 messages)

    hai,
       im trying to call a simple bean from jsp..i put my bean in clientclasses and set my classpath to that..but i get the following problem when i call the jsp page

    /hello.jsp(11): Could not create a bean of type: TestBean: java.lang.ClassNotFoundException: TestBean
    probably occurred due to an error in /hello.jsp line 11:
    <jsp:useBean id="test" class="TestBean" />

    pls anyone help me

    Threaded Messages (14)

  2. problem in weblogic(jsp calling bean)[ Go to top ]

    are your home and remote interfaces also there in the client classes ..........?
    p.s: It definately is a class path problem...nothing to lose sleep about
  3. problem in weblogic(jsp calling bean)[ Go to top ]

    hello sahil,
               i didnt use any ejb here..i just try to call a simple bean from a jsp code...my code is

    <jsp:useBean id="test" class="TestBean" />
    <% out.println(test.getMessage()); %>


    TestBean is nothing but a simple bean has a single method

    public class TestBean{

    TestBean(){}

    public String getMessage()

    {
     return "message";

    }

    }

    i put my bean in clientclasses ant set my classpath to that before start the server...but i get the above mentioned error..pls help me

    thx a lot
  4. problem in weblogic(jsp calling bean)[ Go to top ]

    Make sure that you have set the classpath of the server. In other words, make sure that your server's batch file is not changing the classpath that you set on the console.
  5. problem in weblogic(jsp calling bean)[ Go to top ]

    Have you done the import of the bean?

    <%@ page import="packages.BeanName"%>

    You should put a line like that on the top of the page.

    Maybe this will help you.
  6. problem in weblogic(jsp calling bean)[ Go to top ]

    Hi,

    U donn't need to import the beans..

    U put u'r bean in a package, say com.bean.test.TestBean
    and put the class file in the WEB-INF/classes/com/bean/test
    folder and in the jsp u mention the full path fo the bean class
    <jsp:useBean id="test" scope="session" class="com.bean.test.TestBean" />

    Hope this helps

    Saran
  7. problem in weblogic(jsp calling bean)[ Go to top ]

    hello friends,
               i tried all those things u said..but still i get the same problem..is it right to put the classfile under clientclasses?..pls direct me...


    dear mr.saran i dont find any web-inf directory under my weblogic directory(in weblogic5.1)....is there anyother way?

    thx a lot again
  8. problem in weblogic(jsp calling bean)[ Go to top ]

    Hi,

    Sorry.. i gave the path for weblogic6.0.

    For 5.1.. i guess u have to put the javabean class files
    weblogic/myserver/serverclasses.
    for examples if u'r beans r in package com.bean.test
    then put u'r bean class files in
    weblogic/myserver/serverclasses/com/bean/test/TestBean.

    jsp will be the same as i told before..

    I think u no need to put it in clientclasses

    Try it out and let me know..
     
    Saran
  9. problem in weblogic(jsp calling bean)[ Go to top ]

    hai saran,
             i tried that aslo but i donno what the problem is here..im unable to access the beans..still i get the following error

    Wed Feb 07 12:21:58 GMT 2001:<E> <ServletContext-General> Servlet failed with Exception
    weblogic.servlet.jsp.JspException: (line 11): Could not create a bean of type: TestBean: java.lang.ClassNotFoundException
    at java.lang.Throwable.<init>(Compiled Code)
    at java.lang.Exception.<init>(Compiled Code)
    at java.lang.RuntimeException.<init>(RuntimeException.java:50)
    at weblogic.servlet.jsp.JspException.<init>(JspException.java:9)
    at weblogic.servlet.jsp.JspLexer.jspException(JspLexer.java:574)
    at weblogic.servlet.jsp.JspLexer.processBeanTag(JspLexer.java:1115)
    at weblogic.servlet.jsp.JspLexer.mXML_OPEN_USEBEAN(Compiled Code)
    at weblogic.servlet.jsp.JspLexer.mXML_THING(JspLexer.java:1521)
    at weblogic.servlet.jsp.JspLexer.mTOKEN(JspLexer.java:1431)
    at weblogic.servlet.jsp.JspLexer.nextToken(Compiled Code)
    at weblogic.servlet.jsp.JspLexer.parse(Compiled Code)
    at weblogic.servlet.jsp.JspParser.doit(Compiled Code)
    at weblogic.servlet.jsp.JspParser.parse(JspParser.java:109)
    at weblogic.servlet.jsp.Jsp2Java.outputs(Jsp2Java.java:97)
    at weblogic.utils.compiler.CodeGenerator.generate(Compiled Code)
    at weblogic.servlet.jsp.JspStub.compilePage(Compiled Code)
    at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:174)
    at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:164)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:99)
    at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:742)
    at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:686)
    at weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContextManager.java:247)
    at weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:361)
    at weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:261)
    at weblogic.kernel.ExecuteThread.run(Compiled Code)


      if anyone knows the solution pls help me...
  10. problem in weblogic(jsp calling bean)[ Go to top ]

    Hi,

    The problem will be in u'r environment settings..
    serverclasses may not be included in the settings..
    If possible send u'r env settings in u'r system..
    Check u'r setEnv batch file in weblogic folder..
    And how did u declared u'r bean initialisation in the jsp..?
    If i get these inf i try to solve u'r prob...

    Saran
  11. problem in weblogic(jsp calling bean)[ Go to top ]

    hai saran,
     yes definetely there is a problem in classpath...i didnt modify anything in startweblogic.cmd or setEnv..i just use a batch file..i execute it before starting the server..i have given it here

    set path=%path%;e:\weblogic\bin\oci815_8;e:\weblogic\oci\bin\oci815_8;
    set classpath=%classpath%;e:\weblogic\lib\weblogic510sp8boot.jar;c:\jdk1.1.8\lib\classes.zip;e:\weblogic\classes\boot;e:\weblogic\eval\cloudscape\lib\cloudscape.jar;e:\weblogic\lib\weblogicaux.jar;e:\weblogic\classes;e:\weblogic;e:\weblogic\myserver\clientclasses;
    set Dweblogic.class.path=%Dweblogic.class.path%;e:\weblogic\lib\weblogic510sp8.jar;e:\weblogic\classes;e:\weblogic\licence;e:\weblogic\lib\weblogic\weblogicaux.jar;e:\weblogic\myserver\serverclasses weblogic.server


    i think i made a mistake here..pls tell me what is wrong in the above file..if everything is right then tell me am i have to modify anything in the startweblogic.cmd or setenv

    pls clear this

    thx a lot
  12. problem in weblogic(jsp calling bean)[ Go to top ]

    Hi,

    Try with including the serverclasses in u'r CLASSPATH environment variable though its there in weblogic classpath.

    U'r CLASSPATH should be as:

    CLASSPATH=
    %CLASSPATH%; e:\weblogic\lib\weblogic510sp8boot.jar;
    c:\jdk1.1.8\lib\classes.zip; e:\weblogic\classes\boot; e:\weblogic\eval\cloudscape\lib\cloudscape.jar; e:\weblogic\lib\weblogicaux.jar;e:\weblogic\classes; e:\weblogic;e:\weblogic\myserver\clientclasses;
    e:\weblogic\myserver\serverclasses

    I guess all other path settings r correct.

    Saran

  13. problem in weblogic(jsp calling bean)[ Go to top ]

    hai saran,
     im still getting the same probs
  14. problem in weblogic(jsp calling bean)[ Go to top ]

    Hi,
    Mmm.. Interesting..
    Make sure u declared the bean in jsp with full path.
    If u send me the codes i will try my level best..

    Saran
    saran_v@yahoo.com
  15. Hi guys,

    It's quite interesting to see your conversation. As per my knowledge whatever the path saran mentioned should work.

    ELSE

    Try this:

    inside jsp:

    <page import="xxx.yyy.BeanName">
    <jsp:useBean id="xxxxx" scope="yyy" class="BeanName">

    Location of JSP:

    Keep this JSP inside

    C:\weblogic\myserver\public_html (if u want create your own package and add in your property file)

    Location of Bean:

    C:\weblogic\src\xxx\yyy


    After doing this...

    Give the classpath of the bean in the post classpath of the startweblogic.cmd file:

    The classpath is:

    C:\weblogic\src\xxx.yyy

    after doing this start the server and call the JSP

    Hope this should work:

    if u have further problem give a msg
    regards
    Moorthi