RE: DeadlockException

2000-11-14 Thread Matt MacGillivray


Deadlocks are not fun.  A deadlock is a thread related issue.  Specifically
when a group of threads are exclusively holding resources, then waiting on
other threads for their resources, in a circle.. hence they will wait
forever.  Here is an example:

Say thread A requires resource 1 and 2 to run.
Thread B requires resource 1, 2 and 3 to run.

What happens when thread A starts, get's a hold of resource 1, then thread B
starts, gets a hold of resource 2 and 3, then sits waiting for thread A to
let go of resource 1.   Similarly, thread A will now wait for thread B to
finish with resource 2.  Thus they are waiting on one another in a
'deadlock' situation because neither will give up the resouce that they just
acquired, but both need to run to completion.

There are ways around this, none are pretty.
1.  You can have a 'supervisor' thread that arbitrarily kills one of the
waiting threads when it detects a deadlock (ugly, but there are many
algorithms in computer science used to determine exactly which thread to
kill).
2.  You can modify your source so that resources are not exclusive.
Meaning, multiple threads can work with them at once (ugly).
3.  You can modify your threads so that they acquire all the resources they
need in a single atomic statement, i.e. a synchronized statement that only
one thread can go through at once, which will delegate resources which allow
all threads to run to completion.  This assumes the threads will then give
up the resources later.

Debugging of such things are very tricky.  I'd start with putting trace
statements in all of the resource allocating methods.

Hope this helps.

Matt MacGillivray
Technical Developer
Delfour Corporation
(905) 415-9779 x2021
[EMAIL PROTECTED]



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Adam Cassar
Sent: Tuesday, November 14, 2000 6:55 AM
To: Orion-Interest
Subject: DeadlockException


Does anyone know what the following error means?

11/14/00 10:51 PM Error in bean
com.netregistry.aucom.accounting.BillingAccount: Error in ejbPassivate
com.evermind.server.DeadlockException: Deadlock detected: thread 11 is
waiting for resource entity 1003 held by thread 11

Any ideas on how to track it down?





RE: Help me, please

2000-11-10 Thread Matt MacGillivray


Generally an error that mentions the 'init' method refers to a problem
with a global variable (instance variables) that you are setting in some way
or another.  I've learned that this 'init' method is a pre-constructor
that builds all the global variables in your object.  Check these variables.

Also, if you set the environment variable JAVA_COMPILER=NONE you won't get
those nasty 'Compiled Code' messages, instead, you will get line numbers.
Makes debugging easier.

Hope that helps a little.

Matt MacGillivray
Technical Developer
Delfour Corporation
(905) 415-9779 x2021
[EMAIL PROTECTED]



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Jordi Pinol
Sent: Friday, November 10, 2000 6:59 AM
To: Orion-Interest
Subject: Help me, please


I have a next problem, when my application starts:

java.lang.ArrayIndexOutOfBoundsException: 6
at java.lang.String.init(Compiled Code)
at java.lang.String.toUpperCase(Compiled Code)
at java.lang.String.toUpperCase(Compiled Code)
at org.hsql.Tokenizer.getToken(Compiled Code)
at org.hsql.Tokenizer.getString(Compiled Code)
at org.hsql.Database.execute(Compiled Code)
at org.hsql.jdbcConnection.executeStandalone(Compiled Code)
at org.hsql.jdbcConnection.execute(Compiled Code)
at org.hsql.jdbcStatement.fetchResult(Compiled Code)
at org.hsql.jdbcStatement.executeQuery(Compiled Code)
at org.hsql.jdbcPreparedStatement.executeQuery(Compiled Code)
at com.evermind.sql.am.executeQuery(Compiled Code)
at com.evermind.sql.am.executeQuery(Compiled Code)
at com.evermind.sql.am.executeQuery(Compiled Code)
at ants.moo.PlaceDAO.selectByWorld(Compiled Code)
at ants.moo.PlaceDAO.findByWorld(PlaceDAO.java:102)
at ants.moo.PlaceEJB.ejbFindByWorld(PlaceEJB.java:1145)
at PlaceHome_EntityHomeWrapper12.findByWorld(Compiled Code)
at ants.moo.WorldEJB.getPlaces(Compiled Code)
at World_EntityBeanWrapper4.getPlaces(Compiled Code)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Compiled Code)
at com.evermind.server.rmi.bd.run(Compiled Code)
at com.evermind.server.rmi.bb.hy(Compiled Code)
at com.evermind.server.rmi.bb.run(Compiled Code)
at com.evermind.util.f.run(Compiled Code)
java.sql.SQLException: General error
java.lang.ArrayIndexOutOfBoundsException: 6 in statement [select Id from
Places where SubId = 'world1' ]
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.init(Compiled Code)
at java.lang.Exception.init(Compiled Code)
at java.sql.SQLException.init(SQLException.java:64)
at org.hsql.Trace.getError(Compiled Code)
at org.hsql.jdbcResultSet.init(Compiled Code)
at org.hsql.jdbcConnection.executeStandalone(Compiled Code)
at org.hsql.jdbcConnection.execute(Compiled Code)
at org.hsql.jdbcStatement.fetchResult(Compiled Code)
at org.hsql.jdbcStatement.executeQuery(Compiled Code)
at org.hsql.jdbcPreparedStatement.executeQuery(Compiled Code)
at com.evermind.sql.am.executeQuery(Compiled Code)
at com.evermind.sql.am.executeQuery(Compiled Code)
at com.evermind.sql.am.executeQuery(Compiled Code)
at ants.moo.PlaceDAO.selectByWorld(Compiled Code)
at ants.moo.PlaceDAO.findByWorld(PlaceDAO.java:102)
at ants.moo.PlaceEJB.ejbFindByWorld(PlaceEJB.java:1145)
at PlaceHome_EntityHomeWrapper12.findByWorld(Compiled Code)
at ants.moo.WorldEJB.getPlaces(Compiled Code)
at World_EntityBeanWrapper4.getPlaces(Compiled Code)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Compiled Code)
at com.evermind.server.rmi.bd.run(Compiled Code)
at com.evermind.server.rmi.bb.hy(Compiled Code)
at com.evermind.server.rmi.bb.run(Compiled Code)
at com.evermind.util.f.run(Compiled Code)






