Andrew Parker

Ranch Hand
+ Follow
since Nov 12, 2001
Merit badge: grant badges
For More
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 Andrew Parker

Thank you for your kind reference.

FYI: the link was moved to http://www.geocities.com/j2exe/
19 years ago
Hi,

I use JBuilder to build a jar file and derive the exe file.

I added other jar library files to jar. So, when I run java -jar test.jar, it can run with other jar library files.

However, other jar library files cannot be included when I run the exe file.

I tried test.exe -cp others.jar, but it does not work.

How can I fix it?

Thanks
19 years ago
Hi,

I built a console jar program and want to run it as a service on windows 2000 server.

May I ask how can I do it?

Thanks
19 years ago
I fixed the problem and thank you for your kind help.
19 years ago
Hi,

I modified the code and found where is the bug. When I run the jar program in console window.

The pop up ConfirmDialog box displayed and the console window printed:

Starting Data Exchange ...

New an instance. //able to new an instance

Prepare to connect DB. //able to call the DBConnection method.

Prepare to get connection pool. //prepare get connection with the pool

It does NOT show "Got connection pool." and print the following error:

java.lang.NullPointerException

java.util.Timer@141b571

I used MSSQL 2000 JDBC driver and it does not has problem when I run the program in JBuilder.

Did it lose the DataEx main object or it is the thread problem? What are the potential problems and how can I debug it?

Thanks for any kind advice.

Here is the updated code:



:roll:
19 years ago
Yes, it is complete code in main method. except

main.DBConnection();
main.dataexchange();

I added println in the above 2 methods to check whether they are executed and I did not see the println. Do you think it is the timer issue?

If I placed in the wrong forum, can you help me move to the proper level?

Thanks for help.
19 years ago
Yes, it is complete code in main method. except

main.DBConnection();
main.dataexchange();

I added println in the above 2 methods to check whether they are executed and I did not see the println. Do you think it is the timer issue?

If I placed in the wrong forum, can you help me move to the proper level?

Thanks for help.
19 years ago
Hi,

I built a console application on windows. It works fine when I run it on JBuilder. It has a timer to run the Socket Connection with another server and exchange data for every minute.

I built the archives - both native executable jar file and console exe file.

I run it in console window. It can display the first print line of the program: "Starting Data Exchange ..."

However, I did not see the data updating in both servers.

The console program seems running from connecting to local DB till printing out Starting Data Exchange ...

I am not sure whether the code insides the timertask has run or not. It is ok when I run it in JBuilder.

So, is it the timer bug or the classpath issue?

What may be the deployment problems?

Thanks for any kind advice.

19 years ago
Hi,

I built a console application on windows. It works fine when I run it on JBuilder. It has a timer to run the Socket Connection with another server and exchange data for every minute.

I built the archives - both native executable jar file and console exe file.

I run it in console window. It can display the first print line of the program: "Starting Data Exchange ..."

However, I did not see the data updating in both servers.

The console program seems running from connecting to local DB till printing out Starting Data Exchange ...

I am not sure whether the code insides the timertask has run or not. It is ok when I run it in JBuilder.

So, is it the timer bug or the classpath issue?

What may be the deployment problems?

Thanks for any kind advice.

19 years ago
Hi,

I have a java console application which needs to connect to MSSQL 2000 DB. I installed the jdbc driver and set the classpath.

Previously, I used to connect MySQL with ConnectionPool.

I use the same connectionpool class to connect to the MSSQL 2000 by changing the parameters.

JDBCDriver=com.microsoft.jdbc.sqlserver.SQLServerDriver
JDBCConnectionURL=jdbc:microsoft:sqlserver://MSSERVER:1433
ConnectionPoolSize=5
ConnectionPoolMax=10
ConnectionUseCount=5
ConnectionTimeout = 2
User=mssql
Password=mssql

I read the Microsoft SQL Server 2000 Driver for JDBC help documents:

