Servlet cannot invoke package classes
I have two class which is authenticateController and userAuthentication store in authencation package with path WEB-INF/class/authentication/.
My jvm is unable compile authenticateController in authentication directory but it is not problem in path WEB-INF/class/.
authenticateController.java
package authentication;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import authentication.*;
public class authenticateController extends HttpServlet {
//Initialize global variables
public void init() throws ServletException {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request,response);
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//RequestDispatcher dispatcher = request.getRequestDispatcher("userAuthentication");
//dispatcher.forward(request,response);
String usrnme = request.getParameter("usrnme");
String password = request.getParameter("password");
userAuthentication obj = new userAuthentication(usrnme, password);
if(obj.getResult()) {
HttpSession session = request.getSession();
session.setAttribute("authenticateUser",usrnme);
response.sendRedirect("/developmentLine/userId/authentication/queryresult.jsp");
else {
response.sendRedirect("/developmentLine/userId/authentication/login.jsp");
//Clean up resources
public void destroy() {
}Any problem in my code?
ok, this is compile error msg. I am using notepad and window cmd to compile. I able compile in classes directory (/WEB-INF/classes/) but once i move it into authentication subdirectory (/WEB-INF/class/authentication/), the authenticateController occur error msg as below.
C:\WebJsp\servletlibrary\WEB-INF\classes\authentication>javac authenticateController.java
authenticateController.java:28: cannot find symbol
symbol : class userAuthentication
location: class authentication.authenticateController
userAuthentication obj = new userAuthentication(usrnme, password
^
authenticateController.java:28: cannot find symbol
symbol : class userAuthentication
location: class authentication.authenticateController
userAuthentication obj = new userAuthentication(usrnme, password
^
2 errors
C:\WebJsp\servletlibrary\WEB-INF\classes\authentication>This is the userAuthentication.java
package authentication;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.Hashtable;
import javax.naming.ldap.*;
import javax.naming.directory.*;
import javax.naming.*;
public class userAuthentication{
private int totalResults;
public userAuthentication(String usrnme, String password) {
Hashtable env = new Hashtable();
String adminName = "MyCompany\\"+usrnme;
String adminPassword = password;
String ldapURL = "ldap://LDAPSERVER";
//Access the keystore, this is where the Root CA public key cert was installed
//Could also do this via the command line option java -Djavax.net.ssl.trustStore....
//No need to specifiy the keystore password for read operations
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
//set security credentials
env.put(Context.SECURITY_AUTHENTICATION,"simple");
env.put(Context.SECURITY_PRINCIPAL,adminName);
env.put(Context.SECURITY_CREDENTIALS,adminPassword);
//connect to my domain controller
env.put(Context.PROVIDER_URL,ldapURL);
try {
// Create the initial directory context
DirContext ctx = new InitialLdapContext(env,null);
//Create the search controls
SearchControls searchCtls = new SearchControls();
//Specify the attributes to return
String returnedAtts[]={"sn","givenName","mail","sAMAccountName","userPrincipalName","mailNickname","streetAddress"};
searchCtls.setReturningAttributes(returnedAtts);
//Specify the search scope
searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);
//specify the LDAP search filter
//mailNickname and sAMAccountName is same, but sAMAccountName is Old NT 4.0 logon name and it may confuse to CN attribute.
String searchFilter = "(&(objectClass=user)(mailNickname="+usrnme+"))";
//Specify the Base for the search
String searchBase = "DC=MyCompany,DC=com,DC=my";
//initialize counter to total the results
totalResults = 0;
// Search for objects using the filter
NamingEnumeration answer = ctx.search(searchBase, searchFilter, searchCtls);
//Loop through the search results
while (answer.hasMoreElements()) {
SearchResult sr = (SearchResult)answer.next();
totalResults++;
ctx.close();
catch (NamingException e) {
System.err.println("Problem searching directory: " + e);
public boolean getResult() {
if(totalResults == 0)
return false;
else
return true;
}Edited by: webster on Nov 17, 2008 4:49 PM
Edited by: webster on Nov 17, 2008 4:51 PM
Similar Messages
-
Servlet cannot find helper class
Hello
Under WEB-INF/classes I put ServletExample and SingletonExample. Compiling ServletExample, that makes use of SingletonExample, works.
In the directory WEB-INF/classes I also have another direcotry, test. And in WEB-INF/classes/test I put again ServletExample and SingletonExample.
Here I have tried in several ways to compile the servlet, but I always get an:
Cannot find symbol class SingletonExample.
I tried writing package test at the top of both files, and even at the top of only one of these two.
I even tried to make WEB-INF/classes/test/ServletExample make use of SingletonExample residing in WEB-INF/classes, but I didnt succeded.
What happens when you have subdirectory in WEB-INF/classes/? I think this is a MUST, to have subdirectory in large webapplication, so I really dont want to put everything in the classes directory.
Do you how to resolve this prolem? And: if Im in WEB-INF/classes/test and want to referr from a servlet residing in this direcory to a Singleton/helper class residing in WEB-INF/classes/, which approach do I have to use?
Thanks
PaoloJeez, you aren't gonna get very far in Java like this.
CLASSPATH is wrong - again. You're supposed to give JARs and paths where the class loader is supposed to look, not the actual .class file.
Also, you're not telling the compiler to put the .class file in the package directory structure.
Your example is pretty awful. Try this:
Put this code into c:\common
package common;
import common.test.TestDown; // What the hell is this? There is no package test, but there is a package named common.test
public class TestUp
public void sayHello()
System.out.println("Hello.....");
}Put this code into c:\common\test
package common.test;
import common.TestUp;
public class TestDown
public TestDown()
TestUp testUp = new TestUp();
testUp.sayHello();
public static void main(String[] args)
new TestDown();
}Open a command shell and navigate to c:\, then do the following:
Directory of c:
07/01/2005 03:43 PM <DIR> .
07/01/2005 03:43 PM <DIR> ..
07/01/2005 03:45 PM <DIR> common
0 File(s) 0 bytes
3 Dir(s) 74,909,675,520 bytes free
C:\>javac -d . common\*.java
C:\>javac -d . common\test\*.java
C:\>java -classpath . common.test.TestDown
Hello.....Once you've got your head around this, go learn Ant and have it compile your projects properly.
% -
Cannot find package/class symbol
hello. i'm using netveans for the first time. i have a java application with 2 classes... pb.java with public class pb int package svr and cl.java with public class cl in package cli
that is..
file class package
pb pb svr
cl cl cli
pb.java compiles properly cl.java gioves error.
the error is in the following lines of code...
pb obj1 = new pb();
pb obj2 = new pb();i'm trying to make an object fo type pb from cl.java. the error i get is...
cannot find symbol
class pb
location cli.cl
i alse tried puttin svr.pb instead of pb but no use.
the entire cose is as follows...
pb.java
* pb.java
* Created on December 4, 2006, 8:56 AM
package svr;
public class pb
private double balance;
private double []lt = new double [10];
private int i=9;
public void deposit(double amt)
if(amt<=0)
System.out.println("Enter amount greater than 0");
else
balance=balance+amt;
if(i>=0)
lt=amt;
else
for(int j=9;j>=0;j--)
lt[i]=lt[i-1];
lt[0]=amt;
public void withdraw(double amt)
if(amt<=0)
System.out.println("Enter amount greater than 0");
else
if(amt>balance)
System.out.println("Balance lower than amount entered");
else
balance=balance-amt;
if(i>=0)
lt[i]=-amt;
else
for(int j=9;j>=0;j--)
lt[i]=lt[i-1];
lt[0]=-amt;
public void bal()
System.out.println("Balance: "+balance);
public void lts()
System.out.println("Last 10 Transactions");
for(int j=i;j>10;j++)
System.out.println(lt[j]);
public void statement()
lts();
bal();
cl.java
* cl.java
* Created on December 4, 2006, 8:58 AM
package cli;
class cl
public static void main(String[] args)
pb obj1 = new pb();
pb obj2 = new pb();
obj1.deposit(100.50);
obj1.statement();
obj2.deposit(200.75);
obj2.statement();
obj1.withdraw(25.50);
obj1.statement();
obj2.withdraw(100.25);
obj2.statement();For a beginner these tools are worst, because they
hide all the stuff a programmer needs to know to find
his way around Java. They should spend a few weeks
with the command line and a good text editor before
switching.
Just because an IDE does something for you, it
doesn't mean you don't need to kno wwhat it does.
Unless you volunteer to handle all "how do I do X in
Netbeans/Eclipse/Whatever", JAR and classpath
questions posted here by newbies yourself.I suppose I can agree with that to some extent. I wouldn't suggest to anyone that they just blindly trust whatever code the IDE inserts automatically.
But there's nothing wrong about learning by example. The IDE is willing to teach proper syntax, and eclipse will give suggestions about capitalizing class names and making constants all-caps.
There are things that frustrate new programmers where an IDE will be helpful, especially if the entire API is uncharted territory. -
Hi.. can anybody help me.. with this age old problem?
I have an applet.. which generates a pie chart .. Pie.class. If i embed it in a normal HTML page.. it runs smoothly.
Now the problem is.. in my servlet i tried to do this
out.println("<applet code=Pie.class codebase=/mywebapp/ height=300 width=300">);etc..
but when the servlet runs.. the applet is not initalised .. so instead of having the applet i have a 'x' sign.. .. To diagnose the problem better.. i right click on the area that is supposed to be the applet and select 'Open Java Console' . ..there i see.. a ClassNotFound Exception.
I have kept the Pie.class in the WEB-INF -> classes Folder ( where all the other class files of the servlets are kept ).
Can anybody help me??
Thanks in advance
Hi guys sorry to bother u.. i have found the soln. myslef... my mistake was to place the applet class in web-inf-> class folder.. as soon as i placed it outside the folder.. it worked superbly. Thanks anyway
Message was edited by:
arijit_dattame also same problem...
this class path is included in server itself..
or we can set during compiling time...
then this is my compile.bat file please check
set classpath=%CLASSPATH%; ./WEB-INF/classes;
@echo off
javac -d ./WEB-INF/classes/ ./dev/beans/*.java
javac -d ./WEB-INF/classes/ ./dev/ContentManagement/beans/*.java
javac -d ./WEB-INF/classes/ ./dev/servlets/*.java
and my servlet file like this below..
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import com.deploy.servlet.*;
public class ControlServlet extends HttpServlet
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("Testing");
/* if (request.getParameter("pageName")=="CEOSpeak")
CEOBean CB = new CEOBean();
if (request.getParameter("actionType")=="add")
else if (request.getParameter("actionType")=="edit")
else if (request.getParameter("actionType")=="delete")
if(CB.deleteCEO(request.getParameter("CEOId")))
response.sendRedirect("CEO_Speaks.jsp"); -
Cannot invoke the APIs defined in Servlet 2.4 after installing the TOMCAT5
I have no idea why I still cannot invoke the API like request.getRemotePort() and response.setCharacterEncoding() API after I upgraded to TOMCAT 5.0.
I have included the servlet-api.jar provided with the TOMCAT 5.0 in the class path, but the compiler still cannot resolve the symbols (the above APIs)...
How can I do?i also encounter this problem, i add severlet2.4 that jar file, but still same wrong message, finally , i found cause, it is because if you also add compile path of j2ee 1.3, that is confliction, so get rid of j2ee 1.3 or download new version of j2ee that will ok
-
How to invoke servlet in a package in iPlanet Web Server 4.01 platform ?
I want to use a servlet which is in a package.
http://10.251.9.194/servlet/aibd.GetService
servlet is mapping to /home03/zhangxs/bbn/servlets.
but the servlet can not be invoked.
I read the errors file as following:
[02/ 7��/2001:17:06:35] warning (19620):
requested file not found
(uri=/servlet/aibd.GetService,
filename=/home03/zhangxs/bbn/servlets/aibd.GetService)
html invoking statement is as following:
<frame src="/servlet/aibd.GetService>
I already set the CLASSPATH env variable.
I think it should be applied using servlet of a package.
Maybe I missed some setting.
I hope u can help me.
Thanks in advance.There is an option in the Netscape admin functionality for mapping the servlet virtual directory from the request URI into the physical directory.
However I say don't. The Java support in Netscape 4.xx is lousy. Use Tomcat instead. It's more stable and a more complete implementation. Unfortunatly it's even more difficult to set up. -
Cannot find symbol class Usernamebean
hi i am new in j2ee
can some body help to give the solution.
i am always thankfull to everybody
i have a servlet where i am calling a bean of same package but servlet not compile giving that error
cannot find symbol class Usernamebean
servlet code
package ecomm; import java.sql.*; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; import bengalcom.*; public class Loginservelet extends HttpServlet { public void doGet(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException { try { String accnum=req.getParameter("username"); String pinnum=req.getParameter("password"); try { Class.forName("com.mysql.jdbc.Driver"); Connection dbcon=DriverManager.getConnection("jdbc:mysql://localhost/ecomm","root",""); PreparedStatement s = dbcon.prepareStatement("select * from vendordetails where email = ? and password = ? and blocking='No' "); s.setString(1,accnum); s.setString(2,pinnum); ResultSet result=s.executeQuery(); boolean rowfound=false; rowfound=result.next(); if(rowfound==true) { String vname=result.getString("fname"); String vid=result.getString("vid"); String email=result.getString("email"); UsernameBean nameBean =new UsernameBean(); nameBean.setFirstName(accnum); HttpSession session = req.getSession(true); session.setAttribute("vname",vname); session.setAttribute("vid",vid); session.setAttribute("email",email); RequestDispatcher dispatcher=getServletContext().getRequestDispatcher("/earea.jsp?vname=vname&vid=vid&email=email"); dispatcher.forward(req,res); dbcon.close(); } else{ RequestDispatcher dispatcher=getServletContext().getRequestDispatcher("/eblock.jsp"); dispatcher.forward(req,res); } } catch(ClassNotFoundException e) { } } catch(SQLException e) { System.out.println(e.toString()); } } public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { doGet(req, res); } }Hi,
java is case sensitive, Check the case in class name.
Regards,
Ram -
Java.lang.IllegalArgumentException: Cannot invoke beans
in 1 jsp page
<logic:iterate id="msgg" name="messages">
<tr>
<td>${msgg.messageNumber}</td>
<td>${msgg.from[0]}</td>
** <td><html:link action="msgbody?message=${msgg.message}">${msgg.subject}</html:link> </td>
<td>${msgg.sentDate}</td>
</tr>
</logic:iterate>
${msgg.message} which will return javax.mail.Message object
By clicking in the link(above shown as **) it will go to msgbody action and should set
message property of bean with javax.mail.Message object
for msg body action my bean is
package beans;
import javax.mail.Message;
import org.apache.struts.action.ActionForm;
public class MsgBn extends ActionForm {
private Message message;
public Message getMessage() {
return message;
public void setMessage(Message message) {
this.message = message;
i am getting following exception plz suggest me solutions
java.lang.IllegalArgumentException: Cannot invoke beans.MsgBn.setMessage - argument type mismatch
org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:1778)
org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:1759)
org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1648)
org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java:1677)
org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1022)
org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:811)
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:298)
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:493)Of course it's a String. It's being passed as a request parameter. Request parameters are always Strings.
It looks like something needs to be held in the session maybe? -
Hi all,
I am having some problems accessing JavaBeans from my servlets, but I can access them from my JSP page(i used the import command, <%@ page import="servlets.myBeans.login.User" %>, and it works).
I have placed my User bean in the following package
\webapps\ROOT\WEB-INF\classes\servlets\myBeans\login
Here's the java code for User Bean
package servlets.myBeans.login;
* A simple Java Bean for users.
public class User implements java.io.Serializable{
private String username = null;
private String password = null;
public User() {}
public User (String u, String p) {
username = u;
password = p;
public String getUsername() {
return username;
public void setUsername(String username) {
this.username = username;
public String getPassword() {
return password;
public void setPassword(String password) {
this.password = password;
public String toString() {
return username + ":" + password;
This compiles and creates a class file.
My servlet LoginControlServlet is in the following path
\webapps\ROOT\WEB-INF\classes\servlets
when I try to compile this servlet i get the following errors
C:\jakarta-tomcat-4.1.1.12-LE\jakarta-tomcat-4.1.24-LE-jdk14\webapps\ROOT\
WEB-INF\classes\servlets\LoginControlServlet.java:18:
cannot resolve symbol
symbol : class User
location: class servlets.LoginControlServlet
User up = (User)session.getAttribute("up");
^
C:\jakarta-tomcat-4.1.1.12-LE\jakarta-tomcat-4.1.24-LE-jdk1\webapps\ROOT
\WEB-INF\classes\servlets\LoginControlServlet.java:18:
cannot resolve symbol
symbol : class User
location: class servlets.LoginControlServlet
User up = (User)session.getAttribute("up");
^
C:\jakarta-tomcat-4.1.1.12-LE\jakarta-tomcat-4.1.24-LE-jdk1\webapps\ROOT
\WEB-INF\classes\servlets\LoginControlServlet.java:27:
cannot resolve symbol
symbol : class User
location: class servlets.LoginControlServlet
up = new User(user,pass);
^
3 errors
I have already included the \webapps\ROOT\WEB-INF\classes in my class path
infact, I have even included \webapps\ROOT\WEB-INF\classes\servlets and
\webapps\ROOT\WEB-INF\classes\servlets\myBeans\login in my classpath.
Any ideas, as to why I am having the above errors.
thanks,
manishI think it's pretty much got to be a compile time classpath problem. Either your bean is compiling to a funny place, or you classpath is wrong when you compile the servlet. Probably the latter if your jsp picks it up OK.
The entry in the classpath should be
<tomcat directory>/webapps/ROOT/WEB-INF/classes
Check the syntax carefully.
putting package directories on your classpath can only confuse things.
Make sure that ...../webapps/servlets/myBeans/login/User.class exists. -
//package classes;
i have used the code below,,and my application is working fine...but when i removed the comments from the package ling..the 404 error is coming..i have compiled the servlet with package line uncommented..whats the reason?
//package classes;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.*;
import java.sql.*;
public class CookieLoginServlet extends HttpServlet {
public void doGet(HttpServletRequest request ,HttpServletResponse response)
throws ServletException,IOException {
sendLoginForm(response,false);
System.out.println("inside get");
public void doPost(HttpServletRequest request,HttpServletResponse response)
throws ServletException ,IOException {
String userName=request.getParameter("userName");
String password=request.getParameter("password");
if(login(userName,password)){
Cookie c1=new Cookie("userName",userName);
Cookie c2=new Cookie("password",password);
response.addCookie(c1);
response.addCookie(c2);
response.setContentType("text/html");
PrintWriter out =response.getWriter();
// response.sendRedirect does not work here.
// use a Meta tag to redirect to ContentServlet
out.println("<META HTTP-EQUIV=Refresh CONTENT=0;URL=ContentServlet>");
}else{
sendLoginForm(response,true);
private void sendLoginForm(HttpServletResponse response,boolean withErrorMessage)
throws ServletException ,IOException {
response.setContentType("text/html");
PrintWriter out=response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>Login</title>");
out.println("<body>");
out.println("<center>");
if(withErrorMessage){
out.println("login failed .plz try again<br>");
out.println("if u think you have entered the correct user name "+
"and password,the cookie setting in your browser might be off " +
"<br>Click<a href=InfoPage.html>here</a> for information ");
out.println("<br>");
out.println("<br><h2>please enter your username and password</h2>");
out.println("<br>");
out.println("<br><form method=POST>");
out.println("<table>");
out.println("<tr>");
out.println("<td>userName:</td>");
out.println("<td><input type=text name=userName></td>");
out.println("</tr>");
out.println("<tr>");
out.println("<td>password:</td>");
out.println("<td><input type=password name=password></td>");
out.println("</tr>");
out.println("<tr>");
out.println("<td><input type=submit value=submit></td>");
out.println("</table>");
out.println("</form>");
out.println("</center");
out.println("</body>");
out.println("</html>");
public static boolean login(String userName,String password){
try{
Class.forName("sun.jdbdc.odbc.JdbcOdbcDriver");
Connection con =DriverManager.getConnection("jdbc:odbc:JavaWeb");
Statement s=con.createStatement();
String sql="SELECT UserName FROM users" +
"WHERE UserName='"+fixSqlFieldValue(userName)+ "'"+
"AND password='"+fixSqlFieldValue(password)+"'";
ResultSet rs= s.executeQuery(sql);
if(rs.next()){
rs.close();
s.close();
return true;
}else
{ rs.close();
s.close();
con.close();
}catch(ClassNotFoundException e){
System.out.println(e.toString());
catch (SQLException e) {
System.out.println(e.toString());
catch (Exception e) {
System.out.println(e.toString());
return false;
public static String encodeHtmlTag(String tag){
if(tag==null)
return null;
int length=tag.length();
StringBuffer encodeTag=new StringBuffer(2*length);
for(int i=0; i<length; i++) {
char c=tag.charAt(i);
if(c=='<')
encodeTag.append("<");
else if(c=='>')
encodeTag.append(">");
else if(c=='&')
encodeTag.append("&");
else if(c=='"')
encodeTag.append(""");
else if(c==' ')
encodeTag.append(" ");
else
encodeTag.append(c);
return encodeTag.toString();
public static String fixSqlFieldValue(String value) {
if (value==null)
return null;
int length = value.length();
StringBuffer fixedValue = new StringBuffer((int) (length* 1.1));
for(int i=0; i<length; i++) {
char c = value.charAt(i);
if(c=='\'')
fixedValue.append("''");
else
fixedValue.append(c);
return fixedValue.toString();
}It means you didn't deploy the servlet properly.
Put the package back - all your Java classes should go into packages. All the time. The only exception is when you're writing a quick knock-off to test something that you'll run on the command line and rarely use again.
No surprise - the code you've written is certainly terrible. HTML to the output stream - ever heard of JSP?
SQL code in a servlet - ever hear of Data Access Objects?
Layering apps makes them easier to test, debug, maintain, and understand.
What servlet/JSP engine are you using? Tomcat? If so, Tomcat requires that you use packages.
Where did you put this beauty of a servlet? Better not be /ROOT. Create a directory under /webapps for your app and deploy it there.
What URL did you use to invoke the servlet? I'll bet that's wrong, too.
Lots to correct here.
% -
Cannot invoke Applet on browser...HELP!
I cannot invoke Applet on browser however I can invoke the applet on appletviewer.
Anyone that can help me?
Thanks.youre gonna have some major headaches if your applet uses the swing package..
IE's support for it is so flaky its not even funny
If youre using awt then you really shouldnt have a problem viewing in a browser..
just add this to your HTML code and you should be set
<applet> code = "yourapplet.class" width = somenumber height = somenumber </applet> -
Cannot convert type class java.lang.String to class oracle.jbo.domain.ClobDomain.
Using ADF Business Components I have a JSFF page fragment with an ADF form based on a table with has a column of type CLOB. The data is retrieved from the database and displayed correctly but when any field is changed and submitted the above error occurs. I have just used the drag and drop technique to create the ADF form with a submit button, am I missing a step?
I am using the production release of Jdeveloper11GReproduced and filed bug# 7487124
The workaround is to add a custom converter class to your ViewController project like this
package oow2008.view;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;
import oracle.jbo.domain.ClobDomain;
import oracle.jbo.domain.DataCreationException;
public class ClobConverter implements Converter {
public Object getAsObject(FacesContext facesContext,
UIComponent uIComponent,
String string) {
try {
return string != null ? new ClobDomain(string) : null;
} catch (DataCreationException dce) {
dce.setAppendCodes(false);
FacesMessage fm =
new FacesMessage(FacesMessage.SEVERITY_ERROR,
"Invalid Clob Value",
dce.getMessage());
throw new ConverterException(fm);
public String getAsString(FacesContext facesContext,
UIComponent uIComponent,
Object object) {
return object != null ?
object.toString() :
null;
}then to register the converter in faces-config.xml like this
<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee">
<application>
<default-render-kit-id>oracle.adf.rich</default-render-kit-id>
</application>
<converter>
<converter-id>clobConverter</converter-id>
<converter-class>oow2008.view.ClobConverter</converter-class>
</converter>
</faces-config>then reference this converter in the field for the ClobDomain value like this
<af:inputText value="#{bindings.Description.inputValue}"
label="#{bindings.Description.hints.label}"
required="#{bindings.Description.hints.mandatory}"
columns="40"
maximumLength="#{bindings.Description.hints.precision}"
shortDesc="#{bindings.Description.hints.tooltip}"
wrap="soft" rows="10">
<f:validator binding="#{bindings.Description.validator}"/>
<f:converter converterId="clobConverter"/>
</af:inputText> -
Failed to invoke startup class "MyStartup Class"
Hi,
I configured StartUpClass.java in Weblogic server through Admin Console . Also I set the required jar files in the classpath of the server in WL_HOME\server\bin\startWLS.cmd.
This StartUPClass is written to initialize and create the minimum number of objects in the pool, needed for URLConnection using ObjectPooling API.
I am getting Exceptions while starting the server after deployment of the application. I am pasting the full stack trace.
<Feb 1, 2007 9:49:55 AM IST> <Info> <WebLogicServer> <BEA-000377> <Starting WebLogic Server with Java HotSpot(TM) Client VM Version 1.4.2_12-b03 from Sun Microsystems Inc.>
<Feb 1, 2007 9:50:10 AM IST> <Info> <Configuration Management> <BEA-150016> <This server is being started as the administration server.>
<Feb 1, 2007 9:50:10 AM IST> <Info> <Management> <BEA-141107> <Version: WebLogic Server 8.1 SP4 Mon Nov 29 16:21:29 PST 2004 471647
WebLogic XMLX Module 8.1 SP4 Mon Nov 29 16:21:29 PST 2004 471647 >
<Feb 1, 2007 9:50:11 AM IST> <Notice> <Management> <BEA-140005> <Loading domain configuration from configuration repository at D:\bea\user_projects\domains\nessdomain\.\config.xml.>
<Feb 1, 2007 9:50:15 AM IST> <Notice> <Log Management> <BEA-170019> <The server log file D:\bea\user_projects\domains\nessdomain\myserver\myserver.log is opened. All server side log events will be written to this file.>
<Feb 1, 2007 9:50:18 AM IST> <Notice> <Security> <BEA-090082> <Security initializing using security realm myrealm.>
<Feb 1, 2007 9:50:18 AM IST> <Notice> <WebLogicServer> <BEA-000327> <Starting WebLogic Admin Server "myserver" for domain "nessdomain">
<Feb 1, 2007 9:50:31 AM IST> <Warning> <HTTP> <BEA-101248> <[Application: 'D:\MSM\Workspace\MSM2.0Jan9', Module: 'MSM31']: Deployment descriptor "web.xml" is malformed. Check against the DTD: org.xml.sax.SAXParseException: The content of element type "web-app" must match "(icon?,display-name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)". (line 96, column 11).>
<Feb 1, 2007 9:50:31 AM IST> <Warning> <HTTP> <BEA-101248> <[Application: 'D:\MSM\Workspace\MSM2.0Jan9', Module: 'MSM31']: Deployment descriptor "weblogic.xml" is malformed. Check against the DTD: org.xml.sax.SAXParseException: The content of element type "weblogic-web-app" must match "(description?,weblogic-version?,security-role-assignment*,run-as-role-assignment*,reference-descriptor?,session-descriptor?,jsp-descriptor?,auth-filter?,container-descriptor?,charset-params?,virtual-directory-mapping*,url-match-map?,preprocessor*,preprocessor-mapping*,security-permission?,context-root?,wl-dispatch-policy?,servlet-descriptor*,init-as*,destroy-as*)". (line 23, column 20).>
<Feb 1, 2007 9:50:35 AM IST> <Critical> <WebLogicServer> <BEA-000286> <Failed to invoke startup class "MyStartup Class", java.lang.ClassNotFoundException: com.helio.msm.ws.util.StartUpClass
java.lang.ClassNotFoundException: com.helio.msm.ws.util.StartUpClass
at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at weblogic.t3.srvr.StartupClassService.invokeClass(StartupClassService.java:156)
at weblogic.t3.srvr.StartupClassService.access$000(StartupClassService.java:36)
at weblogic.t3.srvr.StartupClassService$1.run(StartupClassService.java:121)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.t3.srvr.StartupClassService.invokeStartupClass(StartupClassService.java:116)
at weblogic.t3.srvr.PostDeploymentStartupService.resume(PostDeploymentStartupService.java:63)
at weblogic.t3.srvr.SubsystemManager.resume(SubsystemManager.java:131)
at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:966)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:361)
at weblogic.Server.main(Server.java:32)
>
<Feb 1, 2007 9:50:36 AM IST> <Error> <Socket> <BEA-000438> <Unable to load performance pack. Using Java I/O instead. Please ensure that wlntio.dll is in: 'D:\j2sdk1.4.2_12\bin;.;C:\WINDOWS\system32;C:\WINDOWS;D:\j2sdk1.4.2_12\bin;c:\windows\system32;C:\apache-ant-1.6.5\bin;'
>
<Feb 1, 2007 9:50:36 AM IST> <Notice> <WebLogicServer> <BEA-000331> <Started WebLogic Admin Server "myserver" for domain "nessdomain" running in Development Mode>
<Feb 1, 2007 9:50:36 AM IST> <Notice> <WebLogicServer> <BEA-000360> <Server started in RUNNING mode>
<Feb 1, 2007 9:50:36 AM IST> <Notice> <WebLogicServer> <BEA-000355> <Thread "ListenThread.Default" listening on port 7001, ip address *.*>
<Feb 1, 2007 9:50:55 AM IST> <Warning> <Socket> <BEA-000402> <There are: 5 active sockets, but the maximum number of socket reader threads allowed by the configuration is: 4. You may want to alter your configuration.>
Please help me in resolving this problem. I need it asap
Thanks,
DharaniI should be more specific and have a bit more to add....
We have our app in an .ear file. I find that when I put the startup
classes in a seperate directory which is in the classpath specified in the
startWeblogic.cmd file they will be run on startup. I don't think I should
have to do this since these files exist in the ear file. I think this is
causing other problems too such as an illegalAccessError I get when an EJB
tries to load a class which was previously accessed by the startup classes.
Thanks,
Steve
Steve Snodgrass wrote:
Hi,
I am beggining to upgrade our app from Weblogic 5.1 to 6.0. So far it
has been progressing nicely and everything works with one exception. I
can not get the start up classes to run. I get the following exception:
<Failed to invoke startup class "MyStartup Class",
java.lang.ClassNotFoundException:
followed by my fully qualified class name. The class is reference
elsewhere in the code and works fine. Is a seperate classpath used for
startup classes? If not why might Weblogic have a hard time finding my
class?
Thanks,
Steve -
XSQL servlet cannots set Content-Disposition
XSQLPageRequestImpl does not have a method to set the value of the "Content-Disposition" parameter of the HttpServletResponse.
In the PLSQL Package HTP one can set additional headers of the HttpServletResponse.
Currently, due to the lack of support of XSQLPageRequestImpl, it is not possible to provide proper filename to save e.g. servlet output.
Something like
res.setHeader("Content-disposition","attachment; filename=\""+pathName+"\"")
is needed at serializer level and therefore shall be implemented in XSQLPageRequestImpl or at least accessible from it.The following code does the job.
import oracle.xml.parser.v2.XMLElement;
import oracle.xml.xsql.XSQLDocumentSerializer;
import org.w3c.dom.*;
import oracle.xml.xsql.XSQLPageRequest;
import oracle.xml.xsql.XSQLServletPageRequest;
import oracle.xml.sql.core.OracleXMLConvert;
import java.io.OutputStream;
import javax.activation.*;
import javax.servlet.http.HttpServletResponse;
public class BLOBSerializer implements XSQLDocumentSerializer {
public BLOBSerializer() { }
public void serialize(Document doc, XSQLPageRequest env) throws java.lang.Throwable {
XMLElement docRoot=(XMLElement)doc.getDocumentElement();
String contentDisp="attachment; filename="+docRoot.valueOf("./filename");
XSQLServletPageRequest xspr=(XSQLServletPageRequest)env;
HttpServletResponse hsp=xspr.getHttpServletResponse();
hsp.setHeader("Content-disposition",contentDisp);
OutputStream out = env.getOutputStream();
env.setContentType(docRoot.valueOf("./request/parameters/doc_type"));
String DocString=docRoot.valueOf("./ROWSET/ROW/DOCUMENT");
byte abyte0[] = oracle.xml.sql.core.OracleXMLConvert.convertHexStringToByte(DocString);
out.write(abyte0, 0, abyte0.length);
out.flush();
out.close(); -
Process + Servlet to invoke process + form + database
GetMortgageForm process
The following illustration shows the GetMortgageForm process (see Figure 2).
Figure 2. A LiveCycle ES process that returns an interactive form.
Note: This document does not describe how to create a process by using Adobe LiveCycle Workbench ES. (For information, see Workbench ES Help.)
The following table describes the steps in this diagram.
Operation Description
1 The user submits a custom identifier value and the operation to perform. In this situation, assume that the user is applying for a mortgage. The input parameters for this process are a string value that specifies the form name (named formName) and another string value that represents the custom identifier value (named custId).
Note: In the Java application logic located in the Java servlet, the formName and custId process variables are referenced.
2 The process uses the customer identifier value to perform a relational database look-up for additional customer information by using the JdbcService service's Execute SQL Statement operation. The custom identifier value acts as the primary key value.
3 Merges customer data into an XML data source that is used to prepopulate the form. (See "Prepopulating Dynamic Forms" in Programming with LiveCycle ES.)
4 The mortgage form is rendered with customer data located in some of the fields, such as the address field. This action is based on the Forms service's renderPDFForm operation.
The Java servlet receives the form (return value for the process) and writes the form to a client web browser. The name of the output parameter is RenderedForm. This parameter is a process variable and its data type is FormsResult.
Note: In the Java application logic located in the Java servlet that invokes this process, the RenderedForm process variable is referenced.
This interactive loan form is rendered by the GetMortgageForm process (see Figure 3).
Figure 3. An interactive form.
Note: This document describes how to use the Invocation API to invoke a LiveCycle ES process. It is recommended that you are familiar with the Invocation API before you follow along with this document. (See "Invoking LiveCycle ES Processes" in Programming with LiveCycle ES.)
Summary of steps
To create a Java servlet that invokes a LiveCycle ES process, perform the following steps:
1. Create a new web project.
2. Create Java application logic that represents the Java servlet.
3. Create the web page for the web application.
4. Package the web application to a WAR file.
5. Deploy the WAR file to the J2EE application server.
6. Test your web application.
Note: Some of these steps depend on the J2EE application on which LiveCycle ES is deployed. For example, the method you use to deploy a WAR file depends on the J2EE application server that you are using. This document assumes that LiveCycle ES is deployed on JBoss®.
Creating a web project
The first step to create a Java servlet that can invoke a LiveCycle ES process is to create a new web project. The Java IDE that this document is based on is Eclipse 3.3. Using the Eclipse IDE, create a web project and add the required JAR files to your project. Finally, add an HTML page named index.html and a Java servlet to your project.
The following list specifies the JAR files that you must add to your web project:
adobe-forms-client.jar
adobe-livecycle-client.jar
adobe-usermanager-client.jar
adobe-utilities.jar
For the location of these JAR files, see "Including LiveCycle ES Java library files" in Programming with LiveCycle ES.
Note: The adobe-forms-client.jar file is required because the process returns a FormsResult object, which is defined in this JAR file.
To create a web project:
1. Start Eclipse and click File > New Project.
2. In the New Project dialog box, select Web > Dynamic Web Project.
3. Type InvokeMortgageProcess for the name of your project and then click Finish.
To add required JAR files to your project:
1. From the ProjectPeter - Set the Source Used attribute of P42_FK1 to "Only,..." .
Scott
Maybe you are looking for
-
How can I get Windows Internet explorer on my MacBook air?
I have several websites that I need to use for my new job that have not been tested for Mac. I don't want to have to buy a PC laptop, so I was wondering if there is a tried and true way to get windows Internet explorer on my MacBook air.
-
How do i replace my 5c with a 5 or 5s
how do i replace my 5c with a 5 or 5s, there is nothing out there for cases or anything to match the button layout on the phone, i have spent $100 in 2 days buying case after case
-
How can I get firefox to remember my user name for accounts that I access frequently?
I always check the box asking do I want firefox to remember my user id so that I do not have to fill it in each time I go online. However, every time I go to these same websites, it never remembers my id. Is there a setting that I am overlooking to p
-
Where do i find video tutorials for GarageBand '08?
I can only locate video tutorials for GarageBand '09... I have GarageBand '08. Where do I find tutorials for this?
-
Digital Camera Raw wont update
after finally gettin A# to work and update in softeare update - now it appears my Camera Raw file is still at 3.01 and is supposed to be 3.1. where is this file located and how do i reestablish it to update in software update??