RE: ClassCastException in generated code

2002-05-15 Thread Greg Davis

Did you change your bean recently? It sounds like your remotes are out of
date. Ensure you remotes on the client side match up properly.  Also ensure
any Serialiazable classes you pass via method calls are not updated in only
the client of server.  This error normally happens when you either try to
cast the wrong object (I.e. in Collections this can happen easily if you are
not careful) and serialized objects (when the new class doesn't match up to
the old one).  These will compile fine, but break during runtime.

Without any other information, this is all I can add. 

Hope this helps.

Greg

-Original Message-
From: Tim Joyce [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 15, 2002 4:16 AM
To: Orion-Interest
Subject: ClassCastException in generated code


Hi,

I am getting a rather nasty ClassCastException when i try and remove a
many-to-many join (implemented like the MovieDatabase example). My question
is how do i go about debugging this? Is it possible to get access to the
generated .java files?

Thanks in advance for any advice

stack traces follow (sorry)

cheers

timj


com.evermind.server.rmi.OrionRemoteException: java.lang.ClassCastException:
ProductJoin_EntityBeanWrapper853
at com.evermind.server.ejb.EJBUtils.getUserException(.:199)
at
EntityProduct_EntityBeanWrapper838.removeBrand(EntityProduct_EntityBeanWrapp
er838.java:1805)
at com.mywds.ejb.session.LightWeightBean.updateProduct(Unknown Source)
at
LightWeight_StatelessSessionBeanWrapper834.updateProduct(LightWeight_Statele
ssSessionBeanWrapper834.java:4066)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.axis.providers.java.RPCProvider.invokeMethod(Unknown Source)
at org.apache.axis.providers.java.RPCProvider.processMessage(Unknown Source)
at org.apache.axis.providers.java.JavaProvider.invoke(Unknown Source)
at org.apache.axis.strategies.InvocationStrategy.visit(Unknown Source)
at org.apache.axis.SimpleChain.doVisiting(Unknown Source)
at org.apache.axis.SimpleChain.invoke(Unknown Source)
at org.apache.axis.server.AxisServer.invoke(Unknown Source)
at org.apache.axis.transport.http.AxisServlet.doPost(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:211)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:309)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
at com.evermind._bxb._crd(.:501)
at com.evermind._bxb._ukb(.:170)
at com.evermind._cn._uab(.:576)
at com.evermind._cn._fm(.:189)
at com.evermind._bs.run(.:62)

Nested exception is:
java.lang.ClassCastException: ProductJoin_EntityBeanWrapper853
at
ProductJoinHome_EntityHomeWrapper1381.remove(ProductJoinHome_EntityHomeWrapp
er1381.java:16)
at com.mywds.ejb.entity.EntityProductBean.removeBrand(Unknown Source)
at
EntityProduct_EntityBeanWrapper838.removeBrand(EntityProduct_EntityBeanWrapp
er838.java:1791)
at com.mywds.ejb.session.LightWeightBean.updateProduct(Unknown Source)
at
LightWeight_StatelessSessionBeanWrapper834.updateProduct(LightWeight_Statele
ssSessionBeanWrapper834.java:4066)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.axis.providers.java.RPCProvider.invokeMethod(Unknown Source)
at org.apache.axis.providers.java.RPCProvider.processMessage(Unknown Source)
at org.apache.axis.providers.java.JavaProvider.invoke(Unknown Source)
at org.apache.axis.strategies.InvocationStrategy.visit(Unknown Source)
at org.apache.axis.SimpleChain.doVisiting(Unknown Source)
at org.apache.axis.SimpleChain.invoke(Unknown Source)
at org.apache.axis.server.AxisServer.invoke(Unknown Source)
at org.apache.axis.transport.http.AxisServlet.doPost(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:211)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:309)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
at com.evermind._bxb._crd(.:501)
at com.evermind._bxb._ukb(.:170)
at com.evermind._cn._uab(.:576)
at com.evermind._cn._fm(.:189)
at com.evermind._bs.run(.:62)  




RE: JNDI question: client talking to EJBs on multiple app servers

2002-04-18 Thread Greg Davis

We have a similary situation where a tool we use needs to switch between
development,test,and production. We just setup a simple class to reset our
InitialContext by closing the old one and passing in the properties when the
switch is requested.  We created a property file like this:

