Hi,
i am newbie to struts/jsp/java..
here is server.log snippet...
18:01:51,442 ERROR [Engine] ApplicationDispatcher[/action] Servlet.service() for servlet jsp threw exception
java.lang.NoSuchMethodError: app.database.DoctorDAO.getDoctorNameFromHosId(I)Ljava/util/ArrayList;
at app.tag.UserDoctorsComboboxTag.getDoctors(UserDoctorsComboboxTag.java:32)
at app.tag.UserDoctorsComboboxTag.doStartTag(UserDoctorsComboboxTag.java:53)
at org.apache.jsp.pages.layouts.tiles.body.DoctorSelect_jsp._jspService(DoctorSelect_jsp.java:228)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:703)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:589)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966)
at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:581)
at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:101)
***********
public class DoctorDAO {
private Connection connection=null;
private PreparedStatement preparedStatement=null;
public DoctorDAO(){
}
public ArrayList getDoctorNameUsingHosId(int hosId)
{
preparedStatement = null;
connection = null;
ArrayList results = new ArrayList();
try{
ApplicationDataSource ads = new ApplicationDataSource(Constants.DATA_SOURCE_NAME);
connection = ads.getConnection();
String getSql = "select doc_name from doc " +
"where hos_id= " + hosId + ")";
preparedStatement = connection.prepareStatement(getSql);
ResultSet rowSet = preparedStatement.executeQuery(getSql);
while(rowSet.next())
{
results.add(rowSet.getString(1));
}
// Close the wrappers.
closeDatasourceWrappers();
}
catch (SQLException e) {
System.err.println("Error occurred: " + e);
}
finally {
// Close the wrappers.
closeDatasourceWrappers();
}
return results;
}
}
************
public class UserDoctorsComboboxTag extends TagSupport
{
private boolean validUser = false;
private String doctorName = null;
private String userId = null;
public ArrayList getDoctors( int hosId ) {
return new DoctorDAO().getDoctorNameUsingHosId(hosId);
}
public int getUserHospitalId( String userId ) {
UserDAO userDao = new UserDAO();
return userDao.getHosId( userId );
}
public final int doStartTag() throws JspException
{
ArrayList doctorsArray;
int hospitalId = getUserHospitalId( userId );
doctorsArray = getDoctors(hospitalId);
StringBuffer userDoctorsCombobox = new StringBuffer()
.append( "<select name=docName>" );
for( int i=0; i<doctorsArray.size(); i++ ) {
String docName1 = (String)doctorsArray.get(i);
userDoctorsCombobox
.append( "<option value=" )
.append( docName1 )
.append( ">" )
.append( "</option>" );
}
userDoctorsCombobox.append("</select>");
try {
pageContext.getOut().print( userDoctorsCombobox.toString() );
}
catch (IOException e) {
e.printStackTrace();
}
return SKIP_BODY;
}
}
*********
i am using jboss3.2.5 along with tomcat-5.0.26 and jdk1.5.0_01..
buid ear file through Ant builder and deploy it on jboss server.
pl. guide me..
Thanks in advanced,
ketan
i am newbie to struts/jsp/java..
here is server.log snippet...
18:01:51,442 ERROR [Engine] ApplicationDispatcher[/action] Servlet.service() for servlet jsp threw exception
java.lang.NoSuchMethodError: app.database.DoctorDAO.getDoctorNameFromHosId(I)Ljava/util/ArrayList;
at app.tag.UserDoctorsComboboxTag.getDoctors(UserDoctorsComboboxTag.java:32)
at app.tag.UserDoctorsComboboxTag.doStartTag(UserDoctorsComboboxTag.java:53)
at org.apache.jsp.pages.layouts.tiles.body.DoctorSelect_jsp._jspService(DoctorSelect_jsp.java:228)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:703)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:589)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966)
at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:581)
at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:101)
***********
public class DoctorDAO {
private Connection connection=null;
private PreparedStatement preparedStatement=null;
public DoctorDAO(){
}
public ArrayList getDoctorNameUsingHosId(int hosId)
{
preparedStatement = null;
connection = null;
ArrayList results = new ArrayList();
try{
ApplicationDataSource ads = new ApplicationDataSource(Constants.DATA_SOURCE_NAME);
connection = ads.getConnection();
String getSql = "select doc_name from doc " +
"where hos_id= " + hosId + ")";
preparedStatement = connection.prepareStatement(getSql);
ResultSet rowSet = preparedStatement.executeQuery(getSql);
while(rowSet.next())
{
results.add(rowSet.getString(1));
}
// Close the wrappers.
closeDatasourceWrappers();
}
catch (SQLException e) {
System.err.println("Error occurred: " + e);
}
finally {
// Close the wrappers.
closeDatasourceWrappers();
}
return results;
}
}
************
public class UserDoctorsComboboxTag extends TagSupport
{
private boolean validUser = false;
private String doctorName = null;
private String userId = null;
public ArrayList getDoctors( int hosId ) {
return new DoctorDAO().getDoctorNameUsingHosId(hosId);
}
public int getUserHospitalId( String userId ) {
UserDAO userDao = new UserDAO();
return userDao.getHosId( userId );
}
public final int doStartTag() throws JspException
{
ArrayList doctorsArray;
int hospitalId = getUserHospitalId( userId );
doctorsArray = getDoctors(hospitalId);
StringBuffer userDoctorsCombobox = new StringBuffer()
.append( "<select name=docName>" );
for( int i=0; i<doctorsArray.size(); i++ ) {
String docName1 = (String)doctorsArray.get(i);
userDoctorsCombobox
.append( "<option value=" )
.append( docName1 )
.append( ">" )
.append( "</option>" );
}
userDoctorsCombobox.append("</select>");
try {
pageContext.getOut().print( userDoctorsCombobox.toString() );
}
catch (IOException e) {
e.printStackTrace();
}
return SKIP_BODY;
}
}
*********
i am using jboss3.2.5 along with tomcat-5.0.26 and jdk1.5.0_01..
buid ear file through Ant builder and deploy it on jboss server.
pl. guide me..
Thanks in advanced,
ketan