Hare Shiva

Greenhorn
+ Follow
since Jul 08, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Hare Shiva

I have created an applet and it doesnot access any client files or resources.So in my understanding i donot need to sign it.I am going to host that applet along with my website.My problem is that whenever browser runs that applet at start up it ask for permission.I want the applet to run without such permission.Its a simple applet.How can i achieve it.I have seen other applets that runs automatically in my browser.I want to achieve same like that.Please any suggestion.
12 years ago
I have a table in which there is an attribute called SDate where i am storing Date.Now i need to select all rows from that table where the difference of current date and SDate is greater than 1 day.Please help me and also i think this problem is better solved if i add timestamp value.

select * from TeleQuery where DateDiff("d",SDate,Date())>1



If i use above query then rows with SDate 10/1/2012 doesnot get selected even though the difference between SDate and current Date 10/2/2012 is more than 1 day.Why is it not working?I am using access.

Paul Clapham wrote:

Hare Shiva wrote:I dont know how to see exception when applet runs in web browser.



You'll see a "Java" icon in your taskbar (I'm correct in assuming you're using Windows, right?). Double-click that and look in the Java console, that's where System.out and System.err go, along with errors which you don't catch.

I'm not looking at your code because if something works in Setup A but not in Setup B then it's probably something to do with the configuration and not the code.



Yes it did give exception.


Java Plug-in 1.6.0_25
Using JRE version 1.6.0_25-b06 Java HotSpot(TM) Client VM
User home directory = C:\Users\Computer
----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------


Check
Absolute path is C:\Users\Computer\Documents\31_free_buttons_psd_file_452.JPG
java.security.AccessControlException: access denied (java.io.FilePermission C:\Users\Computer\Documents\31_free_buttons_psd_file_452.JPG read)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkRead(Unknown Source)
at java.io.File.length(Unknown Source)
at sun.awt.shell.ShellFolder.length(Unknown Source)
at org.apache.http.entity.mime.content.FileBody.getContentLength(FileBody.java:114)
at org.apache.http.entity.mime.MultipartEntity.isRepeatable(MultipartEntity.java:138)
at org.apache.http.entity.mime.MultipartEntity.isChunked(MultipartEntity.java:146)
at org.apache.http.entity.HttpEntityWrapper.isChunked(HttpEntityWrapper.java:76)
at org.apache.http.protocol.RequestContent.process(RequestContent.java:106)
at org.apache.http.protocol.ImmutableHttpProcessor.process(ImmutableHttpProcessor.java:109)
at org.apache.http.protocol.HttpRequestExecutor.preProcess(HttpRequestExecutor.java:176)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:515)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:784)
at testing.Upload.executeMultiPartRequest(Upload.java:191)
at testing.Upload.UploadActionPerformed(Upload.java:221)
at testing.Upload.access$100(Upload.java:38)
at testing.Upload$2.actionPerformed(Upload.java:102)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)


What should i do? I signed my applet by
1.goint to webstart
2.enable web start
3.self signed by generated key

there is another option for signing but i dont know know how to use it.
12 years ago

Paul Clapham wrote:

Hare Shiva wrote:I dont know how to see exception when applet runs in web browser.



You'll see a "Java" icon in your taskbar (I'm correct in assuming you're using Windows, right?). Double-click that and look in the Java console, that's where System.out and System.err go, along with errors which you don't catch.

I'm not looking at your code because if something works in Setup A but not in Setup B then it's probably something to do with the configuration and not the code.



Yes it did give exception.


Java Plug-in 1.6.0_25
Using JRE version 1.6.0_25-b06 Java HotSpot(TM) Client VM
User home directory = C:\Users\Computer
----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------


Check
Absolute path is C:\Users\Computer\Documents\31_free_buttons_psd_file_452.JPG
java.security.AccessControlException: access denied (java.io.FilePermission C:\Users\Computer\Documents\31_free_buttons_psd_file_452.JPG read)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkRead(Unknown Source)
at java.io.File.length(Unknown Source)
at sun.awt.shell.ShellFolder.length(Unknown Source)
at org.apache.http.entity.mime.content.FileBody.getContentLength(FileBody.java:114)
at org.apache.http.entity.mime.MultipartEntity.isRepeatable(MultipartEntity.java:138)
at org.apache.http.entity.mime.MultipartEntity.isChunked(MultipartEntity.java:146)
at org.apache.http.entity.HttpEntityWrapper.isChunked(HttpEntityWrapper.java:76)
at org.apache.http.protocol.RequestContent.process(RequestContent.java:106)
at org.apache.http.protocol.ImmutableHttpProcessor.process(ImmutableHttpProcessor.java:109)
at org.apache.http.protocol.HttpRequestExecutor.preProcess(HttpRequestExecutor.java:176)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:515)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:784)
at testing.Upload.executeMultiPartRequest(Upload.java:191)
at testing.Upload.UploadActionPerformed(Upload.java:221)
at testing.Upload.access$100(Upload.java:38)
at testing.Upload$2.actionPerformed(Upload.java:102)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)