development.applicationServer=com.evermind.server.ApplicationClientInitialCo
ntextFactory
development.applicationServerUrl=ormi://fred
development.appServerLogin=user
development.appServerPassword=1234
production.applicationServer=com.evermind.server.ApplicationClientInitialCon
textFactory
production.applicationServerUrl=ormi://wilma
production.appServerLogin=user
production.appServerPassword=1234

When we initialize the app we have a member variable jndiContext which is
used in the app.  The following is our method stripped down to give you the
basics. With it you can both set the memeber varaible and return the
context. You could use it either way.

  /**
   * Gets the context.
   * @param environment Should be the prefix in the properties file (i.e.
development,test,production)
   * @returns The jndiContext to the App Server.
   */
  protected Context getContext(String environment)
  {
if(jndiContext == null)
{
jndiContext.close();
}
  try
  {
String applicationServer = System.getProperty(environment +
.applicationServer);
String applicationServerUrl = System.getProperty(environment +
.applicationServerUrl);
String appServerLogin = System.getProperty(environment +
.appServerLogin);
String appServerPassword = System.getProperty(environment +
.appServerPassword);

Hashtable props = new Hashtable();
props.put(java.naming.factory.initial, applicationServer);
props.put(java.naming.provider.url, applicationServerUrl);
props.put(java.naming.security.principal, appServerLogin);
props.put(java.naming.security.credentials, appServerPassword);

jndiContext = new InitialContext(props);
  }
  catch(Exception e)
  {}
}
return jndiContext;
  }

Hope this helps...

Greg

-Original Message-
From: David Moles [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 4:06 PM
To: Orion-Interest
Subject: JNDI question: client talking to EJBs on multiple app servers


I've got the same beans deployed on two different app servers (each
backed by a different database). I want my client to talk to both.
Say the two app servers are running on machines named Fred and Wilma;

I know I can choose which one I talk to by setting

  java.naming.provider.url=ormi://fred/app

or

  java.naming.provider.url=ormi://wilma/app

But how do I switch at run time? I don't want to keep changing the
system property every time I get an InitialContext(), because the
system property is a global setting and one piece of code might not
know what another piece of code is doing. Is there a way to specify
the JNDI url when you create an InitialContext?







RE: Showstopper: Orion deployment crash, NullPointerException

2002-04-17 Thread Greg Davis



Did 
you also remove the related files in the orion/persistence directory. I 
have had problems before when the .cache files don;t match up with the 
persistence ones. Just a thought. I haven't seen the error below 
before though

Later...

Greg

  -Original Message-From: Randahl Fink Isaksen 
  [mailto:[EMAIL PROTECTED]]Sent: Wednesday, April 17, 2002 7:04 
  AMTo: Orion-InterestSubject: Showstopper: Orion 
  deployment crash, NullPointerException
  
  After introducing a lot of 
  different changes in my EJBs I decided to erase my 
  deployment directory (the folder /orion/application-deployments/rockit) in an attempt to 
  make orion carry out a 
  fresh and complete redeployment. Unfortunately now all I get is 
  this:
  
  Auto-deploying rockit-ejb.jar (No previous deployment found)... java.lang.NullPo
  interException
   
  at com.evermind._eh._dyc(.:109)
   
  at com.evermind._fc._izd(.:198)
   
  at com.evermind._fc._de(.:63)
   
  at com.evermind._fpb._de(.:31)
   
  at 
  com.evermind._eq._aa(.:280)
   at 
  com.evermind._ed._aa(.:270)
   at 
  com.evermind._ai._kmd(.:526)
   at 
  com.evermind._aj._kmd(.:287)
   at 
  com.evermind._aj._vxb(.:119)
   at 
  com.evermind.server.ApplicationServer._sxc(.:1308)
   at 
  com.evermind.server.ApplicationServer._ige(.:1265)
   at 
  com.evermind.server.ApplicationServer._vxb(.:1003)
   
  at com.evermind._cxb.run(.:89)
   
  at java.lang.Thread.run(Thread.java:536)
   
  at com.evermind._bt.run(.:47)
  
  It is kind of hard for me to 
  guess whats going on since the stack trace is 
  obfuscated, so as a long shot I am asking you guys if you have experienced 
  something similar to this?
  
  
  Yours 
  Randahl


