Re: Accessing EJB through JSP
Can anyone guide me to a tuorial thru which I can learn how to invoke EJBs thru
JSP pages.
Thanks..Kevin
EJB to JSP Integration
http://edocs.bea.com/wls/docs61/jsp/ejb2jsp.html
Kevin wrote:
> Can anyone guide me to a tuorial thru which I can learn how to invoke EJBs thru
> JSP pages.
>
> Thanks..Kevin
Similar Messages
-
Pls. help me out..Accessing ejb through jsp
hi all,
I am running my ejb on the j2sdkee.1.2.1 and jdk1.3 on Windows 2000. I am facing a problem while accessing the ejb from the jsp page. Its running fine when accessing through a client application. The following is the error when I try to access it using:
http://localhost:8000/first/FirstEJB.jsp
Error: 500
Internal Servlet Error:
org.apache.jasper.JasperException: Unable to compile class for JSP
at org.apache.jasper.runtime.JspLoader.loadJSP(JspLoader.java:287)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:137)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:148)
at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:247)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:352)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
at org.apache.tomcat.core.ServiceInvocationHandler.method(ServletWrapper.java:626)
at org.apache.tomcat.core.ServletWrapper.handleInvocation(ServletWrapper.java:534)
at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:378)
at org.apache.tomcat.core.Context.handleRequest(Context.java:644)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:440)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:144)
at org.apache.tomcat.service.TcpConnectionThread.run(TcpEndpoint.java:310)
at java.lang.Thread.run(Thread.java:484)
Root cause:
java.lang.NullPointerException
at java.io.File.(File.java:181)
at org.apache.jasper.compiler.JspCompiler.computeClassFileData(JspCompiler.java:285)
at org.apache.jasper.compiler.JspCompiler.getClassName(JspCompiler.java:103)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:105)
at org.apache.jasper.runtime.JspLoader$2.run(JspLoader.java:273)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.jasper.runtime.JspLoader.loadJSP(JspLoader.java:270)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:137)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:148)
at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:247)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:352)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
at org.apache.tomcat.core.ServiceInvocationHandler.method(ServletWrapper.java:626)
at org.apache.tomcat.core.ServletWrapper.handleInvocation(ServletWrapper.java:534)
at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:378)
at org.apache.tomcat.core.Context.handleRequest(Context.java:644)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:440)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:144)
at org.apache.tomcat.service.TcpConnectionThread.run(TcpEndpoint.java:310)
at java.lang.Thread.run(Thread.java:484)
The name of the jsp file is FirstEJB.jsp
The name of the ear file is FirstEJB - Stateless Session Bean
The name of the WAR File is FirstWAR
I have created a Web Component named first
Can anyone tell me how to access the ejb using jsp?
Thanks,
ajitHello all,
Sorry for the trouble. I got the mistake..I had not given the context in the deploytool..
Thanks,
ajit -
How can I access EJB through executable jar file?
Hello buddies!!
I wonder if anyone could give me an explanation of how accessing EJB through executable jar file?Thanks!!Hi there,
You'll need to install the J2EE SDK on the client and include the <j2ee install dir>\lib\j2ee.jar file in your CLASSPATH along with the Client Jar file that was generated by the deploytool when you deployed the application.
In your client code the Context properties are as follows:
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
p.put(Context.PROVIDER_URL, "iiop://hostname:portnumber");
Context cntx = new InitialContext(p).Hope this helps
Amanda
Developer Technical Support
Sun Microsystems
http://www.sun.com/developers -
Column Not found error while trying to access databse through JSP+Java Bean
I am trying to acees MS Access 2003 db through JSP using Tomcat 5.0.28.The code for accessing the databse is incorporated in the bean.The jsp only calls the particular method of the bean .
Code for Java Bean:
package ActiveViewer;
import java.sql.*;
import java.util.*;
public class CompanyBean
Connection con;
ResultSet rs=null;
Statement st;
public CompanyBean(){}
public void connect()
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
System.out.println("Here4");
con=DriverManager.getConnection("jdbc:odbc:activeviewer","","");
System.out.println("Here1");
catch (ClassNotFoundException e)
System.out.println("Could not locate driver.");
catch (SQLException e)
System.out.println("An SQL Exception has occured :: "+e);
e.printStackTrace();
catch (Exception e)
System.out.println("An unknown Exception has occured :: "+e);
e.printStackTrace();
public void disconnect()
try
if (con!=null)
con.close();
catch (SQLException e)
System.out.println("An SQL Exception has occured :: "+e);
e.printStackTrace();
public ResultSet select(String username)
if(con!=null)
try
st=con.createStatement();
rs=st.executeQuery("select * from company where username='" + username + "'");
catch (SQLException e)
System.out.println("An SQL Exception has occured :: "+e);
e.printStackTrace();
catch (Exception e)
System.out.println("An Exception has occured while retrieving :: "+e);
e.printStackTrace();
else
System.out.println("Connection to database was lost.");
return rs;
The code for JSP that uses the above bean is:
<%@ page language="java" import="java.sql.*,ActiveViewer.* " contentType="text/html"%>
<jsp:useBean id="conn" scope="session" class="ActiveViewer.CompanyBean" />
<html>
<body>
<% String username=request.getParameter("username");
String password=request.getParameter("password");
System.out.println("username:"+username);
System.out.println("password:"+password);
conn.connect();
ResultSet rs=conn.select(username);
System.out.println("Below select ");
while (rs.next())
String dbusername=rs.getString("username");
String dbpassword=rs.getString("password");
if(dbusername.equals(username) && dbpassword.equals (password))
{ %> out.println("OK");
<% }
else { %>Invalid Username and / or Password.
<br>Clickhere to go back to Login Page.
<% }
} %>
</body>
</html>
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
javax.servlet.ServletException: Column not found
though the database is not int he same folder as the jsp, the DSN is set correctly to pint to the db location.The jsp does print in stdout file:
Here4 (from connect method above)
Here 1 (from connect method above)
Below Select (from jsp)
This means that the jsp does connect to db but it gives the above error.Also the field name also matches that in the database and data is present in the db too.
All other things like creating package for bean,incorporating the packakage are done.
Can someone please help me with their precious advice?U're getting this error because there is no field called 'password' in ur database, the field in ur database is named 'cpassword' and not 'password'. So change the statement rs.getString("password"); to rs.getString("cpassword");
-
Column Not found error while trying to access database through JSP+Java Bea
I am trying to access MS Access 2003 db through JSP using Tomcat 5.0.28.The code for accessing the database is incorporated in the bean.The JSP only calls the particular method of the bean .
Code for Java Bean:
package ActiveViewer;
import java.sql.*;
import java.util.*;
public class CompanyBean
Connection con;
ResultSet rs=null;
Statement st;
public CompanyBean(){}
public void connect()
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
System.out.println("Here4");
con=DriverManager.getConnection("jdbc:odbc:activeviewer","","");
System.out.println("Here1");
catch (ClassNotFoundException e)
System.out.println("Could not locate driver.");
catch (SQLException e)
System.out.println("An SQL Exception has occured :: "+e);
e.printStackTrace();
catch (Exception e)
System.out.println("An unknown Exception has occured :: "+e);
e.printStackTrace();
public void disconnect()
try
if (con!=null)
con.close();
catch (SQLException e)
System.out.println("An SQL Exception has occured :: "+e);
e.printStackTrace();
public ResultSet select(String username)
if(con!=null)
try
st=con.createStatement();
rs=st.executeQuery("select * from company where username='" + username + "'");
catch (SQLException e)
System.out.println("An SQL Exception has occured :: "+e);
e.printStackTrace();
catch (Exception e)
System.out.println("An Exception has occured while retrieving :: "+e);
e.printStackTrace();
else
System.out.println("Connection to database was lost.");
return rs;
The code for JSP that uses the above bean is:
<%@ page language="java" import="java.sql.*,ActiveViewer.* " contentType="text/html"%>
<jsp:useBean id="conn" scope="session" class="ActiveViewer.CompanyBean" />
<html>
<body>
<% String username=request.getParameter("username");
String password=request.getParameter("password");
System.out.println("username:"+username);
System.out.println("password:"+password);
conn.connect();
ResultSet rs=conn.select(username);
System.out.println("Below select ");
while (rs.next())
String dbusername=rs.getString("username");
String dbpassword=rs.getString("password");
if(dbusername.equals(username) && dbpassword.equals (password))
{ %> out.println("OK");
<% }
else { %>Invalid Username and / or Password.
<br>Clickhere to go back to Login Page.
<% }
} %>
</body>
</html>
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
javax.servlet.ServletException: Column not found
though the database is not int he same folder as the jsp, the DSN is set correctly to pint to the db location.The jsp does print in stdout file:
Here4 (from connect method above)
Here 1 (from connect method above)
Below Select (from jsp)
This means that the jsp does connect to db but it gives the above error.Also the field name also matches that in the database and data is present in the db too.
All other things like creating package for bean in WEB-INF/classes,incorporating the packakage are done.
Can someone please help me with their precious advice?Hi, I too have a problem with an SQL exception, the message is Column not found.
I'm using the sun jdbc odbc driver with access.
the first few lines of the stack trace are
sun.jdbc.odbc.JdbcOdbcResultSet.findColumn(JdbcOdbcResultSet.java:1852)
sun.jdbc.odbc.JdbcOdbcResultSet.getInt(JdbcOdbcResultSet.java:603)
net.homeip.sdaniels.MemberBean.ejbFindByUnamePwd(MemberBean.java:127)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
I am of course sure that the column does infact exist. I can insert into the column no problems. the sql looks like this:
SELECT * FROM Members WHERE uName ='Stewart' AND encPwd='�F2C�3����h�1Y�'
Can any one tell me if there is a common cause to this problem?
Thanks -
How to access dataprovider through jsp syntax
I am creating an image gallery but here's my issue...
I have a database table that contains links to images on my file system. I created a dataprovider for this database table on my page so the dataprovider now returns all the image links.
Now what I need to do is create a row of thumbnails so I add a scriptlet in my jsp code where I want the thumbnail to appear. This scriptlet loops through the dataprovider and for each row it will create a standard html image tag populating the src attribute with the link from the dataprovider.
I figure creating dynamic html img tags is much easier than creating dynamic image components in the backing bean. Doing the former allows me to output the row of thumbnails exactly where I want them on the page (ie where i put my scriptlet code) and is easier to manage.
The problem is i don't know how to access the dataprovider through jsp tags and syntax. I'm sure there must be a way, can anyone help?
Thanks.I've done this sometimes using scriplets:
<%
request.setAttribute("SOME_CONST", Constants.SOME_CONST);
%>
<c:out value="${SOME_CONST}" />But I would also be interested if anyone knows a way without those ugly scriplet..
O -
Accessing EJBs through LCES2 SDK Service Forms
Hello,
I try to use this sample (here) to create a Forms Service access from a servlet but I find "ALC-DSC-031-000: com.adobe.idp.dsc.net.DSCNamingException: Failed to search remote EJBObject for the supplier dejb / call.
I did a default installation of LiveCycle ES2 (JBoss, MySQL).
I use Glassfish 3 to create the site using the service Forms through a servlet.
I observed that execption is thrown when using the service renderPDFForm by formsClient.
I wonder if the problem is with the port 1099 for DSC_DEFAULT_EJB_ENDPOINT.
But I do not know whether this port works and if the problem actually comes from.
Can you help me ?I slightly modified the code :
String fileName = "rideau1.jpg";
File oneImg = new File("C:\\" + fileName);
FileInputStream fileAttachment = new FileInputStream(oneImg);Document attachment1 = new Document(fileAttachment);
Map<String, Document> fileAttachments = new HashMap<String, Document>();
fileAttachments.put(fileName, attachment1);
I'm sure image exists, file exists but attachement1 is empty...
oneImg getPath : C:\rideau1.jpg
fileAttachments : {rideau1.jpg=}
fileAttachment available : 15872
But normally I'm able to null in function renderPDFForm as fileAttachements...
The problem can be put there by URLSpec ? -
How can I call remote ejb through jsp?(null)
Trying the code:
<%@ page import="si3.*,javax.ejb.*,javax.naming.*,java.util.*,java.rmi.RemoteException" %>
<%
int h=8;
int w=8;
Hashtable p = new Hashtable ();
p.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
p.put(Context.PROVIDER_URL,"t3://192.168.0.203:7001");
Context ctx= new InitialContext(p);
Object homeref = ctx.lookup("si3.test");
addHome home = (addHome) PortableRemoteObject.narrow(homeref, addHome.class);
add the_ejb = home.create();
out.println(the_ejb.add(h,w));
out.println("adf");
the_ejb.remove();
%>
yzj wrote:
> I have two server running weblogic5.1.
> If the jsp and ejb locate the same server running weblogic 5.1 ,works well .But one deploys the ejb (jndi name si3.test),the other runs the jsp.I use jsp call the remote ejb ,catch exception :
>
> GMT+08:00 2000:<E> <ServletContext-General> Root
> > cause of ServletException
> > javax.naming.NameNotFoundException: 'si3.test'; remaining name 'si3.test'
> > at
> > weblogic.jndi.toolkit.BasicWLContext.resolveName(BasicWLContext.java,
> > Compiled Code)
> > at
> > weblogic.jndi.toolkit.BasicWLContext.lookup(BasicWLContext.java:133)
> > at
> > weblogic.jndi.toolkit.BasicWLContext.lookup(BasicWLContext.java:574)
> > at javax.naming.InitialContext.lookup(InitialContext.java:349)
> > at jsp_servlet.client._jspService(client.java:90)
> > at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
> > at
> > weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
> > :124)
> > at
> > weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
> > l.java:744)
> > at
> > weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
> > l.java:692)
> > at
> > weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
> > Manager.java:
> > 251)
> > at
> > weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:363)
> > at
> > weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:263)
> > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
> > Code)
>
> Why? Can you help me? Thanks.
> The jsp's source(Client.jsp ):
> <%@ page import="si3.*,javax.ejb.*,javax.naming.*,java.util.*,java.rmi.RemoteException" %>
> <%
> int h=8;
> int w=8;
> Hashtable p = new Hashtable ();
> p.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
> p.put(Context.PROVIDER_URL,"t3://192.168.0.203:7001");
> Context ctx= new InitialContext(p);
> addHome home = (addHome) ctx.lookup("si3.test");
> add the_ejb = home.create();
> out.println(the_ejb.add(h,w));
> out.println("adf");
> the_ejb.remove();
> %>
>
>
[att1.html]
-
Accessing pdfs through jsp content tags from content server!!!!!
hi,
i have uploaded few images in content server which i can access by dis syntax
<ad:adTarget query="adAltText='intraday'" height="200" width="200"/>
or
<ad:adTarget query="image_name=='first'"/>
but for accessing pdfs..
<ad:adTarget query="title=='InsuranceDataSheet'"/><br>
dis syntax doesnt work..it only provides me a link on the jsp page on click of which i can go to that pdf..
what should i change?
kindly help..By default, only image and text content have configured renderers for <ad:adTarget>, <ad:render>, and <ph:placeholder>; for all others, it does just print a link, as you're seeing. However, you can write and configure additional content renderer classes for other mime types (e.g. appliation/pdf). See http://download.oracle.com/docs/cd/E15919_01/wlp.1032/e14238/placeholders.htm#i1006120 for details.
Greg -
HOW can I call EJB with JSP?
Hi, I'm working with JSP and want to include some EJB. I dont know how can I access EJB through JSP. I dont know if I use the right code in JSP for calling EJB. Did someone know how to use that? Can someone tell me if is the right code in JSP in my example?
Thanks, Kristjan
THIS IS THE JSP: (useejb.jsp)
<%@ taglib uri="http://xmlns.oracle.com/j2ee/jsp/tld/ojsp/ejbtaglib.tld" prefix="EJB" %>
<%@ page import="mypackage1.MySessionEJB" %>
<%@ page import="mypackage1.MySessionEJBHome" %>
<%@ page import="mypackage1.impl.MySessionEJBBean" %>
<HTML>
<head><TITLE>USEBEAN</TITLE></head>
<body>
<EJB:useHome id="mySessionEJBHome" type="mypackage1.MySessionEJBHome" location="java:comp/env/ejb/mySessionEJB" local="false" />
<EJB:useBean id="mySessionEJBBean" type="mypackage1.impl.MySessionEJBBean" local="false">
<EJB:createBean instance="<%=mySessionEJBHome.create() %>" />
</EJB:useBean>
<%= mySessionEJBBean.calc() %>
</body>
</html>
THIS IS THE EJB CODE:(MySessionEJBBean.java)
package mypackage1.impl;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import java.lang.String.*;
public class MySessionEJBBean implements SessionBean
public void ejbCreate(){}
public void ejbActivate(){}
public void ejbPassivate(){}
public void ejbRemove(){}
public void setSessionContext(SessionContext ctx){}
public String calc(String value)
return value + value;
public String zanka(String x)
return x;
(MySessionEJB.java)
package mypackage1;
import javax.ejb.EJBObject;
import java.rmi.RemoteException;
public interface MySessionEJB extends EJBObject
public String calc(String value) throws RemoteException;
String zanka(String x) throws RemoteException;
(MySessionEJBHome.java)
package mypackage1;
import javax.ejb.EJBHome;
import java.rmi.RemoteException;
import javax.ejb.CreateException;
public interface MySessionEJBHome extends EJBHome
public MySessionEJB create() throws RemoteException, CreateException;
}You might want to look at using a Java Bean wrapper, this can be done automically using WebSphere. It creates what is called an access bean which the JSP imports.
HTH,
J.Clancey -
Caonnecting ms access database through tomcat5.5 query
Hi,
I have installed tomcat5.5 and jdk1.6 on my machine which has Windows server2003 as OS.
I'm not able to clearly underdstand the steps in tomcat docs for connecting to database and the changes to be made in different files.
Can someone tell me detailed and clear steps for connecting to an ms access database through jsp?
Thanks in advance for your suggestions.I'm not exactly sure why you have this problem. I know that the Microsoft SQL Server driver has a parameter "readOnly=false". Check your DB2 docs to see if you need to set a flag like that, too.
Maybe it has to do with transactions and auto commit. See if DB2 assumes autoCommit true or false. Maybe you have to explicitly commit your INSERT.
Maybe you're writing to one database and opening another. Make sure that's correct.
There are other suggestions that I'll offer.
You do all that work with a database in a constructor? Bad idea.
You've got database and UI stuff all mingled together. Ever heard of MVC separation?
Be object-oriented - start by designing an object to encapsulate all those items you're trying to INSERT.
Then write a Data Access Object (DAO) that does CRUD operations for that object. Test these thoroughly, preferrably with JUnit, until they're 100% perfect.
Then have a separate UI that instantiates these objects and calls their methods. The persistence layer shouldn't know about UI stuff, and the UI shouldn't need to have any persistence code in it.
% -
Security exception while trying to access EJB from stand alone client
Hi!, I am trying a sample EJB application to R&D some security related issues. I want to access EJB through a web application as well as a stand-alone client. I have set approriate <method-permission> in EJB deployment descriptor. I am using users.properties/roles.properties file for authentication mechanism. I am using JBoss 3.2.
- On the web application side I am using BASIC authentication and the servlet is able to access the EJB OK, as long as I am using a login/password that has access to the EJB.
- Now I am trying to access the EJB using a stand alone Java class. These are the things I have tried till now:
=>Created a InitialContext with appropriate principal, credentials and tried getting a reference to EJB home interface. That resulted in security exception.
=>Logged into a LoginContext by using appropriate JBossSX classes and then tried getting a EJB home interface. Again security exception.
Now I am not sure what to do. I read at some places about client side container but not sure what that is. Does anyone has any ideas to try? Is there any other way I can make a swing application and a web application authenticate to EJB container?
Also can anyone point me to any documentation that gives some idea about how the security credentials gets propagated from web application/standalone client to EJB container?It would be better if you can post your code...and DD that way we can help you better
-
EJBs From JSPs - Tutorials?
Hi all,
I've just been given a task, and I don't know where to start. I've been given an EJB and I need to write a web front end to test it (JSP). Now if it was a plain JavaBean, I know how to do it. But I know EJB's are different.
Could somebody point me in the direction of a good tutorial about accessing EJBs from JSPs. I'm using WebLogic as my application server, so something relevant to that would be nice.
Cheers for any help.To put it in "idiot" terms:
Think of your EJBs as people you want to ring up on the phone. You know their name, but not their number. How do you do this in real life? You use a phone book, using the person's name as a reference, which will lead you to the right number to dial.
The phonebook in this paradigm is JNDI - the naming and directory interfaces.
The name you use to look up is how the EJB is bound (ie, "java:comp/env/ejb/MyPerson", or "foo/bar/beans/MyPerson"). You define this name (the phone number) in the deployment descriptors packaged with the EJBs in the jar file.
You access the phone book (in your JSP or some other bean in your webapp) by using a Context.
ie:
Object objRef = initialContext.lookup("foo/bar/beans/MyPerson");
Then you ask the context for the person's home information:
MyPersonHome home = (com.foo.interfaces.MyPersonHome)PortableRemoteObject.narrow(objRef, com.foo.interfaces.MyPersonHome.class);
Once you know where they live (you have their Home information), you can ring them up (create them, search for them, search for a singular one)
MyPerson bill = home.findByPersonNameInHouse("billy");
once you have Billy in your possession, yu can perform business logic on him:
String stats = bill.getStatistics();
// get rid of bill permanently
bill.remove();
That should be enough of an introductory paradigm. You will need to follow along the tutorials and other many documents to understand exactly how things are bound (phone numbers are listed) and so forth.
Good luck! -
Problem while access database by JSTL through JSP.
I am trying to connect database by using JSTL through jsp.I am getting an exception.Please advise.
Error:
org.apache.jasper.JasperException: XML parsing error on file /WEB-INF/jsp/c.tld: (line 2, col 8): Document is invalid: no grammar found.
at org.apache.jasper.xmlparser.ParserUtils.parseXMLDocument(ParserUtils.java:140)
at org.apache.jasper.compiler.TagLibraryInfoImpl.parseTLD(TagLibraryInfoImpl.java:200)
at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:140)
at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:309)
at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:336)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:750)
at org.apache.jasper.compiler.Parser.parse(Parser.java:77)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:157)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:111)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:183)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:427)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:142)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:240)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:187)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:445)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)
JSP:
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<sql:setDataSource scope="application"
driver="sun.jdbc.odbc.JdbcOdbcDriver"
url="jdbc:oracle:thin:@3.173.130.12:1521:cup"
user="sUerName"
password="sPassword"
/>
<sql:query var="Result">
select * from imtinv.imi_error_message
</sql:query>
<html>
<head>
<title>
Error Message Details
</title>
</head>
<body bgcolor="white">
This is the information stored in the Error Message Table in Depot Automation Systems
<table>
<c:forEach items="$(Result.rows)" var="row">
<c:forEach items="$(rows)" var="column">
<tr>
<td align=right>
<b><c:out value="$(column.key)" />:</b>
</td>
<td>
<c:out value="$(column.value)" />:</b>
</td>
</tr>
</c:forEach>
</c:forEach>
</table>
</body>
</html>
Web.xml:
<taglib>
<taglib-uri>
http://java.sun.com/jstl/xml
</taglib-uri>
<taglib-location>
/WEB-INF/jsp/x.tld
</taglib-location>
</taglib>
<taglib>
<taglib-uri>
http://java.sun.com/jstl/fmt
</taglib-uri>
<taglib-location>
/WEB-INF/jsp/fmt.tld
</taglib-location>
</taglib>
<taglib>
<taglib-uri>
http://java.sun.com/jstl/sql
</taglib-uri>
<taglib-location>
/WEB-INF/jsp/sql.tld
</taglib-location>
</taglib>
c.tld:
<?xml version="1.0" encoding="UTF-8" ?>
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd"
version="2.0">
<description>JSTL 1.1 core library</description>
<display-name>JSTL core</display-name>
<tlib-version>1.1</tlib-version>
<short-name>c</short-name>
<uri>http://java.sun.com/jsp/jstl/core</uri>
<validator>
<description>
Provides core validation features for JSTL tags.
</description>
<validator-class>
org.apache.taglibs.standard.tlv.JstlCoreTLV
</validator-class>
</validator>
<tag>
<description>
Catches any Throwable that occurs in its body and optionally
exposes it.
</description>
<name>catch</name>
<tag-class>org.apache.taglibs.standard.tag.common.core.CatchTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
Name of the exported scoped variable for the
exception thrown from a nested action. The type of the
scoped variable is the type of the exception thrown.
</description>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Simple conditional tag that establishes a context for
mutually exclusive conditional operations, marked by
<when> and <otherwise>
</description>
<name>choose</name>
<tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class>
<body-content>JSP</body-content>
</tag>
<tag>
<description>
Simple conditional tag, which evalutes its body if the
supplied condition is true and optionally exposes a Boolean
scripting variable representing the evaluation of this condition
</description>
<name>if</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.IfTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
The test condition that determines whether or
not the body content should be processed.
</description>
<name>test</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>boolean</type>
</attribute>
<attribute>
<description>
Name of the exported scoped variable for the
resulting value of the test condition. The type
of the scoped variable is Boolean.
</description>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Scope for var.
</description>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Retrieves an absolute or relative URL and exposes its contents
to either the page, a String in 'var', or a Reader in 'varReader'.
</description>
<name>import</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.ImportTag</tag-class>
<tei-class>org.apache.taglibs.standard.tei.ImportTEI</tei-class>
<body-content>JSP</body-content>
<attribute>
<description>
The URL of the resource to import.
</description>
<name>url</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Name of the exported scoped variable for the
resource's content. The type of the scoped
variable is String.
</description>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Scope for var.
</description>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Name of the exported scoped variable for the
resource's content. The type of the scoped
variable is Reader.
</description>
<name>varReader</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Name of the context when accessing a relative
URL resource that belongs to a foreign
context.
</description>
<name>context</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Character encoding of the content at the input
resource.
</description>
<name>charEncoding</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
The basic iteration tag, accepting many different
collection types and supporting subsetting and other
functionality
</description>
<name>forEach</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.ForEachTag</tag-class>
<tei-class>org.apache.taglibs.standard.tei.ForEachTEI</tei-class>
<body-content>JSP</body-content>
<attribute>
<description>
Collection of items to iterate over.
</description>
<name>items</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.Object</type>
</attribute>
<attribute>
<description>
If items specified:
Iteration begins at the item located at the
specified index. First item of the collection has
index 0.
If items not specified:
Iteration begins with index set at the value
specified.
</description>
<name>begin</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>int</type>
</attribute>
<attribute>
<description>
If items specified:
Iteration ends at the item located at the
specified index (inclusive).
If items not specified:
Iteration ends when index reaches the value
specified.
</description>
<name>end</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>int</type>
</attribute>
<attribute>
<description>
Iteration will only process every step items of
the collection, starting with the first one.
</description>
<name>step</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>int</type>
</attribute>
<attribute>
<description>
Name of the exported scoped variable for the
current item of the iteration. This scoped
variable has nested visibility. Its type depends
on the object of the underlying collection.
</description>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Name of the exported scoped variable for the
status of the iteration. Object exported is of type
javax.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested
visibility.
</description>
<name>varStatus</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Iterates over tokens, separated by the supplied delimeters
</description>
<name>forTokens</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.ForTokensTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
String of tokens to iterate over.
</description>
<name>items</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.String</type>
</attribute>
<attribute>
<description>
The set of delimiters (the characters that
separate the tokens in the string).
</description>
<name>delims</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.String</type>
</attribute>
<attribute>
<description>
Iteration begins at the token located at the
specified index. First token has index 0.
</description>
<name>begin</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>int</type>
</attribute>
<attribute>
<description>
Iteration ends at the token located at the
specified index (inclusive).
</description>
<name>end</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>int</type>
</attribute>
<attribute>
<description>
Iteration will only process every step tokens
of the string, starting with the first one.
</description>
<name>step</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>int</type>
</attribute>
<attribute>
<description>
Name of the exported scoped variable for the
current item of the iteration. This scoped
variable has nested visibility.
</description>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Name of the exported scoped variable for the
status of the iteration. Object exported is of
type
javax.servlet.jsp.jstl.core.LoopTag
Status. This scoped variable has nested
visibility.
</description>
<name>varStatus</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Like <%= ... >, but for expressions.
</description>
<name>out</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.OutTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
Expression to be evaluated.
</description>
<name>value</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Default value if the resulting value is null.
</description>
<name>default</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Determines whether characters <,>,&,'," in the
resulting string should be converted to their
corresponding character entity codes. Default value is
true.
</description>
<name>escapeXml</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Subtag of <choose> that follows <when> tags
and runs only if all of the prior conditions evaluated to
'false'
</description>
<name>otherwise</name>
<tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class>
<body-content>JSP</body-content>
</tag>
<tag>
<description>
Adds a parameter to a containing 'import' tag's URL.
</description>
<name>param</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.ParamTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
Name of the query string parameter.
</description>
<name>name</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Value of the parameter.
</description>
<name>value</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Redirects to a new URL.
</description>
<name>redirect</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.RedirectTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
The URL of the resource to redirect to.
</description>
<name>url</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Name of the context when redirecting to a relative URL
resource that belongs to a foreign context.
</description>
<name>context</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Removes a scoped variable (from a particular scope, if specified).
</description>
<name>remove</name>
<tag-class>org.apache.taglibs.standard.tag.common.core.RemoveTag</tag-class>
<body-content>empty</body-content>
<attribute>
<description>
Name of the scoped variable to be removed.
</description>
<name>var</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Scope for var.
</description>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Sets the result of an expression evaluation in a 'scope'
</description>
<name>set</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.SetTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
Name of the exported scoped variable to hold the value
specified in the action. The type of the scoped variable is
whatever type the value expression evaluates to.
</description>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Expression to be evaluated.
</description>
<name>value</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Target object whose property will be set. Must evaluate to
a JavaBeans object with setter property property, or to a
java.util.Map object.
</description>
<name>target</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Name of the property to be set in the target object.
</description>
<name>property</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Scope for var.
</description>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Creates a URL with optional query parameters.
</description>
<name>url</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.UrlTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
Name of the exported scoped variable for the
processed url. The type of the scoped variable is
String.
</description>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Scope for var.
</description>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
URL to be processed.
</description>
<name>value</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Name of the context when specifying a relative URL
resource that belongs to a foreign context.
</description>
<name>context</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Subtag of <choose> that includes its body if its
condition evalutes to 'true'
</description>
<name>when</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.WhenTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
The test condition that determines whether or not the
body content should be processed.
</description>
<name>test</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>boolean</type>
</attribute>
</tag>
</taglib>
Thanks and Regards,
Velrajan T.For installing JSTL, all you need are the jar files in the web-inf/lib directory.
- No entries in web.xml
- no tld files lying around
- no problems!
I think you may have a versioning problem here.
What version of Tomcat are you using?
With JSP1.2 (eg Tomcat 4), you should be using JSTL1.0. <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
With JSP2.0 (eg Tomcat 5), you should use JSTL1.1. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
Note the difference in the URIs. - the second one includes a /jsp
Currently you are using the URI for JSTL1.0, but you look to have the tld from JSTL1.1. If you are using a JSP1.2 container, I don't think it could read this tld file, hence the error.
Try installing the correct version of JSTL, properly (ie as they tell you in the readme file) and it should all work.
Cheers,
evnafets -
Tunneling vs. Web Service to access EJB's through firewall
I need to be able to access EJB's from a client application when the server is
behind a firewall. Seems like I have two options:
1) Use WebLogic's built-in http-tunneling support.
2) Use WebLogic to generate a web service for each bean and then modify the client
application to use the generated SOAP stubs instead of having direct EJB references.
Now I know either option will result in slower performance as compared to direct
EJB references, but I'm not sure which is worse. Has BEA done any comparison
of the two approaches to know which one is expected to perform better than the
other? Any guidence someone can provide is greatly appreciated.
thanks,
DanRob Woollen <[email protected]> wrote:
It depends :>
If performance is your primary concern that it would be best to
benchmark both. I suspect the performance difference will greatly
depend on what types you are marshalling.Yep, I was curious about the same thing and tried some benchmarking - depending
on what was marshalled, or course, SOAP performance hit vs binary protocol was
not as bad as i expected it to be.
However, a web service client would offer some nice advantages. Your
client application would be a lot more flexible.But there will be some functionality loss over RMI.
-- Rob
Dan Branley wrote:
I need to be able to access EJB's from a client application when the server is
behind a firewall. Seems like I have two options:
1) Use WebLogic's built-in http-tunneling support.
2) Use WebLogic to generate a web service for each bean and then modify the client
application to use the generated SOAP stubs instead of having direct EJB references.
Now I know either option will result in slower performance as compared to direct
EJB references, but I'm not sure which is worse. Has BEA done any comparison
of the two approaches to know which one is expected to perform better than the
other? Any guidence someone can provide is greatly appreciated.
thanks,
Dan
Dimitri
Maybe you are looking for
-
How can I unlock my itunes account?
My itunes account is blocked by itunes and i have no idea how I can unblock it, I'm already trying for a long time. The reasen it was blocked is because of clickandbuy, its a long story but now my itunes is blocked so I cant update or buy anything al
-
Error getting while importing support package in R/3
Hi All, I am getting one error following error while importing support package in R/3. Open data extraction requests The system has found a number of open data extraction requests.These should be processed before starting the object import process, a
-
Why can't I choose Apple Mail from Lightroom 4 Email Account Manager
I know that the built-in emailer in Lightroom is pretty half-baked but I'm having trouble even getting limited functionality out of it. While many people report you can send an email and leave the "From:" menu blank and that will take you to Apple Ma
-
Debugging Workflow in ESS/MSS module .
Hi, I know the stpes to debugging simple workflow and trouble shooting the same, but now I want to know the debuggibg workflow steps for workflow running with ESS/MSS module Framework, The scenario is Its actually Approving Forms in ESS/MSS module, T
-
Openbox - switch desktop like in Xfce [SOLVED]
Hey all I've been using Xfce for a while now and I'm trying out Openbox, everything is great exept one feature that I miss. In Xfce I can move the mouse outside the screen to switch virtual desktops, which I've really gotten used to do, but I haven't