What should i do? I signed my applet by
1.goint to webstart
2.enable web start
3.self signed by generated key

there is another option for signing but i dont know know how to use it.
12 years ago

Paul Clapham wrote:I suppose it might help if you stopped using the invalid URL "http://localhost:8080//test//Uploader" and corrected it to "http://localhost:8080/test/Uploader", but I suspect that isn't your problem.

However I don't know what your problem is. You didn't say whether any exceptions were being thrown -- so tell us that. And you said your servlet wasn't being run, but you didn't say whether the applet was even connecting to the servlet -- so tell us that. It's no use telling us what should have happened -- tell us what actually happened instead.



I get no exception when running from applet viewer.Applet that is in separate netbeans project can send file to servlet that is in another web project.But the same don't happen when running applet from web page.I dont think there is any problem with code because if there were any than it shouldnot have worked in applet viewer too,isnt it? And yes i corrected my url but still there is the same problem.I dont know how to see exception when applet runs in web browser.My applet shows up in browser and i can even select file but than nothing happens . The file is not sent to servlet and it shows no error too.How do i check what exception occur because netbeans shows none when applet is running in browser? I am exploring other possibilities of sending file through applet because i need it soon for my academic project.If you could look upon check this code please to find any error i would be very thankful.
12 years ago
i have following applet code that i found in internet and modified as required




and the servlet part




i receive 0 bytes in servlet.Anyone please help me.

12 years ago

Andrew Thompson wrote:Are you the same person that asked this question on SO?



Yes.If you have any suggestion then please help me.How can my applet connect to servlet.The applet works fine in applet viewer and send files to servlet.But cannot send file to servlet when used in browser.I printed test statements in servlet but neither of them shows so it means applet couldnot connect to that servlet.Should i do anything else.i using netbeans and i did following steps

1.Created a applet as separate project.
2.Build it and pasted in location of my jsp pages.
3.All jar files used by the applet have been written in archive.

What else should be done.Please help.
12 years ago

Paul Clapham wrote:

Hare Shiva wrote:in jsp portion i wrote this code


i m using netbeans so i build that applet project and pasted it in my web page.Other applet project i did worked in the same way.Do you know any other method of sending image.If then please post codes.I m beginner in java and i really need to complete it soon.



And now we can all see that the "archive" attribute does not mention the jar which contains Apache HttpClient. So fix that. Make sure that the jar is in your web application, preferably in the same folder as the apptesting.jar, so that it can be downloaded to the client.

And no, we don't post code here. Read our FAQ entry DoYourOwnHomework which explains why we don't do that.




Thanks a lot for your help.Now my applet runs in the browser but it cannot connect to servlet as it did when running in applet viewer.My servlet is in Project test, in "servlet" package.So can i use servlet url as"http://localhost:8080//test//Uploader".Please be patient with me. I am new to java and i am a student.
12 years ago

Paul Clapham wrote:You do have to specify the applet's classpath (via the "archive" attribute of the <applet> tag, I think). Presumably you set up the classpath in Netbeans, now you have to do that for your HTML as well.



in jsp portion i wrote this code


i m using netbeans so i build that applet project and pasted it in my web page.Other applet project i did worked in the same way.Do you know any other method of sending image.If then please post codes.I m beginner in java and i really need to complete it soon.
12 years ago
i am constructing an applet that upload multiple files and sends it to servlet for storage..Following is my applet code






I am using netbeans and in applet viewer it works fine.But when i use it in jsp page,it gives me following errors

/**************************************************/

Java Plug-in 1.6.0_25
Using JRE version 1.6.0_25-b06 Java HotSpot(TM) Client VM
User home directory = C:\Users\Computer
----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------


java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.http.client.HttpClient
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 20 more
Exception: java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient

/******************************************************************************/

i added jar file of applet in my web project.Please guys help me..if there is any other way to upload images than please post be the codes.Its urgent.
12 years ago
thanks a lot...all i had to do was clear alldata..its working now.
12 years ago
JSP
i am new to servlet and jsp..I retrieve values from database and set it in a arraylist of bean in servlet.That arraylist of bean is later displayed in jsp page...But after at second run of servlet duplicate values get printed in jsp..Guys help me....

12 years ago
JSP