Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Accessing a EJB from a JSP

1 view
Skip to first unread message

Marek Kossak

unread,
Mar 17, 2003, 6:04:50 PM3/17/03
to

A scenario from some one new to web server, server application development.

I have downloaded and installed an evaluation copy of WebLogic 7.x and successfully
installed it (W2K version). The product starts up without error and I can connect
to is successfully. I have created a simple java bean (actually an EJB) and have
been able to deploy it successfully without any errors.

I have a simple JSP invoked from a simple HTML page that contains a simple form.
The JSP is attempting to instaniate the bean via the jsp:useBean tag however,
all I am able to get back is an error that tells me that my class "could not be
loaded". Here is the stack trace:

weblogic.servlet.jsp.JspException: (line 3): class 'USDataworks.MICRworks.MICRworksBean'
could not be loaded
at weblogic.servlet.jsp.JspLexer.jspException(JspLexer.java:710)
at weblogic.servlet.jsp.JspLexer.processBeanTag(JspLexer.java:1372)
at weblogic.servlet.jsp.JspLexer.mXML_OPEN_USEBEAN(JspLexer.java:3612)
at weblogic.servlet.jsp.JspLexer.mXML_THING(JspLexer.java:1924)
at weblogic.servlet.jsp.JspLexer.mTOKEN(JspLexer.java:1817)
at weblogic.servlet.jsp.JspLexer.nextToken(JspLexer.java:1745)
at weblogic.servlet.jsp.JspLexer.parse(JspLexer.java:959)
at weblogic.servlet.jsp.JspParser.doit(JspParser.java:90)
at weblogic.servlet.jsp.JspParser.parse(JspParser.java:213)
at weblogic.servlet.jsp.Jsp2Java.outputs(Jsp2Java.java:119)
at weblogic.utils.compiler.CodeGenerator.generate(CodeGenerator.java:258)
at weblogic.servlet.jsp.JspStub.compilePage(JspStub.java:353)
at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:211)
at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:164)
at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:517)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:351)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:306)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5445)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:780)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3105)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2588)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:213)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:189)

If I leave out the jsp:useBean tag I am able to return a simple HTML page based
on information sent to the server, so I know some of the environment is properly
set up.

I have browsed through some of the WebLogic site and have been referred to any
number of configuration files (*.properties) which do not appear to exist. I
am frustrated and confused and would appreciate any help in getting this to work.

Thank you.

Xiang Rao

unread,
Mar 17, 2003, 11:03:42 PM3/17/03
to

EJB and Java Bean are two different things. I don't think you can use useBean tag
for EJB. On the other hand, you can write a Java Bean to wrap your EJB and use
useBean tag.

Zdenek Zdrazil

unread,
Mar 19, 2003, 8:08:45 AM3/19/03
to

In the Weblogic 7.0.2 instalation, there is a tool for creating taglibrary to wrap
an ejb cals to jsp tags. The tool names simply ejb2jsp and is described in document
: "Programming Weblogic JSP" (pdf). My problem is: when I try to load my ejb ...jar
file, the tool throws this Null pointer exception: (below).
Have anybody some experience with this? It's the same for gui and cmd-line version.
Could you advice me?

Thank you.

D:\SRC\jbproject\TestEntity>java weblogic.servlet.ejb2jsp.gui.Main
error occurred: java.lang.NullPointerException
java.lang.NullPointerException
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:287)
at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
at weblogic.servlet.ejb2jsp.Utils.createBeanDescriptor(Utils.java:343)
at weblogic.servlet.ejb2jsp.Utils.createDefaultDescriptor(Utils.java:314
)
at weblogic.servlet.ejb2jsp.Utils.createDefaultDescriptor(Utils.java:266
)
at weblogic.servlet.ejb2jsp.gui.Main.loadFromPaths(Main.java:391)
at weblogic.servlet.ejb2jsp.gui.Main.doNew(Main.java:378)
at weblogic.servlet.ejb2jsp.gui.Main$5.run(Main.java:575)
at weblogic.servlet.ejb2jsp.gui.MainWorker.run(Main.java:757)
at java.lang.Thread.run(Thread.java:479)
error occurred: java.lang.NullPointerException
java.lang.NullPointerException
at weblogic.servlet.ejb2jsp.gui.Main.doNew(Main.java:379)
at weblogic.servlet.ejb2jsp.gui.Main$5.run(Main.java:575)
at weblogic.servlet.ejb2jsp.gui.MainWorker.run(Main.java:757)
at java.lang.Thread.run(Thread.java:479)

0 new messages