Problem:Can't instantiate class
I tried for many hours to solve the problem but in vain.
here is the Exception i got from tomcat:javax.servlet.ServletException: javax.servlet.jsp.JspException: javax.faces.FacesException: javax.faces.FacesException: Can't instantiate class: 'core.walid.NwindManagedBean'.. core.walid.NwindManagedBean
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:844)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
org.apache.jsp.index_jsp._jspService(index_jsp.java:91)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
cause m�re
javax.faces.el.EvaluationException: javax.faces.FacesException: javax.faces.FacesException: Can't instantiate class: 'core.walid.NwindManagedBean'.. core.walid.NwindManagedBean
com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:206)
com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:154)
javax.faces.component.UIData.getValue(UIData.java:527)
javax.faces.component.UIData.getDataModel(UIData.java:856)
javax.faces.component.UIData.setRowIndex(UIData.java:379)
com.sun.faces.renderkit.html_basic.TableRenderer.encodeBegin(TableRenderer.java:65)
javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:683)
javax.faces.component.UIData.encodeBegin(UIData.java:681)
javax.faces.webapp.UIComponentTag.encodeBegin(UIComponentTag.java:591)
javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:543)
com.sun.faces.taglib.html_basic.DataTableTag.doEndTag(DataTableTag.java:491)
org.apache.jsp.index_jsp._jspx_meth_h_dataTable_0(index_jsp.java:161)
org.apache.jsp.index_jsp._jspx_meth_c_view_0(index_jsp.java:116)
org.apache.jsp.index_jsp._jspService(index_jsp.java:80)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)here is the bean i don't see any problelme it uses JDBC to access the database/*
* NwindManagedBean.java
* Created on 4 mars 2007, 01:02
package Core.walid;
import java.sql.*;
import javax.sql.*;
import java.util.ArrayList;
import java.util.Collection;
import java.io.*;
import javax.servlet.jsp.jstl.sql.*;
* @author walid
public class NwindManagedBean implements Serializable{
private String tableName="Customers";
private ResultSet resultSet;
private Connection connection;
/** Creates a new instance of NwindManagedBean */
public NwindManagedBean() {
public String getTableName(){
return tableName;
public void setTableName(String tableName){
this.tableName=tableName;
public void open(){
String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
String url = "jdbc:odbc:Nwind";
String username = "";
String password = "";
try{
Class.forName(driver);
connection =DriverManager.getConnection(url,username,password);}
catch(Exception e){System.out.println(e);}
public void search(){
try{ Statement statement=connection.createStatement();
String query ="select * from "+tableName;
resultSet=statement.executeQuery(query);
catch(Exception cnfe) {};
public ResultSet getResultSet(){
open();
search();
return resultSet;
public void showResults(){
int i=1;
try{ while(resultSet.next())
System.out.println(resultSet.getString(i));
i++;
catch(Exception e){System.out.println("erreur sql"+e);}
}i declared the bean in faces-config<faces-config>
<managed-bean>
<managed-bean-name>NwindManagedBean</managed-bean-name>
<managed-bean-class>core.walid.NwindManagedBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
</faces-config>and finally the jsf page to list the database contents<%@ taglib uri="http://java.sun.com/jsf/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<html>
<HEAD><TITLE>Northwind Customers</title>
</HEAD>
<body>
<center>
<table border="5">
<tr><th class="Northwind customers"></th></tr>
</table>
<p>
<c:view>
<h:dataTable value="#{NwindManagedBean.resultSet}"
var="dbRow"
border="1"
>
<h:column>
<c:facet name="header">
<c:verbatim>Company name</c:verbatim>
</c:facet>
<h:outputText value="#{dbRow.CompanyName}"/>
</h:column>
<h:column>
<c:facet name="header">
<c:verbatim>Address</c:verbatim>
</c:facet>
<h:outputText
value="#{dbRow.Address}"/>
</h:column>
<h:column>
<c:facet name="header">
<c:verbatim>City</c:verbatim>
</c:facet>
<h:outputText
value="#{dbRow.City}"/>
</h:column>
</h:dataTable>
</c:view>
</center>
</body>
</html>
Hello,
I'm not sure, but i would try to put the package only in lowercase.
Your class pakageis declared with first Upper case letter.
And in you faces-config file, you declared with lower case.
Note : it's recommanded to use only lower case for package name.
Regards,
Sebastien Degardin
Similar Messages
-
Hi,
I am using jsf 1.1
I am trying to populate a simple drop down in MyJsp.jsp with the List values generated in ContactsListBean.java. I am copying the code here for reference.
when I launch the page (forwarding to this MyJsp.jsp in index.jsp) I am getting this error below. Can anyone help me out what is it that I am doing wrong?? I am unable to trace out what's wrong. I have even tried the same logic with h:selectOneListbox also but I get the same error..
Any help/advice would be highly appreciated, Thanks in advance.
org.apache.jasper.JasperException: javax.servlet.jsp.JspException: javax.faces.FacesException: javax.faces.FacesException: Can't instantiate class: ''.
* org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)*
* org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)*
* org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)*
* org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)*
* javax.servlet.http.HttpServlet.service(HttpServlet.java:803)*
* com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)*
* com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147)*
* com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)*
* com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)*
* com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)*
* javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)*
* org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:686)*
* org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:656)*
* org.apache.jsp.index_jsp._jspService(index_jsp.java:71)*
* org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)*
* javax.servlet.http.HttpServlet.service(HttpServlet.java:803)*
* org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)*
* org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)*
* org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)*
* javax.servlet.http.HttpServlet.service(HttpServlet.java:803)*
MyJsp.jsp
<%@ page language="java" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSF 'MyJsp.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<f:view>
This is my JSF JSP page. <br><h:form>
<h:selectOneMenu id="loc1" value="#{contactsListBean.selectedLocation}">
<f:selectItems id="ll1" value="#{contactsListBean.locationList}"/>
</h:selectOneMenu>
</h:form>
</f:view>
</body>
</html>
ContactsListBean.java
public class ContactsListBean {
private java.util.List locationList = new ArrayList();;
private java.lang.String selectedLocation;
public ContactsListBean() {
System.out.println("Construnction list....");
locationList.add(new SelectItem("test1","test1",""));
locationList.add(new SelectItem("test2","test2",""));
locationList.add(new SelectItem("test3","test3",""));
public java.util.List getLocationList() {
System.out.println("returning LIST OF SIZE "+locationList.size());
return locationList;
public void setLocationList(java.util.List locationList) {
this.locationList = locationList;
System.out.println("got list size..."+locationList.size());
public java.lang.String getSelectedLocation() {
return selectedLocation;
public void setSelectedLocation(java.lang.String selectedLocation) {
this.selectedLocation = selectedLocation;
faces-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
<managed-bean>
<managed-bean-name>contactsListBean</managed-bean-name>
<managed-bean-class>ContactsListBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>locationList</property-name>
<property-class>java.util.List</property-class>
<value/>
</managed-property>
<managed-property>
<property-name>selectedLocation</property-name>
<property-class>java.lang.String</property-class>
<value/>
</managed-property>
</managed-bean>
</faces-config>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>Your class is now been put in a package? Good, now the next step is to remove all of those managed-property entries from the faces-config.xml. It makes no sense because 1) you already created the list in the backing bean and 2) you didn't assign any value to the item in the managed property.
-
[ Server applet ] Problem : Can't instantiate socket
Hy guys ! i'm having a problem getting my tcp server applet on it's feet, the problem is that it doesn't get past instantiating a socket, if i instatiate it with port nr 80 it throws an exception ( Address already in use: JVM_Bind ), with other ports it just locks up at the "Binding to port" part. Today it locks up on any port i use including 80
ServerSocket server;
int port= Integer.parseInt(portNumber.getText()); //port number's a text field
status.setText("Starting server..\n"); //status is a text area
try {
status.append("Binding to port " + port + ", please wait ...\n");
server = new ServerSocket(port);
} catch (IOException ioe) {
status.append("EROARE la creearea socketului\nEXCEPTIE:
"+ioe.getMessage()+"\n");
return;
}Does anybody have a clue why this happens?
i'm uploading the server class and test web page if it will help sort this out
http://uploading.com/files/XQ0TGHPT/server.rar.htmlis there really nothing that can be done to make this work !?
-
NoClassDefFoundError: Can't instantiate class on WL, works fine locally
I have an ear running on WebLogic that contains an ejb. All runs well until the ejb tries to instantiate an object of ServiceFactory - one of our own classes.
In my unit tests, I could create an object of the class locally. It's on the server that the error occurs.
I'm guessing this is either a build/packaging issue or a WebLogic 10.3.6 quirk but don't know where to proceed from here given that the dependency exists in the ear (in APP-INF/lib). I've also tried moving the dependency that contains the class to the root of the ear. "Class-Path: " is blank in the MANIFEST.MF file for the ejb and the ear, but the product has run fine until now without them. I'm building with Maven.
javax.ejb.EJBException: what do i do: seems an odd quirk of the EJB spec. The exception is:java.lang.NoClassDefFoundError: Could not initialize class com.company.ts.management.icm.service.ServiceFactory
at com.oracle.pitchfork.intercept.MethodInvocationInvocationContext.proceed(MethodInvocationInvocationContext.java:110)
at com.company.it.techservices.aae.service.CommonService.bizLog(CommonService.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
at com.oracle.pitchfork.intercept.JeeInterceptorInterceptor.invoke(JeeInterceptorInterceptor.java:68)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.oracle.pitchfork.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:34)
at weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:54)
at com.oracle.pitchfork.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:42)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy476.calculateRoles(Unknown Source)
at com.company.it.techservices.aae.autheng.AuthorizationEngineBean_t79b4w_AuthorizationEngineBeanRemoteImpl.__WL_invoke(Unknown Source)
at weblogic.ejb.container.internal.SessionRemoteMethodInvoker.invoke(SessionRemoteMethodInvoker.java:40)
at com.company.it.techservices.aae.autheng.AuthorizationEngineBean_t79b4w_AuthorizationEngineBeanRemoteImpl.calculateRoles(Unknown Source)
at com.company.it.techservices.aae.autheng.AuthorizationEngineBean_t79b4w_AuthorizationEngineBeanRemoteImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:667)
at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:230)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:522)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:518)
at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)A web application doesn't use the standard classpath settings.
It uses the web-inf/classes directory, and web-inf/lib
I'm not sure what the equivalent would be for blazix, but you need your jdbc driver in the web-inf/lib directory. - maybe blazix/lib if the pattern follows?
Hope this helps,
evnafets -
Can't instantiate JSF Custom Component
I'm hoping some of you expert (or at least seasoned) JSF custom component developers might be able to lend some insight into the "Can't instantiate class" problem. I have a custom component which extends another component (which happens to be Oracle ADF's panelGroup), and I've verified that everything is in place:
1. Component class uses correct component type referenced by faces-config.xml and tag class
2. Renderer type referenced in faces-config.xml matches that of the renderer type in component class
3. There is a default constructor (no args) for the component class, which also sets the renderer type
4. TLD with tag is correct
All classes are definitely in the classpath, as I have another custom component in the same packages which loads and is used just fine.
Any ideas would be appreciated.
Thanks,
Shawn Bertrand
Tyco ElectronicsSo, is no one else having any problems when using the new JSF components from Java Studio Creator 2 in their existing projects? I can make simple projects in Creator and run them on PointBase and Tomcat and can deploy and run from Eclipse using MyEclipse but I cannot get my existing project working and I am wondering if their is some sort of conflict between the new JSF components and legacy Struts stuff in that project or if perhaps Spring is someone interferering. Kind of at a loss right now...
-
I create a enterprise application using jsf 2.0, ejb3, primefaces 2 and I want to show data in table immediately after ejb call findAll() method. But it's always appear: "can't instantiate class". Here is my code:
index.xhtml
<h:form>
<p:dataTable id="tbl" var="p" value="#{Product.products}" >
<p:column>
<f:facet name="header">
Product Id
</f:facet>
<h:outputText value="#{p.productID}" />
</p:column>
<p:column>
<f:facet name="header">
Product Name
</f:facet>
<h:outputText value="#{p.productName}" />
</p:column>
<p:column>
<f:facet name="header">
Unit Price
</f:facet>
<h:outputText value="#{p.unitPrice}" />
</p:column>
</p:dataTable>
</h:form>
package myEntity;
@Entity
@Table(name = "Products")
@NamedQueries({
@NamedQuery(name = "Products.*findAll*", query = "SELECT p FROM Products p"),
public class Products implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@Column(name = "productID")
private Integer productID;
@Basic(optional = false)
@Column(name = "productName")
private String productName;
@Basic(optional = false)
@Column(name = "unitPrice")
private double unitPrice;
public Products() {
public Products(Integer productID) {
this.productID = productID;
public Products(Integer productID, String productName, double unitPrice) {
this.productID = productID;
this.productName = productName;
this.unitPrice = unitPrice;
public Integer getProductID() {
return productID;
public void setProductID(Integer productID) {
this.productID = productID;
public String getProductName() {
return productName;
public void setProductName(String productName) {
this.productName = productName;
public double getUnitPrice() {
return unitPrice;
public void setUnitPrice(double unitPrice) {
this.unitPrice = unitPrice;
package mySessionBean;
@Stateless
public class ProductsFacade implements ProductsFacadeLocal {
@PersistenceContext(unitName = "demoProduct-ejbPU")
private EntityManager em;
public List<Products> *findAll*() {
CriteriaQuery cq = em.getCriteriaBuilder().createQuery();
cq.select(cq.from(Products.class));
return em.createQuery(cq).getResultList();
package myManagedBean;
@ManagedBean(name="Product")
@RequestScoped
public class Product {
@EJB
private ProductsFacadeLocal productsFacade;
private List<Products> products;
/** Creates a new instance of Product */
public Product() {
*products = productsFacade.findAll();*
public List<Products> getProducts() {
return products;
public void setProducts(List<Products> products) {
this.products = products;
An Error Occurred:
Cant instantiate class: myManagedBean.Product.
+- Stack Trace
com.sun.faces.mgbean.ManagedBeanCreationException: Cant instantiate class: myManagedBean.Product.
at com.sun.faces.mgbean.BeanBuilder.newBeanInstance(BeanBuilder.java:193)
Caused by: java.lang.NullPointerException
at myManagedBean.Product.<init>(Product.java:36)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at com.sun.faces.mgbean.BeanBuilder.newBeanInstance(BeanBuilder.java:188)This is just baffling. The OP 'created' an enterprise application, but doesn't know the basics of the basics that is null-references? That is like knowing how to do your taxes without knowing how to add and subtract.
-
Can't instantiate the backing bean
In, RAD, I created 2 Faces jsp files.
One file is a login file (Login.jsp) and the other one is just a simple place holder saying 'hi'.
Both had backing beans.(by default in RAD)
Both get displayed on the web browser when I ran it on the server.
But when I click the submit button, i get an error saying, "ApplicationIm E com.sun.faces.application.ApplicationImpl Can't instantiate class: 'pagecode.Login'."Do you have a public constructor in your BackingBean? (Not static nor private)
-
Can�t instantiate... why?
Why can�t I do something like this:
Class: User.java , this is my example model class, used with hibernate
public class User {
private String login;
// getters and setters
}Class: LoginBean.java, this is my ManagedBean
public class LoginBean {
private User user;
// getters and setters
}JSF: login.jsp , this is the jsp file that uses the UserBean class
<f:view>
<h:form>
Login: <h:inputText id="login" value="#{loginBean.user.login}"/>
</h:form>
</f:view>
...Doing this gives me an
javax.faces.FacesException: Can't instantiate class ....
I think that it might help a lot if we could do something like this....!Try keeping your managed bean in faces-confix.xml file
<managed-bean>
<managed-bean-name>loginUser</managed-bean-name>
<managed-bean-class>com.XXX.XXX.common.domain.LoginUser</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean> -
Can't load class problems migrating from PE 8.1 to PE 8.2
Hi. I'm in the process of migrating an application from an old server that runs PE 8.1_02 to a new server that runs PE 8.2.
The application is coded and built in Creator 2.0; the resulting .war file deploys alright into both servers, and operates correctly on the 8.1 server, but throws various "Can't load class" errors on my 8.2 server. One of them looks like this:
exception
javax.servlet.ServletException: Missing Class: Can't load class 'com.talentmap.talentexitadmintool.fields.TextBoxField'.
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
sun.reflect.GeneratedMethodAccessor157.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
java.security.AccessController.doPrivileged(Native Method)
com.sun.rave.web.ui.util.UploadFilter.doFilter(UploadFilter.java:194)
java.security.AccessController.doPrivileged(Native Method)
com.talentmap.talentexitadmintool.utils.security.SecurityCheckFilter.doFilter(SecurityCheckFilter.java:91)
root cause
javax.faces.FacesException: Missing Class: Can't load class 'com.talentmap.talentexitadmintool.fields.TextBoxField'.
com.sun.faces.util.TreeStructure.createComponent(TreeStructure.java:130)
com.sun.faces.application.StateManagerImpl.restoreComponentTreeStructure(StateManagerImpl.java:464)
com.sun.faces.application.StateManagerImpl.restoreComponentTreeStructure(StateManagerImpl.java:466)
com.sun.faces.application.StateManagerImpl.restoreComponentTreeStructure(StateManagerImpl.java:466)
com.sun.faces.application.StateManagerImpl.restoreComponentTreeStructure(StateManagerImpl.java:466)
com.sun.faces.application.StateManagerImpl.restoreComponentTreeStructure(StateManagerImpl.java:466)
com.sun.faces.application.StateManagerImpl.restoreComponentTreeStructure(StateManagerImpl.java:466)
com.sun.faces.application.StateManagerImpl.restoreComponentTreeStructure(StateManagerImpl.java:466)
com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:314)
com.sun.faces.application.ViewHandlerImpl.restoreView(ViewHandlerImpl.java:230)
com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.restoreView(ViewHandlerImpl.java:337)
com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:157)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:225)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:193)
sun.reflect.GeneratedMethodAccessor157.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
java.security.AccessController.doPrivileged(Native Method)
com.sun.rave.web.ui.util.UploadFilter.doFilter(UploadFilter.java:194)
java.security.AccessController.doPrivileged(Native Method)
com.talentmap.talentexitadmintool.utils.security.SecurityCheckFilter.doFilter(SecurityCheckFilter.java:91)
The class that is "missing" (TextBoxField) is very definitely there in the usual place under WEB-INF/classes. I can't figure out why it can't be loaded. The weird part is that a lot of the code still works, but these errrors have broken many of the major functions of our software.
On a hunch I realized that perhaps Creator 2.0 was using some 8.1 specific libraries to build, so I replaced the following libraries with versions found in my appserv tree:
activation.jar
appserv-jstl.jar
appserv-tags.jar
commons-logging.jar
j2ee.jar
jax-qname.jar
jaxr-api.jar
jaxr-impl.jar
jaxrpc-api.jar
jaxrpc-impl.jar
jsf-api.jar
jsf-impl.jar
mail.jar
saaj-api.jar
saaj-impl.jar
Rebuilding with those copied libraries made no difference.
Anyone know what could be causing this? Is there a workaround or fix? Do I need to update Creator with something? Should I revert to 8.1? Should I try moving to 9.0?I solve this problem by doing a remote deployment via creator2 remote deployment server.. first you must take care of JNDI stuff..
I hope this help.. give me feedback -
When I invoked New Project -> Oracle Service Bus Configuration Project wizard the following problem occurred:
The selected wizard could not be started.
Plug-in "com.bea.alsb.ui" was unable to instantiate class "com.bea.alsb.ui.wizards.NewALSBContainerWizard".
Google search found discussions that date back a year or so, but nothing helpfull.
Used Oracle generic installtion for 64 bit envirnment.
Here is the list of packages and version summary...
jre-6u27-windows-x64.exe
jrockit-jdk1.6.0_26-R28.1.4-4.0.1-windows-x64.exe
wls1035_generic.zip
oepe-helios-all-in-one-11.1.1.7.2.201103302044-win32-x86_64.zip
ofm_osb_generic_11.1.1.5.0_disk1_1of1.zip
OS
Microsoft® Windows Server® 2008 Enterprise
6.0.6002 Service Pack 2 Build 6002, x64-based PC
Java
JRE - Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
JDK - Oracle JRockit(R) (build R28.1.4-7-144370-1.6.0_26-20110617-2130-windows-x86_64, compiled mode)
Oracle 10.2.0
OFM 11g R1
WebLogic 10.3.5.0
OSB 11.1.1.5
OEPE 11.1.1.7.2.201103302044 (Eclipse Version: 3.6.2 Build id: M20110210-1200)OK, thanks. Cleared the log. Went through the steps: New Project -> OSB Configuration Project
Error notification pops up immediately: Problem Occured, Problem Opening Wizard, The selected wizard could not be started.
When I push the Details button I see the following text:
===
The selected wizard could not be started.
Plug-in "com.bea.alsb.ui" was unable to instantiate class "com.bea.alsb.ui.wizards.NewALSBContainerWizard".
com/bea/alsb/core/containers/exceptions/ContainerException
===
No messages are added to the error log.
(additional note)
I noticed several (7) errors associated with starting Eclipse up. So I deleted the log, restarted the app, and exported the startup errors. Can I attach the file to this thread?
Edited by: MichaelM on Dec 2, 2011 12:51 PM -
ERROR: Cannot instantiate class
I am getting the following error when I try and use the active-x bridge with VB and try to find the Context Factory.
"Cannot instantiate class: com.sun.jndi.fscontext.RefFSContextFactory"
The class it references is in the fscontext.jar file, from what I can tell the problem is that it can not find the class. The fscontext.jar file is in the classpath folder and the lib/ext folder.
The code works fine inside a java application, the code also works from VB using the JIntegra product.
Below is the code, any help would be greatly appreciated, thanks.
public class MessagingWrapperBean extends Object implements java.io.Serializable {
public MessagingWrapperBean() {
private Context ctx = null;
private String initialContextFactory = "com.sun.jndi.fscontext.RefFSContextFactory";
private String providerURL = "file:/C:/JNDI-Directory";
public int openSession() {
Hashtable env;
ctx = null;
try {
env = new Hashtable();
env.put(ctx.INITIAL_CONTEXT_FACTORY, initialContextFactory);
env.put(ctx.PROVIDER_URL, providerURL);
env.put(ctx.REFERRAL, "throw");
catch( Exception e ) {
return 999;
try {
ctx = new InitialDirContext( env ); // *** ERROR OCCURS HERE ***
catch( Exception e ) {
lastError = e.toString();
return 1001;I have to share this, because I stumbled with it myself for a while.
It has been answered before in thread:
http://forum.java.sun.com/thread.jsp?forum=40&thread=432365
The reason is braindead classloading mechanism when bridge is used.
But the solution is simple. Put the following
code before any JNDI actions:
if (Thread.currentThread().getContextClassLoader() == null){
Thread.currentThread().setContextClassLoader(
this.getClass().getClassLoader());
System.out.println("Contextclassloader was null!!! Now it is:" + this.getClass().getClassLoader().getClass().getName());
else {
System.out.println("Thread contextclassloader:" + Thread.currentThread().getContextClassLoader().getClass().getName());
}This sets context class loader to sun.misc.Launcher$ExtClassLoader
which can find classes from your lib/ext.
/Kullervo -
JNDI: Can't find Class com.sun.jndi.nis.NISCtxFactory
Hi
I searched this forum for similar problems .. and I also found some, but this questions were either not be answered or not detailed enough.
Now to my question. I've got a Java File that I imported to Oracle (I use it from PL/SQL). This Java File contains following code.
static Properties = System.getProperties();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.nis.NISCtxFactory");
env.put(Context.PROVIDER_URL, "nis://disney/geo.unizh.ch");
Context ctx = new InitialContext(env);
And if I run it from oracle(PL/SQL) I get the error below.
javax.naming.NoInitialContextException: Cannot instantiate class: com.sun.jndi.nis.NISCtxFactory. Root exception is java.lang.ClassNotFoundException: com/sun/jndi/nis/NISCtxFactory
at java.lang.Class.forName0(Class.java)
at java.lang.Class.forName(Class.java)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java)
at javax.naming.InitialContext.init(InitialContext.java)
at javax.naming.InitialContext.<init>(InitialContext.java)
at GIUZContext.getCtx(GIUZContext:42)
at CheckPwd.check(CheckPwd:18)
The nis.jar I imported with the loadjava, so actuallay should it be in the database. But why it cant find this class (NISCtxFactory)!
I get no error if I use this code ->
NISCtxFactory test = new NISCtxFactory();
System.out.println(test);
It would be very nice if you could give me some clues. TNX!!
Oracle Version 8.1.7.
CyrillHi Cyrill,
I don't know what other postings you have read, and I also don't
know why they were insufficient for you, so excuse me if I repeat
things you already know.
As far as I know, the error message you are getting is most probably
due to one of the following three causes:
1. The class is not loaded into the database.
2. The class is loaded but is not "valid".
3. You don't have permission to access the class.
To the best of my memory, there have been several posts to either
this forum or the "Products > Database > JVM" forum
http://forums.oracle.com/forums/forum.jsp?id=424322
that (in my opinion) sufficiently explain how to resolve the problem
for each of the three causes listed above.
Personally, I believe that the Oracle documentation sufficiently
explains how to resolve the above three issues, and I have posted
the URLs for the relevant Oracle documentation several times already.
I am guessing that you are trying to "talk" to an EJB (probably deployed
in SUN's application server) from a java stored procedure in the Oracle
database. If that is the case, then that question has been discussed
many times in this forum. Perhaps you can say why those discussions
were not sufficiently helpful for you.
Hope this helps.
Good Luck,
Avi. -
Can't find class org/apache/jk/apr/AprImpl
Hi
I have Tomcat 4.1.29 and Apache Web Server 2.0.48 installed.
I have used this tutorial since I'm a newbie :(
http://www.gregoire.org/howto/Apache2_Jk2_TC4.1.x_JSDK1.4.x.html
My problem is when I try to regroup them, I obtained this error error.log.
error] Can't find class org/apache/jk/apr/AprImpl
java.lang.NoClassDefFoundError: javax/management/MBeanRegistration
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Here is my confid file (workers.properties) :
[logger]
level=DEBUG
[config:]
#file=C:/Apache2/conf/workers2.properties
file=C:/Apache2/conf/workers2.properties
debug=0
debugEnv=0
[uriMap:]
info=Maps the requests. Options: debug
debug=0
# Alternate file logger
#[logger.file:0]
#level=DEBUG
#file=C:/Apache2/logs/jk2.log
[shm:]
info=Scoreboard. Required for reconfiguration and status with multiprocess servers
file=C:/Apache2/logs/jk2.shm
size=1000000
debug=0
disabled=0
[workerEnv:]
info=Global server options
timing=1
debug=0
# Default Native Logger (apache2 or win32 )
# can be overriden to a file logger, useful
# when tracing win32 related issues
#logger=logger.file:0
[lb:lb]
info=Default load balancer.
debug=0
#[lb:lb_1]
#info=A second load balancer.
#debug=0
[channel.socket:localhost:8009]
info=Ajp13 forwarding over socket
debug=0
tomcatId=localhost:8009
#[channel.socket:localhost:8019]
#info=A second tomcat instance.
#debug=0
#tomcatId=localhost:8019
#lb_factor=1
#group=lb
#group=lb_1
#disabled=0
#[channel.un:/opt/33/work/jk2.socket]
#info=A second channel connecting to localhost:8019 via unix socket
#tomcatId=localhost:8019
#lb_factor=1
#debug=0
[channel.jni:jni]
info=The jni channel, used if tomcat is started inprocess
[status:]
info=Status worker, displays runtime informations
[vm:]
info=Parameters used to load a JVM in the server process
#JVM=C:\jdk\jre\bin\hotspot\jvm.dll
OPT=-Djava.class.path=c:/Tomcat/bin/tomcat-jni.jar;c:/Tomcat/server/lib/commons-logging.jar
OPT=-Dtomcat.home=${TOMCAT_HOME}
OPT=-Dcatalina.home=${TOMCAT_HOME}
OPT=-Xmx128M
#OPT=-Djava.compiler=NONE
disabled=0
[worker.jni:onStartup]
info=Command to be executed by the VM on startup. This one will start tomcat.
class=org/apache/jk/apr/TomcatStarter
ARG=start
disabled=0
stdout=C:/Apache2/logs/stdout.log
stderr=C:/Apache2/logs/stderr.log
[worker.jni:onShutdown]
info=Command to be executed by the VM on shutdown. This one will stop tomcat.
class=org/apache/jk/apr/TomcatStarter
ARG=stop
disabled=0
[uri:/jkstatus/*]
info=Display status information and checks the config file for changes.
group=status:
#[uri:127.0.0.1:8003]
#info=Example virtual host. Make sure myVirtualHost is in /etc/hosts to test it
#alias=myVirtualHost:8003
#[uri:127.0.0.1:8003/ex]
#info=Example webapp in the virtual host. It'll go to lb_1 ( i.e. localhost:8019 )
#context=/ex
#group=lb_1
[uri:/examples]
info=Example webapp in the default context.
context=/examples
debug=0
#[uri:/examples1/*]
#info=A second webapp, this time going to the second tomcat only.
#group=lb_1
#debug=0
[uri:/examples/servlets/*]
info=Prefix mapping
[uri:/examples/*.jsp]
info=Extension mapping
[uri:/examples/*]
info=Map the whole webapp
[uri:/examples/servlets/HelloW]
info=Exampel with debug enabled.
debug=10
Thank you for your time !
MaxBtw: I get the warning starting IIS - It seems to me that IIS tries to load Tomcat on-the-fly. The Tomcat load the fails and IIS continues to load successfully.
The beginning of the IIS Event log outputs this:
Apache Jakarta Connector2, Information, Info: [jk_vm_default.c (340)]: vm.detach() ok
Apache Jakarta Connector2, Warning, Error: [jk_worker_jni.c (308)]: Can't find class org/apache/jk/apr/AprImpl
Apache Jakarta Connector2, Information, Info: [jk_worker_jni.c (297)]: Loaded org/apache/jk/apr/TomcatStarter
Apache Jakarta Connector2, None, Debug: [jk_vm_default.c (302)]: vm.attach() allready attached
Apache Jakarta Connector2, Information, Info: [jk_worker_jni.c (252)]: jni.validate() class= org/apache/jk/apr/TomcatStarter
Apache Jakarta Connector2, Information, Info: [jk_vm_default.c (607)]: vm.open2() done
Apache Jakarta Connector2, Information, Info: [jk_vm_default.c (500)]: vm.init(): Jni lib: C:\wwwapps\j2sdk1.4.2_01\jre\bin\client\jvm.dll
/watson -
Help! - JRE can't find classes that use inner classes!
Whenever I try to launch an app using the JRE, if the class was built with an inner class definition, the JRE says it can't find the class.
For instance:
I created a class called GUI, which contains anonymous inner class definitions for the button handlers: addActionListener(new ActionListener()){, etc.
When I compile this class I get GUI.class and GUI$1.class
When I try to launch this using the JRE:
jre -cp c:\progra~1\myApps GUI
The JRE spits out
'Class not found: GUI'
BUT if I go back and remove the action handlers so that the only compiled class file is GUI.class (not GUI$1.class) then the JRE can find the class no problem.
What in the good Lord's name is going on here?Thanks for the response. Got the 1.2.2 version of the JRE, where I guess you no longer invoke jre.exe (no such file exists) but java.exe instead (not well documented).
Also, the newer version of the JRE has no problems locating classes, so I guess I'm OK. -
Blank Alarm Problem - Can't get rid of them
Hi - first post. I'll dive right in. I have 2 alarms that open up when I start iCal. The problem is neither of them have any writing in them or any of the usual 3 buttons. The only option I have is to close the alarm using the red x in the top left. Of course, this means that every time I start up, the blank alarms come up. Any help would really be appreciated!
Austin,
I got a script error when I hit run. I decided to exercise the nuclear option. Problem is now fixed! Here is what I did:
1 - I exported my 3 calendars: personal, travel and babies (expecting twins in a month!).
2 - I created a new "temp" calendar and deleted the other 3. I quit and re-launched iCal app. No blank alarm... problem temporarily fixed!
3 - I re-imported personal calendar (personal.ics). I quit and re-launched iCal app. The blank alarm re-appeared.
4 - I went through every To Do item and did the following:
a - check "due date"
b - made sure "alarm" was set to "none"
c - unchecked "due date"
At least one "to do" event had an alarm set even though the "due date" had been unchecked. I probably set an alarm and then unchecked due date. I believe this may have caused a corruption somewhere.
5 - I quit and re-launched iCal app. No blank alarm.
6 - I re-imported my other two calendar files (travel.ics and babies.ics). I quit and re-launched iCal app. No blank alarm!
Clearly the corruption was in the "personal" calendar.
FWIW - here is the AppleScript Error I received when I ran the 2nd script you posted: "Can't make «class wr1s» of item 4 of every «class wret» of item 1 of every «class wres» of application "iCal" into type string."
Thanks again for your help. It spurred me to dig deeper.
Mark
Maybe you are looking for
-
After upgrade to 4.3.4 Calender and Notes are no longer synced
Hi everybody, after having updates to 4.3.4 this morning, my calender and notes are being ignored while synchronising. In either direction. What can I do? Thanks for any hint, cheers, Martin.
-
with ctrl alt shift to reset, i noticed this created problem with normal setup. things i noticed are that you can't open new file, it returns error message and you have to go to prefence and off open gl drawing to fix them. and other thing if the mas
-
My iTunes wont launch even though a correct administrator password is given Why?
It seems that every time iTunes gets updated I get problems with the launch of it. For instance, if I click on the task-bar icon, a request for an administrator password to allow Apple to do its thing on my hard drive comes up and I type it in and it
-
New mac mini -where's the print button?
I recently bought a mac mini and I don't know how to print with my Lexmark printer.
-
Why is my apple ID keep saying I need to verify it?
Every time I try to log in on my iTunes, it says I need to verify my Apple ID which I did my first time and now it keeps saying that.