Vinodh Sa

Ranch Hand
+ Follow
since May 06, 2010
INDIA
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
12
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Vinodh Sa

Hi All,

I m very new to EJB. Need your help in solving this basic problem which i m getting while creating the EJB Service jar.

I have created three necessary EJB classes (Remote Interface, Home Interface and EJB Implementation class) and bundled them in a jar along with "ejb-jar.xml" and "weblogic-ejb-jar.xml"

Now the problem i m facing is while running the below command frm cmd prompt.

"java -cp jars\ejb.jar;jars\weblogic.jar weblogic.appc jars\converting.jar"

Exception :

<Feb 20, 2012 4:02:45 PM IST> <Error> <J2EE> <BEA-160187> <weblogic.appc failed to compile your application. Recompile with the -verbose option for more details. Please see the error message(s) below.> com/bea/xml/XmlException




As far as i have googled, it seems to be a problem with the version in xml and the version of the jar that i m using while compilation/execution

My ejb-jar.xml


My weblogic-ejb-jar.xml


The Manifest.MF file of the ejb.jar that i am using


The Manifest.MF file of the weblogic.jar that i am using



Can any one help me out in this ???
By application scope, i meant the ServletContext object.
7 years ago
ya.... where was my mind ???

any how, Thanks Tim.



One more thing, should i maintain this byte[] by myself in the application scope or any other way of implementation is there (like server side caching) for doing this ???
7 years ago
Tim,
Long long ago Somewhere i have read that putting a image outside of a WAR/EAR is not a good idea, that too when the image is a frequently used one.

And, Yes, this image in my requirement is a frequently used one, its almost in the home page of our site.

So, how exactly do i do the caching? i dont want to hit the physical location every time, since the image is a frequently used one.

For the very first hit after deploying, i want to pick the image from the server and then cache it for further hits. I dont want to hit the physical location outside of the server for every request.

Can you help me out here with exactly how to do the caching ???
7 years ago
Thanks William and Bear for your replies.

Bear,
The problem here is that this particular image will keep on changing, so i dont want to bundle it with the WAR or EAR. Since that will need a deployment every time the image changes based on user requirements. so i thought of to put the image a physical location in the server outside of the WAR/EAR and pick it up from there.
But every time that particular page (in which yhat image is used) loads the physical location at that server will be hit and the image file will be picked. In order to avoid this i thought that i might get the file stream from the physical location only for the first request and then will add it to application scope and for every further request i will pick it up from the application scope stream object.
But as William pointed out a Stream once read cant be read back again. So, Is there any other way of doing this ?

P.S. If i achieve this it will save a hell lot of time for our team which is involved in unnecessary deployments just for a single image change.
7 years ago
Hi Bibeault,

Thanks for your reply. Is there any partcular basic reason that why it cant be done ?
7 years ago
and also thers no point in doing this new String while storing it into "idmarca"
instead of idmarca = new String(rid); use like idmarca = rid

and in this case there is literally no point in adding that null check.
instead you can store diretly rid into idmarca and make use of null check in set string method call while calling DB.

Dude, you gotta get strong in your java basics first, till then no one can help you.
7 years ago
First of all you have to make a null check for any variable before using and dont declare the string declaration inside that if null check block
not as below

instead do as below

7 years ago
that means you have added the code like this


am i right ? and also as mentioned by Matthew, i dont see any point in your above code. Why not use the rid variable directly instead of creating another reference for the same String object.

And use in your set String code as below
7 years ago
hi,

I guess its pretty simple. You are getting the request parameter from the first line i.e. "String rid = request.getParameter("rid");"

And without checking it for null you are making another String variable "String idmarca = new String(rid);"

Its equivalent to the below line, which will obviously give you a compilation error
"String idmarca = new String(null);"

Add a null check to the variable "rid" before using it to store in another variable.

Hope that helps !!!
7 years ago
Hi All,

I have a query here. Actually my requirement here is to fetch a image file from a physical location outside of a WAR file and show it in the jsp. the problem here is that the image will change frequently based on business policy changes. So what i thought was to write a servlet and bind it to the src attribute of the img tag (as below).



Servlet Code :


First time the image is coming fine, but second time when the inputstream is retrieved from application scope i.e. Servlet Context object, i m getting IO exception
"java.io.IOException: The handle is invalid"

Can any one help me here ? First of all my approach is correct or not. If not, is there any other easy and better way to do this ?
I went with this approach just because that this particular image will change frequently, and i dont want to deploy the entire WAR every time.

Thanks in advance.
7 years ago
hi,

can you tell us that which is line number 126 in your UploadServlet.java class ?
7 years ago
Hi ,

Which technology or framework you are usng ???
7 years ago
did the same seetharaman.... but its not working...

- if i dont add "immediate=true" for the reset button then, the jsf validation is getting fired.

- if i add "immediate=true", then the reset value i.e. null, which i did in the reset() is not reflecting in the jsp....
7 years ago
JSF
no Seetharaman... i want the values to be reset to null... but its still having the old value.... BTW i made the question a little bit confusing :-D
7 years ago
JSF