Terence Gronowski

Ranch Hand
+ Follow
since Dec 19, 2007
Merit badge: grant badges
For More
8606 Nänikon
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 Terence Gronowski

I want to paint a big amount of data in a thread with some delay in betwenn. I want to be able to stop and start the painting. As using graphics you have to draw with the paint() method. The examples I saw used a repaint() mehtod in the run method of the tread. It should be possible too, to enter Values while painting is on the way.

This is a very unfavorable way to program that problem using the repaint() method. Each time repaint() is called in run() paint() should draw just a part of the data, which is very hard to program.



In the above code I paint all the data in the paint() Method.

Question: How can I combine paint/repaint() with the run() Merhod?
12 years ago
Dave thanks

I run It with the Emulator on the one same machine. I indeed have to specify the IP of my PC there as for Android the Emulator is "localhost". But that is not the main problem. There is an error message "Conversion to Davlink format failed with error1". I supose this is the error which is caused because the compilation fails when i should rework "mysql-connector-java-5.1.13-bin.jar" into the Davlink format.
12 years ago
I want to synchronize the internal Sqlite Database to an external MySQL Database (I work with Eclipse).

I imported mysql-connector-java-5.1.13-bin.jar into the project, but the conversion to another Format (davlink) does not succeed.



Somebody have an idea?
12 years ago
(sorry, I forgot to format code above)
I at last found the error. The form I used hat a small error.



I just had "value="submit", that was fatal.

Second I suppose that the role name must be written with a first big letter.

web.xml



and sun-web.xml



It was annoiing to find the error, because there were no error messages.
13 years ago
I at last found the error. The form I used hat a small error.

<form action="j_security_check" method="post">
Username: <input type="text" name="j_username">

Passwort: <input type="password" name="j_password">
<input type="submit" value="Login">
</form>

I just had "value="submit", that was fatal.

Second I suppose that the role name must be written with a first big letter.

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" 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_3_0.xsd">
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<security-constraint>
<display-name>AdminDisplay</display-name>
<web-resource-collection>
<web-resource-name>WebResource</web-resource-name>
<description/>
<url-pattern>/verwaltungsOrdner/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<description>ConstraintBeschreibung</description>
<role-name>AdminRolle</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>file</realm-name>
<form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-error-page>/loginFehler.html</form-error-page>
</form-login-config>
</login-config>
<security-role>
<description/>
<role-name>AdminRolle</role-name>
</security-role>
</web-app>

and sun-web.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD GlassFish Application Server 3.0 Servlet 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_3_0-0.dtd">
<sun-web-app error-url="">
<context-root>/Schutz_1</context-root>
<security-role-mapping>
<role-name>AdminRolle</role-name>
<principal-name>verwalter</principal-name>
</security-role-mapping>
<class-loader delegate="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
</sun-web-app>

It was annoiing to find the error, because there were no error messages.
13 years ago
I have difficulties implementing Declarative Security with Netbeans 6.9.1.

See:

https://coderanch.com/t/530583/java/Declarative-Security-Java-EE-Glassfish

Somebody can help?
13 years ago
Is there nobody using Java EE6 declarative security? Is there anybody who works with Netbeans 6.9.1?

In the meantime I think that the non functionning of Declarative Security does not work in Netbeans 6.9.1.

I will report a bug.

Netbeans is a very cool tool, if only these many errors would not be!!!
13 years ago
I want a simple example of a secured folder of a JSP application. The folder named "admin" should be accessed only by a user named "verwalter" (I dont use the user named "admin" as there ist already such a user in Glassfish).

I program an app with an index.jsp. There is a link to the a subfolder admin to the file adminSeite.html. Besides the index.jsp there are login.jsp and error.jsp. login jsp has the following form in it:




error.jsp tells if entry fails.

In the Glassfish-Console (localhost:4848) I declare a user "verwalter" with password "verwalter" in the realm "file". I create a group "verwalterGruppe" with a random name. Here it is not possible to assign the user to a role (although some EE tutorials say that roles are defined in Glassfish)

web.xml: Definition of roles (to my opinion) and resources (paths):