Servlet to EJB Principals/Credentials problem! Impossible to solve?!

2000-11-01 Thread Matt MacGillivray


MY GOAL:
I would like to properly log into orion, from a servlet, when requesting EJB
calls.  I'd like to know which servlet users are hitting which EJBs without
explicitly passing the username and password around.  This must be
possible!!


Here is the situation:

I'm running Orion 1.3.8 on WINNT 4.00.1381 with JDK-1.2.2_005.

Orion is running a servlet that accesses EJBs also run under Orion.  I am
attempting to pass  a username and password back through the use of the
SECURITY_PRINCIPAL and SECURITY_CREDENTIAL.

When the servlet sets up the call to the EJB and calls it, the PRINCIPAL,
when printed out from the EJB always seems to be 'guest'.  When I use a test
program that calls the EJB through through orion, it seems to get the proper
username and password.  Why does it not work through the servlet?

Why is this happening?  One theory brought to my attention was that the two
scenarios use different virtual machines.  i.e. the first scenario
(servlet - ejb) always uses a single virtual machine, while the second
(test class - ejb) uses two virtual machines (one for orion, one for the
test class).  Why would separate virtual machines affect the PRINCIPALS and
CREDENTIALS?

Any and all help would be appreciated.


Matt MacGillivray
Technical Developer
Delfour Corporation
(905) 415-9779 x2021
[EMAIL PROTECTED]





RE: How to recover from incorrect user password

2000-10-23 Thread Matt MacGillivray


I am experiencing a similar problem to the one outlined below.

A user will log in using a servlet driven form.  When calling a session bean
for the first time, the resident servlet passes the username 'guest' instead
of the proper username and password as indicated in the principals and
credentials.

I have also been informed that orion will cache the username and password
unless a certain property is set.  The property, as I was told, is
"dedicated.connection" and it must be set to "true" however, this does not
seem to work.

Any suggestions or help?

Matt MacGillivray
Technical Developer
Delfour Corporation
(905) 415-9779 x2021
[EMAIL PROTECTED]


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Vidur Dhanda
Sent: Friday, October 20, 2000 1:50 PM
To: Orion-Interest
Subject: RP: How to recover from incorrect user password


Sorry, I forgot to attach the stacktrace.

Hello,

I want to force the user to enter a username/password when using the
application.  When the application creates a new InitialContext, Orion
prompts for a username/password. However, if the user enters an
incorrect password, Orion correctly throws a Security exception.  When
the application attempts the process again, Orion does not prompt for a
username/password but immediately throws a SecurityException.  Is this a
bug?

On a related note, after obtaining an InitialContext, if the application
closes it, and then tries to create another InitialContext, it gets a
NPE.  Is this related to the problem described above?
Here's the stacktrace:
java.lang.NullPointerException:

at
com.evermind.server.rmi.RMIInitialContextFactory.getInitialContext(JAX)

at
com.evermind.server.ApplicationClientInitialContextFactory.getInitialContext
(JAX)

at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:668)

at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246)

at javax.naming.InitialContext.init(InitialContext.java:222)

at javax.naming.InitialContext.init(InitialContext.java:198)

at com.epistemic.km.KMClient.getContext(KMClient.java:70)


Thanks,
Vidur





Servlet/EJB Connections

2000-10-23 Thread Matt MacGillivray


I am experiencing some problems with the username and password passed to
EJBs running under orion from a servlet.  Without a servlet, a test program
can connect to an EJB through Orion and the username and password
(principal/credential) are passed correctly.  It seems that once the servlet
tries to do the same thing, it cannot.  It seems as though the servlet
always sends the 'guest' account back to the EJB (when both are running
under Orion) no matter what I set the principals/credentials as.

This is likely a setup issue, but I haven't a clue what to look at.  The
documentation doesn't describe these issues which are imperitive to my
success!

What difference should there be between a program running on the host system
and the servlet, in terms of executing a session bean?  Intuitively, there
shouldn't be a difference.  But I am seeing differences!

I have also been informed that orion will cache the username and password
unless a certain property is set.  The property, as I was told, is
"dedicated.connection" and it must be set to "true" however, this does not
seem to work.

Please help.

Matt MacGillivray
Technical Developer
Delfour Corporation
(905) 415-9779 x2021
[EMAIL PROTECTED]


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Gary Shea
Sent: Monday, October 23, 2000 10:28 AM
To: Orion-Interest
Subject: Re: Data Sources Help


On Today, David Kenzik ([EMAIL PROTECTED]) wrote:
 Yes, Greg Matthews sent me a note shortly after receiving my inquiry with
 that same answer-- this is the case, "java:comp/env/jdbc..." won't work,
you
 must shorten it to simply "jdbc/SOURCENAME".

 Now that is out of the way, and it __was__ working for a bit. Really!

 However, I wanted to restart Orion and pass it some debugging info to find
a
 pesky connection leak. Now my Orion won't startup:

   Error initializing server: DriverManagerDataSource driver
'oracle.jdbc.driver.OracleDriver' not found

 I've changed nothing and can't figure out what the heck would've caused
 this.

Weird.  Are you running 1.3.8?  I wish I had a clue but I don't :(

Gary