RE: When to use java.util.Collection or java.util.Set

2002-04-16 Thread Greg Davis



What 
if Person P steals car C? If I were the police I would want to know he 
stole it three times. :-) Although in most cases I would tend toward a Set 
before collections, Logging is one of the areas where P C being the key 
could exist multiple times and I would want the information. I would hope 
that you datasource would not have duplicate records in it anyway. 
:-)

  -Original Message-From: Randahl Fink Isaksen 
  [mailto:[EMAIL PROTECTED]]Sent: Tuesday, April 16, 2002 9:12 
  AMTo: Orion-InterestSubject: When to use 
  java.util.Collection or java.util.Set
  
  Hi 
  everybody
  
  
  I 
  noticed in the EJB 2.0 specification that most of the examples use java.util.Collection when defining a relationship between 
  two entities, even though java.util.Set is also 
  allowed.
  
  Why is 
  that so?
  
  I would 
  expect java.util.Set to be the most frequently used 
  type, since in general you would not want duplicates in a relationship. Think 
  of a Person-owns-Car relationship for instance - you are not interested in any 
  duplicates here, since a Person cannot own the same car twice so to speak (if 
  one relationship says that person P is the owner of car C, it does not provide 
  you with any usefull information to create yet 
  another relationship between P and C).
  
  Which 
  cmr-field-types do you use and 
  why?
  
  
  Randahl
  


Filter.init() not being called?

2002-04-11 Thread Greg Davis

I am feeling kinda dumb here.  I have a Filter that works fine except it
does not call init() the first time it is put into service.  I tried wiping
out the persistence files in orion/application-deployment and
orion/persistence but it does not seem to ever call the Filter's init
method.  I am using JDK 1.3.1_03 and Orion 1.5.4.

Any ideas?

Here is what the souce looks like:

package com.we.servlet;

import javax.servlet.*;
import javax.servlet.http.*;

public class MyFilter implements Filter {

  private static final boolean DEBUG = true;
  private static final int DEFAULT_MAX_POST_SIZE = 1024 * 1024 * 5;  // 5
Meg
  private int postSize = DEFAULT_MAX_POST_SIZE;
  private FilterConfig config = null;

  public void init(FilterConfig config) throws ServletException
  {
this.config = config;
String newSize = config.getInitParameter(postSize);
if(newSize != null  newSize.trim().length()  0)
{
  try
  {
postSize = Integer.parseInt(newSize.trim());
  }
  catch(Exception e)
  {
throw new ServletException(e.getMessage());
  } 
  System.out.println(MyFilter.init() post size is now: + postSize);
}

System.out.println(MyFilter initialized with post limit of  +
postSize);
  }

  public void destroy() {
config = null;
  }

  public void doFilter(ServletRequest request, ServletResponse response,
 FilterChain chain) throws IOException, ServletException
  {
if(DEBUG)
  System.out.println(Post Size: + postSize);
 
chain.doFilter(multi, response);
  }

  public void setFilterConfig(FilterConfig config)
  {
this.config = config;
  }

  public FilterConfig getFilterConfig()
  {
return this.config;
  }
}




RE: Java newsgroups: Entity Beans not synchronising with database

2002-04-10 Thread Greg Davis



You 
should set the exclusive-write-access="false" in your orion-ejb-jar.xml file 
since you are not accessing the table (exclusively) through the Entity 
bean. Why not have the stateless session bean use the create() method in 
the Entity bean's home? Have you run into a performance issue pertaining 
to that to where it is inefficient to use the create()?

Later...

