Different results in eclipse and in browser

  • (5 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • Last »

69 Replies - 2838 Views - Last Post: 06 February 2013 - 04:52 AM Rate Topic: -----

#16 novakasss  Icon User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 352
  • Joined: 11-July 12

Re: Different results in eclipse and in browser

Posted 31 January 2013 - 07:14 AM

View Postg00se, on 30 January 2013 - 01:14 PM, said:

Yes, it's the same host.

Don't call start() from init() - the browser will call start automatically

Try it again after that change before changing the driver

When I deleted start() method from init() the page is blank grey page.
you can see it on the same link at my previous post.
Was This Post Helpful? 0
  • +
  • -

#17 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2694
  • View blog
  • Posts: 11,360
  • Joined: 20-September 08

Re: Different results in eclipse and in browser

Posted 31 January 2013 - 03:15 PM

Your problems is that your applet is not doing much at the moment. Please remind me by posting the applet source
Was This Post Helpful? 1
  • +
  • -

#18 novakasss  Icon User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 352
  • Joined: 11-July 12

Re: Different results in eclipse and in browser

Posted 01 February 2013 - 06:15 AM

View Postg00se, on 31 January 2013 - 03:15 PM, said:

Your problems is that your applet is not doing much at the moment. Please remind me by posting the applet source

package kurybinis;
import java.io.*;
import java.sql.*;

import javax.swing.*;
/*
 * Programos paleidimo klase. Paleidžia programą.
 */
public class Pagrindine extends JApplet{

	/*
	 * Kintamuju aprašymas
	 */
	private PrisijungimoLangas pl;
	private Connection con = null;
	private JFrame langas = null;
	
	/*
	 * Pagrindinis metodas. Sukuria klases "Pagrindine" objektą
	 */
	public static void main(String[] args){
		Pagrindine pgr = new Pagrindine();
		pgr.init();
	}
	
	/*
	 * JApplet paleidimo metodas.
	 */
	public void init(){
		try {
            SwingUtilities.invokeAndWait(new Runnable() {
                public void run() {
                	prisijungtiPrieBazes();
                	settings();
                }
            });
        } catch (Exception e) {
            System.err.println("createGUI didn't complete successfully");
            e.printStackTrace();
        }
	}
	
	/*
	 * Prisijungia prie duomenu bazes
	 */
	public void prisijungtiPrieBazes(){
		try{
			String drive = "com.mysql.jdbc.Driver";
			Class.forName(drive);
			String url = "jdbc:mysql://sportoviktorina.lt/sportovikt_db";
			String userName = "sportovikt_base"; 
			String password = "xxxxxxxx";
			con = DriverManager.getConnection(url, userName, password);
			System.out.println("Connected");
			
		}catch(Exception e){
			e.printStackTrace();
		}
	}
	
	/*
	 * Sukuria GUI objektą, grafiką. 
	 */
	public void settings(){
		langas = new JFrame();
		pl = new PrisijungimoLangas(con,langas,this);
		langas.getContentPane().add(pl);
		refresh();
    	setSize(600,600);
	}
	
	public void refresh(){
		setContentPane(langas.getContentPane());
	}

}

Was This Post Helpful? 0
  • +
  • -

#19 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2694
  • View blog
  • Posts: 11,360
  • Joined: 20-September 08

Re: Different results in eclipse and in browser

Posted 01 February 2013 - 10:30 AM

I don't know what you're expecting to see - you're not showing (setVisible) the frame you create ...
But your code isn't making much sense anyway - wjy are you intending to show a frame anyway and what is it meant to contain? Why are you not showing whatever it should contain in the applet itself?

This post has been edited by g00se: 01 February 2013 - 11:03 AM

Was This Post Helpful? 1
  • +
  • -

#20 novakasss  Icon User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 352
  • Joined: 11-July 12

Re: Different results in eclipse and in browser

Posted 01 February 2013 - 11:44 AM

View Postg00se, on 01 February 2013 - 10:30 AM, said:

I don't know what you're expecting to see - you're not showing (setVisible) the frame you create ...
But your code isn't making much sense anyway - wjy are you intending to show a frame anyway and what is it meant to contain? Why are you not showing whatever it should contain in the applet itself?


My program would be quite complex. It needs to have 4 Panels. Login panel, instructions panel, questionnaire panel and results panel. So I decided to use JFrame, then send that frame object and changing it's content after user presses button(for example).

If I add setVisible method, it creates another window, that is absolutely unneeded. In eclipse the program works good. Why in browser everything break?

Ok. Maybe I need first to fix that error, it doesn't let to even start program working. Because Driver is not registered( as the error says).

I recorded how program works in eclipse. You will see that window wich pops up when I add setVisible to the frame.
http://tinypic.com/p...hp?v=1imkjt&s=6

This post has been edited by novakasss: 01 February 2013 - 11:55 AM

Was This Post Helpful? 0
  • +
  • -

#21 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2694
  • View blog
  • Posts: 11,360
  • Joined: 20-September 08

Re: Different results in eclipse and in browser

Posted 01 February 2013 - 12:38 PM

Quote

I recorded how program works in eclipse. You will see that window wich pops up when I add setVisible to the frame.
Unfortunately, that's not very useful. What i need to see is what happens in the applet console.

If you want to see a 'work in progress', just do something like add a JLabel "Hello World" to the content pane after loading the driver and logging in to the db
Was This Post Helpful? 1
  • +
  • -

#22 novakasss  Icon User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 352
  • Joined: 11-July 12

Re: Different results in eclipse and in browser

Posted 01 February 2013 - 01:08 PM

View Postg00se, on 01 February 2013 - 12:38 PM, said:

Quote

I recorded how program works in eclipse. You will see that window wich pops up when I add setVisible to the frame.
Unfortunately, that's not very useful. What i need to see is what happens in the applet console.

If you want to see a 'work in progress', just do something like add a JLabel "Hello World" to the content pane after loading the driver and logging in to the db

I already showed you what is going on in the console. You told me to remove start() method call from init() I did that. Now you againa asking me same thing.
Was This Post Helpful? 0
  • +
  • -

#23 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2694
  • View blog
  • Posts: 11,360
  • Joined: 20-September 08

Re: Different results in eclipse and in browser

Posted 01 February 2013 - 03:24 PM

Quote

Now you againa asking me same thing.
No. I've made a suggestion of trying something new and minimal:

Quote

just do something like add a JLabel "Hello World" to the content pane after loading the driver and logging in to the db
Do that. If there are errors, show me what you see in the applet console
Was This Post Helpful? 1
  • +
  • -

#24 novakasss  Icon User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 352
  • Joined: 11-July 12

Re: Different results in eclipse and in browser

Posted 02 February 2013 - 05:26 AM

View Postg00se, on 01 February 2013 - 03:24 PM, said:

Quote

Now you againa asking me same thing.
No. I've made a suggestion of trying something new and minimal:

Quote

just do something like add a JLabel "Hello World" to the content pane after loading the driver and logging in to the db
Do that. If there are errors, show me what you see in the applet console

In oracle forum one man wrote this:
Caused by: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "file.encoding" "read")

