Lalita Sattavat

Greenhorn
+ Follow
since May 31, 2004
Merit badge: grant badges
For More
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
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Lalita Sattavat

Packaging stems from the idea of distributing the application. When ejb classes are packaged in a separate jar and other application classes into a separate jar, its done only for easy of distribution. You could have all your ejb's deployed on an enterprise application server whereas Web-app on a web-server. In such a situation you need to place only those classes on the application server that the ejb's shall utilise. Ideally all the classes referenced by the ejb's are packaged into the ejb-jar and others into a separate one since in most web-applications they are used by the web-component. Hence the differniation in packaging. And as far as the the services of the container is concerned, if a class say DAO is being accesses by the ejb, the class by itself does not have the priviledges that an ejb has, however depending upon how the class behaves under various conditions(exceptions, etc) the container shall handle then since its the ejb thats calling the simple DAO class and the ejb is still active.
i hope that answers ur question
Do correct me if am wrong
as the stack trace clearly mentions .. it cant find ur jar in the library path. Ensure that you have your jar placed in the classpath. if u change the system classpath then u might have to restart ur app server(in case u are using one). If u are using an app server also ensure that u have deleted all the cases created by it.

Also if the jar belongs to java standard lib then ensure that jdk is in your path.
[ May 31, 2004: Message edited by: Lalita Sattavat ]
19 years ago
set ur classpath to current directory. which means execute the following on the command prompt

set CLASSPATH=.;%CLASSPATH%;

note: use ';' if ur working on windows and ':' if ur working on linux

now it should work fine
19 years ago
since you are trying to lookup for the value defined in the session bean, try using the entitycontext rather than the initial context. check now if u get that value
there are two things that u are trying to find as per my understanding
1. PRIVIDER_URL:
2. how-to lookup:

now both of these should be configurable and should not be hardcoded in the application so that tomorrow if u change the url/lookup location of ur file u do not have to re-compile ur code.

both the things can be done using environment entries. These entries are to be provided in the web.xml for the web application.
eg. add the following in your web.xml after taglib entries(if u have any)

<env-entry>
<env-entry-name>Provider_url</env-entry-name>
<env-entry-value>t3://localhost:7001</env-entry-value>;
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>

<env-entry>
<env-entry-name>file_location</env-entry-name>
<env-entry-value>C:\xfz\myfile.xls</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>

And now read these values as
Context context=new InitialContext();
Strinf fl = (String) context.lookup("java:comp/env/file_location");
String url= (String) context.lookup("java:comp/env/Provider_url");

Note: PROVIDER_URL -> Its the location where your JNDI service is running. In case of weblogic the service runs on the same port where the server is started. In case of other app servers find out where the t3 service is running and the value for provider url should be accordingly set.

Let me know ur concerns if any
on the command prompt execute following:

set CLASSPATH=C:\xyz;

Note: CLASSPATH is in Caps. Also if u are working on windows env then use ';' as the separator else if its unix/linux machines use ':'
19 years ago
http://www.tech.purdue.edu/cpt/courses/cpt475/Calendar
Goto week12
there you will find a PPT on jsp ... Good one

Also do check the java.sun.com for tutorials in case u need some reliable stuff.
19 years ago
JSP
line 31 should be
sqltext="insert into AllIn (Name, Adnno, Class, Section, Date, Adnfee) values ('"+s1+"','"+s2+"','"+s3+"','"+s4+"','"+s5+"','"+s6+"' )";
does that database support blob. what i mean is are you going to store that file in the db as a blob ? if yes then the code goes this way:

MultipartParser mp = null;
Connection con=//Write the code to get java.sql.Connection object
Statement st=null;

try {
mp = new MultipartParser(request, 10*1024*1024); // 10MB
}
catch (IOException ex) {
throw new UploadException("Error initializing multi-part parser",ex);
}
st = con.createStatement();
st.executeUpdate("insert into " + tableName + " (" +
primaryKeyFieldName
+ "," + blobFieldName + ") values (" + primaryFieldValue
+ ",EMPTY_BLOB() ) ");
/*the table where you blob data will recide. Insert an empty blob. The function EMPTY_BLOB() is provided by the Oracle Database itself. Check out if u have this feature in ur db
*/
rs = st.executeQuery("select " + blobFieldName + " from "
+ tableName + " where "
+ primaryKeyFieldName + " = "
+ primaryFieldValue + " FOR UPDATE ");
if (!rs.next()) {
throw new BlobInsertException("Unable to insert record with PrimaryKey " + primaryFieldValue);
}
Object o = rs.getBlob(1);
OutputStream os = ((weblogic.jdbc.common.OracleBlob) o).getBinaryOutputStream();
byte buffer[] = new byte[8192];

int size = 0;
int nread = 0;
//here input stream is from the the file
while ((nread = inputStream.read(buffer)) != -1) {
os.write(buffer, 0, nread);
size += nread;
}
os.flush();
os.close();
inputStream.close();

}
catch (SQLException ex) {
throw new BlobInsertException("Some database problem",ex);
}
catch (IOException ex) {
throw new BlobInsertException("Some problem in data streams",ex);
}
finally {
try {
if(rs != null) rs.close();
if(st != null) st.close();
}
catch (Exception ex) { }
}

let me know if u face any problems
19 years ago
JSP
The App server in use in Weblogic 8.1 and we encounter the following problem: After performing few activities on the server .. wait for 20 seconds and now click on any link on the jsp. All the request parameters are null. else otherwise the application works fine. Also the same behavior is not reproduceable on Weblogic 7.2

After disabling the keepalives for http in the weblogic server the problem got fixed.

Can somebody explain why this behavior. What is it that keepAlives does internally?
19 years ago