Greg

  -Original Message-From: Kumar, David 
  [mailto:[EMAIL PROTECTED]]Sent: Wednesday, April 10, 2002 2:30 
  AMTo: Orion-InterestSubject: Java newsgroups: Entity 
  Beans not synchronising with database
  
  We are currently 
  using a stateless session bean to perform a direct update of a table in the 
  database and then usinga 
  findermethodin the home 
  interface of an entity bean which is mapped over the same table to 
  retrieve the records that have just been updated. Because both transactions 
  are managed by the application server, it should know that 
  theentitybeansneed to 
  refresh from the database because some data has changed.
  
  However the result 
  is that the direct update is committing the change to the database as you 
  would expect, but theentity beans 
  retrieveddo not reflect that change.Do we need to force 
  theentity beanto refresh from the database?
  
  We are using 1.5.4 
  Orion Application Server, EJB 1.1 andMSSQL 7 
  database.
  
  ta,
  
  - 
  dave
  
  
  Dave Kumar.Software Developer
  Prolog4 - Prolog House, Littlemoor, Eckington, 
  Sheffield, S21 4EFTEL: +44(0)1246 439400 FAX: +44(0)1246 
  439401E-MAIL:[EMAIL PROTECTED] WEB: http://www.prolog4.com
  
  
  This email is subject to 
  copyright and the information in it is confidential and may be legally 
  privileged. It is intended only for the named recipient(s). Access to this 
  email by anyone else is unauthorised.If you are not the intended 
  recipient, any disclosure, copying, distribution or any action taken or 
  omitted to be taken in reliance on it, is prohibited and may be unlawful. If 
  received in error please contact the sender, then delete it from your system. 
  
  
  When addressed to our customers, any opinions or 
  advice contained in this email are subject to the terms and conditions 
  expressed in the contract of sale. No contracts may be concluded on behalf of 
  any Prolog Group company by means of email communications.
  Please note that neither Prolog nor the sender 
  accepts responsibility for viruses and it is your responsibility to scan 
  attachments (if any).
  


RE: arrg please help

2002-04-03 Thread Greg Davis

Are you using CMP or BMP with your entity bean?  It sounds like BMP and you
are accidentally closing the connetion somewhere you are not supposed to
inside the bean.  What kind of database are you connecting to (i.e. MySQL,
SQL Server, Oracle,etc...)

I need a little more info here before I can try to help. :-)

Later...
Greg
 