No permissions. Sign the applet.


I'm using this tutorial:
http://wiki.processi.../Sign_an_Applet
But my command line can't recognize keytool, jarsigner commands. What should I do?

I also found something strange. If I change method, wich creates GUI part from settings() to start() and call that start() method from the init() GUI starts working.

This post has been edited by novakasss: 02 February 2013 - 05:32 AM

Was This Post Helpful? 0
  • +
  • -

#25 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2694
  • View blog
  • Posts: 11,360
  • Joined: 20-September 08

Re: Different results in eclipse and in browser

Posted 02 February 2013 - 06:15 AM

Quote

In oracle forum one man wrote this:

Not relevant in your case. You are not reading files. Please stick to the suggestions i make and post what i ask for
Was This Post Helpful? 1
  • +
  • -

#26 novakasss  Icon User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 352
  • Joined: 11-July 12

Re: Different results in eclipse and in browser

Posted 02 February 2013 - 07:25 AM

View Postg00se, on 02 February 2013 - 06:15 AM, said:

Quote

In oracle forum one man wrote this:

Not relevant in your case. You are not reading files. Please stick to the suggestions i make and post what i ask for

Today I updated java and now I can't access my applet in the browser. it asks me to install java, but I'm already done that...
Was This Post Helpful? 0
  • +
  • -

#27 novakasss  Icon User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 352
  • Joined: 11-July 12

Re: Different results in eclipse and in browser

Posted 03 February 2013 - 01:24 PM

Ok. So I added JLAbel with text "Hello" it should pop up when applet connects to the database. As I said before, inside eclipse everything works fine. When I add everything to the host. I get this error:
createGUI didn't complete successfully
java.lang.reflect.InvocationTargetException
	at java.awt.EventQueue.invokeAndWait(Unknown Source)
	at java.awt.EventQueue.invokeAndWait(Unknown Source)
	at javax.swing.SwingUtilities.invokeAndWait(Unknown Source)
	at kurybinis.Pagrindine.init(Pagrindine.java:25)
	at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter.init(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ExceptionInInitializerError
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:315)
	at java.sql.DriverManager.getConnection(Unknown Source)
	at java.sql.DriverManager.getConnection(Unknown Source)
	at kurybinis.Pagrindine.prisijungtiPrieBazes(Pagrindine.java:51)
	at kurybinis.Pagrindine$1.run(Pagrindine.java:27)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.awt.EventQueue.access$200(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$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.security.AccessControlException: access denied ("java.util.PropertyPermission" "file.encoding" "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.checkPropertyAccess(Unknown Source)
	at java.lang.System.getProperty(Unknown Source)
	at com.mysql.jdbc.StringUtils.<clinit>(StringUtils.java:70)
	... 19 more
java.lang.NullPointerException
	at kurybinis.PrisijungimoLangas.actionPerformed(PrisijungimoLangas.java:73)
	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$200(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$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)


Was This Post Helpful? 0
  • +
  • -

#28 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2694
  • View blog
  • Posts: 11,360
  • Joined: 20-September 08

Re: Different results in eclipse and in browser

Posted 04 February 2013 - 05:24 AM

The driver is trying to read a System property. It would normally need to be signed for this. In order to circumvent this, firstly log in to PhpMyAdmin again and execute the following

show create table sportovikt_base.FOO

where 'FOO' is the name of one of the tables in that db. Post the output here
Was This Post Helpful? 1
  • +
  • -

#29 novakasss  Icon User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 352
  • Joined: 11-July 12

Re: Different results in eclipse and in browser

Posted 04 February 2013 - 05:31 AM

View Postg00se, on 04 February 2013 - 05:24 AM, said:

The driver is trying to read a System property. It would normally need to be signed for this. In order to circumvent this, firstly log in to PhpMyAdmin again and execute the following

show create table sportovikt_base.FOO

where 'FOO' is the name of one of the tables in that db. Post the output here

Do I need to paste here what I get in phpmyadmin? Because I get only this " Sql query was successful".
Was This Post Helpful? 0
  • +
  • -

#30 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2694
  • View blog
  • Posts: 11,360
  • Joined: 20-September 08

Re: Different results in eclipse and in browser

Posted 04 February 2013 - 05:45 AM

Yes, you need to post the output of the query
Was This Post Helpful? 1
  • +
  • -

  • (5 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • Last »