sanjoy sa

Greenhorn
+ Follow
since Aug 19, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by sanjoy sa


Thank You for your suggestions for using code tags. It is really useful.
Now let me show my problem in details:

My web.xml






---------------
My DBContextListener Class:-
--------------




=====
DB Bean class
-------------


====
DBListener where I access the bean object. I tested the out put here which is correct.
-------------------------



===========


POJO Class where I want to access the bean object for further processing.
//db will be the object of the DB class.jdbc and odbc i will define here.
------------------------

7 years ago
Thanks Bibeault for your instant response. I will give you the details what I actually want to do:-

My web.xml

---------------
My DBContextListener Class:-
--------------

=====
DB Bean class
-------------

===
====
DBListener where I access the bean object. I tested the out put here which is correct.
-------------------------



===========


POJO Class where I want to access the bean object for further processing.
//db will be the object of the DB class.jdbc and odbc i will define here.
------------------------



}
7 years ago
I put database details such as sid, user, pswd etc as context param. I called the same in a servlet using listener and put them in a bean object. Now i want to call the object in a pojo to make connection
7 years ago
How to access a bean object from a servlet into a plain java class.
7 years ago
Thanks David. Where exactly I will get the interceptors in the library
7 years ago
I put database details such as sid,user,password as context parameter. i called the same in servletcontext through listener and put them in a bean class. how i will access the bean object in normal pojo class.
while using interceptors in struts 2 I got the following error. I used myeclipse8.5 IDE. Please advice


Aug 19, 2010 5:29:54 PM com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
SEVERE: Dispatcher initialization failed
Caused by: Unable to find interceptor class referenced by ref-name model-driven - interceptor-ref - file:/D:/saaj/.metadata/.me_tcat/webapps/Struts2Application/WEB-INF/classes/struts.xml:49:43
at com.opensymphony.xwork2.config.providers.InterceptorBuilder.constructInterceptorReference(InterceptorBuilder.java:52)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.lookupInterceptorReference(XmlConfigurationProvider.java:987)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.buildInterceptorList(XmlConfigurationProvider.java:539)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:370)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:468)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:264)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:193)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
... 18 more
SEVERE: Exception starting filter struts2
Unable to load configuration. - interceptor-ref - file:/D:/saaj/.metadata/.me_tcat/webapps/Struts2Application/WEB-INF/classes/struts.xml:49:43
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:431)
.
.
.
.


My struts.xml is as follows

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"
"http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<include file="struts-default.xml"></include>
<package name="default" extends="struts-default">
<global-exception-mappings>
<exception-mapping exception="java.lang.Exception"
result="exception" />
</global-exception-mappings>

<action name="modelAction" class="com.kogent.action.ModelAction">
<interceptor-ref name="exception" />
<interceptor-ref name="prepare" />
<interceptor-ref name="debugging" />
<interceptor-ref name="model-driven" />
<interceptor-ref name="params" />
<interceptor-ref name="conversionError" />
<interceptor-ref name="workflow" />
<result name="success">/student_info.jsp</result>
<result name="error">/model.jsp</result>
<result name="exception">/exception.jsp</result>
<result name="input">/model.jsp</result>
</action>
</package>
</struts>



My web.xml is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>


My ModelAction.java is as follows


package com.kogent.action;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.opensymphony.xwork2.Preparable;

public class ModelAction extends ActionSupport implements ModelDriven, Preparable {

private Student student;


public void prepare(){
student=new Student();
}
public Object getModel(){
return student;
}
public String execute() throws Exception {

if(student.getPassword().length()>=6)
return SUCCESS;
else{
this.addActionError(getText("app.invalid.password.length"));
return ERROR;
}
7 years ago
thanks for prompt reply. path shows as follows:c:\program files\oracle\jre\1.3.1\bin;c:\program files\oracle\jre\1.1.8\bin;c:\program files\java\jre\1.6.0_01\bin;c:\program files\java\jre\1.6.0_01\lib; etc..etc.. i think it is picking up oracle jre .what to do?
I install jdk-6-windows-i586.exe on my pc.oracle 9i was lso loaded. but java version shows 1.3.1_01. I also set system varriables(JAVA_HOME) as C:\Program Files\Java\jdk1.6.0_01. Why the version is not showing 1.6. Please advice.