-Original Message-
From: Ofur-Bjarni [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 03, 2002 12:35 AM
To: Orion-Interest
Subject: arrg please help


I have an existing database and I am trying to make an entity bean that
retrieves data from one of it's tables.

I have set the autocreate-table to false, and everything deploys nicely, but
when I try to list the contents of the table (using findAll()) then I get
this error:

com.evermind.server.rmi.OrionRemoteException: Database error: Closed
Statement: next; nested exception is: java.sql.SQLException: Closed
Statement: next

And I have no idea what to do. I know that the datasource works, because I
have used it for other purposes.

Thanks,
Bjarni





RE: SQL Server JDBC driver from Microsoft

2002-03-15 Thread Greg Davis

Got ours to work fine too.  Just make SURE you set the SelectMethod to
cursor in the URL(See Below).  Otherwise bad things will happen if you try
to do a second statement while still inside a first statement(i.e. doing a
SELECT while walking through another SELECT.)

url=jdbc:microsoft:sqlserver://mySQLbox:1433;SelectMethod=cursor

Later...

Greg

-Original Message-
From: Jarrod Roberson [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 15, 2002 5:47 AM
To: Orion-Interest
Subject: SQL Server JDBC driver from Microsoft


has anyone gotten this to work with Orion 1.5.4?

If so are there any gotchas or anything that I should look out for, I 
want to use it to develop against.





InitialContext Issue

2002-03-05 Thread Greg Davis

Okay everyone I really need some help here  We have an issue that I think I
have seen before, but I can't seem to find it in the newsgroup or archives
Currently we have a ColdFusion server running on our front end(try not to
laugh too hard) and Orion running in the back  We created a LoginBean Class
which resides on the ColfSusion server and validates username and password
via a session bean on the orion server  This works great until two people
try to login at the same time(ie the second tries to login before the
first completes the process) When this occurs, the first one to hit the
site gets validated and the second throws:

 NamingException: unable to instantiate
comevermindserverApplicationClientInitialContextFactory

hen our LoginBean instantiates it calls a private method called
getJndiContext() which sets it's member variable jndiContext for use within
the class This is where the error is occuring

  private void getJndiContext()
  {
//get the context
if(jndiContext == null)
{
  try
  {
jndiContext = new InitialContext(); -! ERROR Occurs
Here !
userHome = (UserHome)
PortableRemoteObjectnarrow(jndiContextlookup(User),UserHomeclass);
profileHome = (ProfileSessionHome)
PortableRemoteObjectnarrow(jndiContextlookup(ProfileSession),ProfileSess
ionHomeclass);
  }
  catch(NamingException ne)
  {
Logtxt(this, Naming Exception: + negetMessage(), LOGFILE);
neprintStackTrace();
  }
}
  }

I believe the rest of the class is unsbstantial when dealing with this
issue

So then I thought it could not create multiple instances of the same object
on the cold Fusion side So, I created a teb object that implemented
Runnable and created a New LoginBean for each instance thinking it would
work locally but not in Cold Fusion

here is the code for the test object:

import javarmiRemoteException;
/** User is an EJB containing user information(ie First Name, Last Name,
email, etc) */
import comweapiprofileUser;

public class RunnableLoginBean implements Runnable
{
LoginBean login;
StringBuffer sb;

  public RunnableLoginBean()
  {
this(null,null);
  }

  public RunnableLoginBean(String u, String p)
  {
login = new LoginBean();
loginsetUserName(u);
loginsetPassword(p);
sb = new StringBuffer();
  }

  public RunnableLoginBean(String u, String p, StringBuffer sb)
  {
thissb = sb;
login = new LoginBean();
loginsetUserName(u);
loginsetPassword(p);
  }

  public void run()
  {
if(loginisUserValid())
{
  try
  {
sbappend(Hello : + logingetUser()getFirstName() +\n);
  }
  catch(RemoteException re)
  {
sbappend(Error:  + regetMessage());
reprintStackTrace();
  }
}
else
{
  sbappend(Login failed for : + logingetUserName() +\n);
}
  }

  public String test(int count)
  {
for(int i=0; i  count;i++)
{
  Thread t1 = new Thread(new RunnableLoginBean(jhogan,password,
thissb));
  t1start();
}
try
{
  Threadsleep(5000); //make sure the threads are done before
printing
}
catch(Exception e)
{
  sbappend(Error waiting: + egetMessage());
  eprintStackTrace();
}
return thissbtoString();
  }

  public static void main(String[] args)
  {
RunnableLoginBean lb = new RunnableLoginBean();
Systemoutprintln(lbtest(10));
  }
}

This works fine on both my machine and the cold fusion server  But if 2
users hit the same page at the same time(ie the second hits before the
first is finished), all ten(10) of the first connector's tests pass, and all
ten(10) of the second connector's tests throw the instantiation error I
seem to remember seeing this problem with JRUN before  Since JRun and
ColdFusion are built by the same company I am assuming right now they may
use the same code for session/object storage and thus the problem may happen
on both platforms It's almost as if they have a Singleton Hashtable of
classes per object call and thus cannot instantiate more than one instance
of a class per application call 


I am at a loss as to why this would happen  Any ideas on why this is
happening and what we can do to fix it? 

Thanx in advance

Greg




RE: what happens at startup?

2002-03-05 Thread Greg Davis

Check your config files in orion/config.  It looks like a tag wasn't
properly closed or is missing from server.xml application.xml, or
global-web-application.xml.  If you still have the originals or the tar
ball, re xtract the files to another directory and compare them, or cross
reference it with the Orion documentation for those files.

Hope this helps.

-Original Message-
From: daniele rizzi [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 05, 2002 1:00 AM
To: Orion-Interest
Subject: what happens at startup?



hi all,

this morning I've tried to restart my own orion server, with bad result:
this is an extract from server.log

05/03/02 8.35 9.0.2.0.0 Stopped (Shutdown executed by admin from
192.168.237.159 (lspd31.largesys.pd))
05/03/02 8.35 9.0.2.0.0 Started
05/03/02 8.35 Internal error in HttpServer
java.lang.NullPointerException: application reference's config was null
at
com.evermind.server.ApplicationServer.getApplication(ApplicationServer.java:
1925)
at
com.evermind.server.http.HttpServer.getHttpApplication(HttpServer.java:623)
at
com.evermind.server.http.HttpSite.getApplication(HttpSite.java:375)
at
com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandle
r.java:370)
at
com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:250)
at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:62)

--- ... then it repeats again for every request...

any hint?

thanx,
daniele rizzi