sun-web.xml: mapping role defined in web.xml to user and group defined in admin console of glassfish.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD GlassFish Application Server 3.0 Servlet 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_3_0-0.dtd">
<sun-web-app error-url="">
<context-root>/VerzeichnisSchutz</context-root>
<security-role-mapping>
<role-name>adminRolle</role-name>
<principal-name>verwalter</principal-name>
<group-name>verwalterGruppe</group-name>
</security-role-mapping>
<class-loader delegate="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
</sun-web-app>

If I want to run the app, I cannot login with user verwalter and pass verwalter. The indicated url is:

http://localhost:8080/VerzeichnisSchutz/admin/j_security_chek

I am not sure about the definition of roles and resouces. Are roles defined in web.xml, or are there predifined roles in Glassfish (admin and user), as many tutorials suggest? My I name resources deliberately?

Somebody can help me?

13 years ago
Ulf, many thanks

sqljdbc4.jar is found in pp.jar indeed. I deleted the classpath I defined in the system and database access is granted nervertheless.

Uups

I still have it in the Classpath elsewhere. But I thought it would use the sqljdbc4.jar in the pp.jar folder. If this is not the case I do not understand that one must have

Class-Path: sqljdbc4.jar

in the Manifest.txt file.
Thanks Ulf

This is the corect answer.

To summarize:

Creating a Manifest.txt file with the following contents in the program folder:

Manifest-Version: 1.0
Class-Path: sqljdbc4.jar
Main-Class: ParkplatzVerwaltung
(Newline)

Don't forget to end with a newline. The important thing is "Class-Path: sqljdbc4.jar", showing where the driver is.

I copied sqljdbc4.jar in the same folder as the program.

Creating a jar of the program folder:

jar cfm pp.jar Manifest.txt *.*

With *.* I include alle files, the sqljdbc4.jar, too. When I delete sqljdbc4.jar the pp.jar works well nevertehless, I suppose that sqljdbc4.jar is found in pp.jar.





Thanks for the tip, Tamas

I just want one file to cklick on. When I have the application in a .class file, it works well (I have sqljdbc4.jar in the classpath). I do not understand, if I have the folder wrapped in a .jar file, sqljdbc4.jar is not found any more.


I want to pack my application in a .jar file.

I run an application which needs sqljdbc4.jar to access a Sql 2008 Express server. Without the jar the application runs well and gets access to the database. With the jar file it doesn't.

I wrap as follows:

Make Manifest.txt with the following contents: Main-Class: MyMainClass (plus empty line)

Make executable jar: jar -cfm MyAppl.jar Manifest.txt *.class

Run: java -jar MyAppl.jar

Now the database is not found => Exception: com.microsoft.sqlserver.jdbc.SQLServerDriver

Copiing sqljdbc4.jar to jre/lib/ext is useless.

The same problem exists with the MySql driver.

Help needed!



Still a remark:

Sql Server Express 2008 works well on a XP 32 bit System.

I first installed Sql Server Express 2005 and then Sql Server Express 2008 without deinstalling the 2005 version on a XP 64. This gave a mess. I just recommend to deinstall an old Express version before installing a new one. I'm not sure, if the errors came because of the 64 bit XP.
Still some remarks to SQL 2005 and 2008 Server Express:

I first tryed with SQL 2005 Server as the installation process is shorter. Now I see that the SQL of 2005 is very limited, so that it is not possible to import a SQL-Dump from MySQL.

Despite the more steps to install 2008 Server Express it is recommended, as (hopefully) the syntax is closer to the syntax of the actual MySQL version.

To install SQL 2008 Server you have to do the following:

Install:
NetFramework 3.5
Installer 4.5
PowerShell
SQL 2008 Express Server
Management Console 2008
sqljdbc4.jar (JDBC-Driver, put into classpath)

Configuration:

Configure Port (eg. 1433)
Change authentication to Windows and SQL-Server
Create user in management console
add sqljdbc4.jar to classpath


The code



I did not check yet, but I hope transfer of data from MySQL to SQL2008 is easier.