The pool implementation creates "real" database connections using the getPooledConnection() method of ConnectionPoolDataSource. Then, the pool implementation registers itself as a listener to the PooledConnection. When a client application requests a connection, the pool implementation (Pool Manager) assigns one of its available connections. If there is no connection available, the Pool Manager establishes a new connection and assigns it to that application. When the client application closes the connection, the Pool Manager is notified by the driver through the ConnectionEventListener interface that the connection is free and available for reuse. The pool implementation is also notified by the ConnectionEventListener interface when the client somehow corrupts the database connection, so that the pool implementation can remove that connection from the pool.

Once a SQL Server 2000 Driver for JDBC data source has been registered with JNDI, it can be used by your JDBC application as shown in the following example, typically through a third-party connection pool tool:

Context ctx = new InitialContext();
ConnectionPoolDataSource ds =
(ConnectionPoolDataSource)ctx.lookup("jdbc/EmployeeDB");
pooledConnection pcon = ds.getPooledConnection("matt", "wwf");

In this example, the JNDI environment is first initialized. Next, the initial naming context is used to find the logical name of the JDBC data source (EmployeeDB). The Context.lookup() method returns a reference to a Java object, which is narrowed to a javax.sql.ConnectionPoolDataSource object. Finally, the ConnectionPoolDataSource.getPooledConnection() method is called to establish a connection with the underlying database.

NOTE: JDBC drivers do not manage connection pooling. You must use an external connection pool manager.

I need to create a pool and the create method is:



I added breakpoint and saw that the following code did not execute and finally return a nullpointerexception.



Q.1 I am not sure "Once a SQL Server 2000 Driver for JDBC data source has been registered with JNDI", how can I register with JNDI?

Q.2 I saw that the help document mentioned ConnectionPoolDataSource.getPooledConnection(), my connectionpool java class does not has getPooledConnection() method.

I have only the public synchronized java.sql.Connection getConnection() which seems not use javax.sql.ConnectionPoolDataSource, it only uses java.sql.Connection.

May I ask where can I download the connection pool manager java source?

Thanks for help
Hi,
I tried
The FileInputStream:

The EncryptClass constructor:

The FileOutputStream:

My questions are
1. how to make is.read(bytes) to be a byte array?
2. can I write byte [] b directly to os?
Thanks for your great help.
19 years ago
Hi,

I want to read the test.txt file as byte, not int. But, it cannot cast int c to byte [] d. Or, I do not need to use int c to read the whole file?
Pls advise.
19 years ago
Hi,
May I ask whether MIDP 2.0 support java.math.BigInteger and java.security.SecureRandom ?
If not, do I need to customize those 2 classes developed by http://www.bouncycastle.org as it can be run on J2ME.
Thanks
20 years ago
Hi,
I use JBuilder with Tomcat 4.1 to develop web application. I need to do a SSL for login. I configured the tomcat 4.1 under JBuilder and https://localhost:8443 works if I run the startup.bat under tomcat bin.
However, when I build and run the program, https did not work.
How should I enable it on JBuilder?
Thanks
20 years ago
Hi,
Sorry, I am a newbie and I do the project under JBuilder.
In the JBuilder, here is the structure:
package assignment;
public class StudentServlet {}
Root directory
index.jsp
add.jsp
/Student/record.jsp
The 3 resources in my index.jsp are:
1. /add.jsp
2. /Student/record.jsp
3. /servlet/StudentServlet
The Jbuilder packaged them as an Assignment.war file.
When I typed http://localhost:8080/Assignment, it displayed http://localhost:8080/Assignment/index.jsp.
Why not http://localhost:8080/index.jsp?
If it is http://localhost:8080/Assignment/index.jsp, why not the context "Assignment" cannot be located as follows?
1. http://localhost:8080/Assignment/add.jsp
2. http://localhost:8080/Assignment/Student/record.jsp
3. http://localhost:8080/Assignment/servlet/StudentServlet
If I use another war file name such as assign.war, but the resources links are
1. /Assignment/add.jsp
2. /Assignment/Student/record.jsp
3. /Assignment/servlet/StudentServlet
When I typed http://localhost:8080/assign, it cannot find http://localhost:8080/Assignment/index.jsp.
So, how can I solve it?
20 years ago
JSP