UseBean Error

Hi,

I am developing a online price comparison tool in NetBeans 5.0 with Java 1.4.2_11and I am getting a few errors which I don't get when I run exactly the same code in JDeveloper 10.1.2.1.0. When I try to run the

index.jsp page I get the following error:

Created dir: C:\Documents and Settings\Colin\Desktop\PriceFinder\PriceFinder-war\build\generated\src

org.apache.jasper.JasperException: The value for the useBean class attribute List.CartBean is invalid.

C:/Documents and Settings/Colin/Desktop/PriceFinder/PriceFinder-war/build/web/index.jsp(28,4)

C:\Documents and Settings\Colin\Desktop\PriceFinder\PriceFinder-war\nbproject\build-impl.xml:342: Java returned: 1

BUILD FAILED (total time: 1 second)

This is the line that it fails on in the index.jsp page:

<jsp:useBean id="list" class="List.CartBean" scope="session"/>

This is the line that it fails on in the build-impl.xml file:

<java failonerror="true" fork="true" classname="org.netbeans.modules.web.project.ant.JspCSingle">

Also when I run the project as a whole I get this error but I guess that this is down to the previous error:

run-display-browser:

Browsing: ${client.url}

C:\Documents and Settings\Colin\Desktop\PriceFinder\nbproject\build-impl.xml:225: java.net.MalformedURLException: no protocol: ${client.url}

BUILD FAILED (total time: 4 seconds)

This is the line that it fails on in the build-impl.xml file

<nbbrowse url="${client.url}"/>

This is my CartBean:

package List;

import javax.ejb.*;

import java.util.Vector;

/**

* This is the bean class for the CartBean enterprise bean.

* Created 03-Apr-2006 16:49:52

* @author Colin

*/

publicclass CartBeanimplements SessionBean, CartRemoteBusiness, CartLocalBusiness{

private SessionContext context;

private Vector contents =new Vector();

privateint max = 10;

// <editor-fold defaultstate="collapsed" desc="EJB infrastructure methods. Click the + sign on the left to edit the code.">

// TODO Add code to acquire and use other enterprise resources (DataSource, JMS, enterprise bean, Web services)

// TODO Add business methods or web service operations

/**

* @see javax.ejb.SessionBean#setSessionContext(javax.ejb.SessionContext)

*/

publicvoid setSessionContext(SessionContext aContext){

context = aContext;

}

/**

* @see javax.ejb.SessionBean#ejbActivate()

*/

publicvoid ejbActivate(){

}

/**

* @see javax.ejb.SessionBean#ejbPassivate()

*/

publicvoid ejbPassivate(){

}

/**

* @see javax.ejb.SessionBean#ejbRemove()

*/

publicvoid ejbRemove(){

}

// </editor-fold>

/**

* See section 7.10.3 of the EJB 2.0 specification

* See section 7.11.3 of the EJB 2.1 specification

*/

public CartBean(){}

publicvoid ejbCreate(){

// TODO implement ejbCreate if necessary, acquire resources

// This method has access to the JNDI context so resource aquisition

// spanning all methods can be performed here such as home interfaces

// and data sources.

}

publicvoid addItem(Integer itemID){

if(getItemCount() < max){

contents.add(itemID);

}

}

publicvoid removeItem(Integer itemID)throws ItemException{

while(getQty(itemID) != 0){

contents.remove(itemID);

}

}

publicint getQty(Integer itemID){

int intCounter = 0;

for(int i = 0; i<contents.size(); i++){

if(contents.get(i).equals(itemID)){

intCounter = intCounter + 1;

}

}

return intCounter;

}

publicvoid reduceQty(Integer itemID){

if(getQty(itemID)==1){

try{

removeItem(itemID);

}

catch (Exception ex){

System.out.println(ex.getMessage());

}

}

else{

for(int i = 0; i><contents.size(); i++){

if(contents.get(i).equals(itemID)){

contents.removeElementAt(i);

break;

}

}

}

}

public Vector getContents(){

return contents;

}

publicint getItemCount(){

if (contents ==null){

return 0;

}

else{

return contents.size();

}

}

publicint getItemCountRemain(){

if (contents ==null){

return max;

}

else{

return max - contents.size();

}

}

Any help would be most grateful. Thank you.>

[8738 byte] By [CPB123a] at [2007-10-2 16:49:14]
# 1
Let's get this straight - you are instantiating an ejb through a useBean tag. I hope you are not expecting the bean's ejb behaviour to work, do you? Its just a normal java class.ram.
Madathil_Prasada at 2007-7-13 18:00:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...