RE: Inconsistent EJB JNDI Locations

2001-03-15 Thread Margulies, Adam
Title: RE: Inconsistent EJB JNDI Locations





A related point? (I'm new to this and a bit confused)


Purely as an academic exercise I tried to access my EJB from an external application.
The Orion documentation on this is sparse to non-existant :(


What ended up working for me is the following:


1. Write an application-client.xml (undocumented, but I figured it out from another example)

    PLJB User
    
    PLJB_User
    Entity
    com.hotjobs.entity.UserHome
    com.hotjobs.entity.User
    



note: i used the full classnames for my home and remote interfaces


2. put the application-client.xml in the META-INF directory for my ejb.jar
3. redeploy my .ear


4. write the client
5. write my own getInitialContext() for this client


    public static Context getInitialContext() throws NamingException
    {
    Properties p = new Properties();
    p.put("java.naming.factory.initial","com.evermind.server.ApplicationClientInitialContextFactory");
    p.put("java.naming.provider.url","ormi://localhost/PLJB");
    p.put("java.naming.security.principal","admin");
    p.put("java.naming.security.credentials","whatever");


    return new javax.naming.InitialContext(p);
    }
6. use the getInitialContext and then call lookup() using the _bean class name_(!?!?!)
Then narrowing works.


Context jndiContext = getInitialContext();
Object ref = jndiContext.lookup("UserBean");
UserHome home = (UserHome) PortableRemoteObject.narrow(ref,UserHome.class);


My questions are:


Why do I have to lookup() using the Bean class name?
Why can't i lookup on either "PLJB_User" or "UserHome"?
Am I hopelessly overcomplicating this?




-Original Message-
From: Karl Avedal [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 12, 2001 10:15 PM
To: Orion-Interest
Subject: Re: Inconsistent EJB JNDI Locations



Hello Manne,


That's right, that is the way we recommend it to be done. Just want to clarify
something though. It is possible to lookup EJBs in another application. To do
so, use the parent attribute when defining the application in server.xml and the
children application's local context will extend the one of the parent, making
it possible to use EJBs from another application.


Regards,
Karl Avedal


Manne Fagerlind wrote:


> I used the JNDI name "java:comp/env/ejb/MyBean" yesterday and it worked fine
> (older version of Orion; hope they haven't changed it). It seems that the
> object performing the lookup must be located inside the same enterprise
> application (i.e. -entry in server.xml) for this to work,
> though.
>
> /Manne
>
> -Original Message-
> From: Gary Shea [mailto:[EMAIL PROTECTED]]
> Sent: 09 March 2001 20:57
> To: [EMAIL PROTECTED]
> Subject: Re: Inconsistent EJB JNDI Locations
>
> On Thu, 8 Mar 2001, Peter Pontbriand wrote:
> > Yes, this is what works for us. Assuming that the Entity EJB is deployed
> > with MyBean and that the Session EJB's deployment
> > descriptor has an ejb/MyBean, the home
> > interface for MyBean is supposed to be found with
> > 'lookup("java:comp/env/ejb/MyBean")'. Unfortunately, this doesn't work,
> but
> > rather MyBean is found with 'lookup("MyBean")'.
>
> Recently I was looking at the spec while trying to figure out why
> Orion's JNDI setup isn't like the examples in the EJB books.  Turns
> out that the java:comp/env/{jms,ejb,...} locations are 'recommended',
> not mandatory.  Given that the non-Context contents of the env/
> directory must be String objects, it doesn't surprise me that the
> Orion folks decided it was tacky to put objects underneath a
> directory that's supposed to hold strings.  Also, I noticed when
> attempting to create objects below the env/ directory using the
> JNDI api, they somehow get turned into strings!  I'm a little unclear
> on whether this really happened or if I was doing something stupid,
> but it's what I think I saw!
>
> Cheers,
>
> Gary





Re: simple JSP bug with switch

2001-02-28 Thread Margulies, Adam
Title: Re: simple JSP bug with switch





OK, this seems reasonable. My worry was in transitioning from other engines
one of my first experiences was coming up against something simple that
wouldn't compile properly in Orion. My first thought was "uh oh, how many
more inconsistencies am I going to run into?". So you can understand my concern.


thanks!



adam


-Original Message-
From: Tim Endres [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 27, 2001 8:56 PM
To: Orion-Interest
Subject: RE: simple JSP bug with switch



It appears to me that Sun's RI is recognizing the "obvious" - that statements
can not appear between "switch" and "case", nor between "break" and "case".
Unless the spec specifically addresses this, it seems that Orion is doing the
correct thing, and Sun is providing a nicety that lulls one into writing bad
JSP code.
tim.


> Sorry if I didn't quite get your point.
> 
> It's odd though. The spec VERY specifically says that whitespace must be 
> preserved (JSP 1.1 spec, section 2.1.6), so it seems to me that what Orion 
> is doing is correct, even if it seems inconvenient.
> 
> If I write:
> 
> <% out.print("one"); %>
> <% out.print("two"); %>
> 
> then my reading of the spec says that I must get the two words printed on 
> different lines (which I believe Orion would do), whereas you seem to be 
> saying that Sun's RI would print "onetwo".  Or is Sun's RI somehow clever 
> enough to know the difference between my sample and yours? That would take 
> some clever examination of what's in the scriptlets, I would think.
> 
> Nick Newman
> 
> At 04:58 PM 2/27/01 -0500, you wrote:
> 
> >OK, thanks, I understand that (which is how I fixed the code).
> >
> >However, I believe this isn't the proper behaviour for JSP.
> >Orion should eat that newline. This is how other JSP engines behave,
> >including Sun's reference engine.
> >
> >It shouldn't break the java code by inserting an erroneous println...
> >or am I smoking crack?
> >
> >adam
> >
> >-Original Message-
> >From: Nick Newman 
> >[mailto:[EMAIL PROTECTED]]
> >Sent: Tuesday, February 27, 2001 11:40 AM
> >To: Orion-Interest
> >Subject: Re: simple JSP bug with switch
> >
> >Hi Adam,
> >
> >I don't think this is a bug, although I agree the messages are
> >confusing.  Set the development="true" flag in the orion-web.xml and you
> >get the reason explained more fully.  Basically what you have written in
> >the broken version produces code like this:
> >
> >switch(1){
> >  // write a new line (but can't be reached!)
> >case 1:
> >  // write newline, "One", newline
> >break;
> >  // write a new line (but can't be reached!)
> >default:
> >  // write newline, "Default", newline
> >break;
> >  // write a new line (but can't be reached!)
> >}
> >
> >and the compiler complains (correctly) that some of the copde can't be 
> >reached.
> >
> >Nick Newman
> >
> >
> >
> >At 08:11 PM 2/26/01 -0500, you wrote:
> >
> > >Forgive me if this is a known bug, but I didn't see it in the FAQ or
> > >anywhere on orionsupport.com.
> > >
> > >I am using Orion 1.4.7 and I have tried having Orion use Jikes 1.12 as
> > >well as all three of the 1.30 JDKs
> > >{Sun,IBM,Blackdown}. This is all running on RedHat 7.0 Linux 2.4.2.
> > >
> > >fixed version (but I shouldn't have to do this...):
> > >
> > ><% switch(1) { case 1: %>
> > >One
> > ><% break; default: %>
> > >Default
> > ><% break;  } %>
> > >
> > >broken version:
> > >
> > ><% switch(1) { %>
> > ><% case 1: %>
> > >One
> > ><% break; %>
> > ><% default: %>
> > >Default
> > ><% break; %>
> > ><% } %>
> > >
> > >Gives the following error (this is the Blackdown error, but they're all
> > >similar)
> > >
> > >500 Internal Server Error
> > >Error parsing JSP page /jsp/test.jsp
> > >Syntax error in source
> > >/jsp/test.jsp.java:29: 'case', 'default' or '}' expected (JSP page line 3)
> > > if(__coreOut == out)
> > > __coreOut.write(__staticContent, 0, 1);
> > > ^
> > >/jsp/test.jsp.java:29: 'case', 'default' or '}' expected (JSP page line 3)
> > > if(__coreOut == out)
> > > __coreOut.write(__staticContent, 0, 1);
> > >
> >  > ^
> > >/jsp/test.jsp.java:30: 'case', 'default' or '}' expected (JSP page line 3)
> > > else
> > > com.evermind.server.http.EvermindJSPWriter.writeBytes(out,
> > > __staticContent, 0, 1, null);
> > >
> >  >  ^
> > >/jsp/test.jsp.java:35: 'case', 'default' or '}' expected (JSP page line 4)
> > > if(__coreOut == out)
> > > __coreOut.write(__staticContent, 1, 5);
> > >
> >  > ^
> > >/jsp/test.jsp.java:36: 'case', 'default' or '}' expected (JSP page line 4)
> > > else
> > > com.evermind.server.http.EvermindJSPWriter.writeBytes(out,
> > > __staticContent, 1, 5, null);
> > >
> >  >  ^
> >

RE: simple JSP bug with switch

2001-02-28 Thread Margulies, Adam
Title: RE: simple JSP bug with switch





OK, this seems reasonable. My worry was in transitioning from other engines
one of my first experiences was coming up against something simple that
wouldn't compile properly in Orion. My first thought was "uh oh, how many
more inconsistencies am I going to run into?". So you can understand my concern.


thanks!



adam


-Original Message-
From: Tim Endres [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 27, 2001 8:56 PM
To: Orion-Interest
Subject: RE: simple JSP bug with switch



It appears to me that Sun's RI is recognizing the "obvious" - that statements
can not appear between "switch" and "case", nor between "break" and "case".
Unless the spec specifically addresses this, it seems that Orion is doing the
correct thing, and Sun is providing a nicety that lulls one into writing bad
JSP code.
tim.


> Sorry if I didn't quite get your point.
> 
> It's odd though. The spec VERY specifically says that whitespace must be 
> preserved (JSP 1.1 spec, section 2.1.6), so it seems to me that what Orion 
> is doing is correct, even if it seems inconvenient.
> 
> If I write:
> 
> <% out.print("one"); %>
> <% out.print("two"); %>
> 
> then my reading of the spec says that I must get the two words printed on 
> different lines (which I believe Orion would do), whereas you seem to be 
> saying that Sun's RI would print "onetwo".  Or is Sun's RI somehow clever 
> enough to know the difference between my sample and yours? That would take 
> some clever examination of what's in the scriptlets, I would think.
> 
> Nick Newman
> 
> At 04:58 PM 2/27/01 -0500, you wrote:
> 
> >OK, thanks, I understand that (which is how I fixed the code).
> >
> >However, I believe this isn't the proper behaviour for JSP.
> >Orion should eat that newline. This is how other JSP engines behave,
> >including Sun's reference engine.
> >
> >It shouldn't break the java code by inserting an erroneous println...
> >or am I smoking crack?
> >
> >adam
> >
> >-Original Message-
> >From: Nick Newman 
> >[mailto:[EMAIL PROTECTED]]
> >Sent: Tuesday, February 27, 2001 11:40 AM
> >To: Orion-Interest
> >Subject: Re: simple JSP bug with switch
> >
> >Hi Adam,
> >
> >I don't think this is a bug, although I agree the messages are
> >confusing.  Set the development="true" flag in the orion-web.xml and you
> >get the reason explained more fully.  Basically what you have written in
> >the broken version produces code like this:
> >
> >switch(1){
> >  // write a new line (but can't be reached!)
> >case 1:
> >  // write newline, "One", newline
> >break;
> >  // write a new line (but can't be reached!)
> >default:
> >  // write newline, "Default", newline
> >break;
> >  // write a new line (but can't be reached!)
> >}
> >
> >and the compiler complains (correctly) that some of the copde can't be 
> >reached.
> >
> >Nick Newman
> >
> >
> >
> >At 08:11 PM 2/26/01 -0500, you wrote:
> >
> > >Forgive me if this is a known bug, but I didn't see it in the FAQ or
> > >anywhere on orionsupport.com.
> > >
> > >I am using Orion 1.4.7 and I have tried having Orion use Jikes 1.12 as
> > >well as all three of the 1.30 JDKs
> > >{Sun,IBM,Blackdown}. This is all running on RedHat 7.0 Linux 2.4.2.
> > >
> > >fixed version (but I shouldn't have to do this...):
> > >
> > ><% switch(1) { case 1: %>
> > >One
> > ><% break; default: %>
> > >Default
> > ><% break;  } %>
> > >
> > >broken version:
> > >
> > ><% switch(1) { %>
> > ><% case 1: %>
> > >One
> > ><% break; %>
> > ><% default: %>
> > >Default
> > ><% break; %>
> > ><% } %>
> > >
> > >Gives the following error (this is the Blackdown error, but they're all
> > >similar)
> > >
> > >500 Internal Server Error
> > >Error parsing JSP page /jsp/test.jsp
> > >Syntax error in source
> > >/jsp/test.jsp.java:29: 'case', 'default' or '}' expected (JSP page line 3)
> > > if(__coreOut == out)
> > > __coreOut.write(__staticContent, 0, 1);
> > > ^
> > >/jsp/test.jsp.java:29: 'case', 'default' or '}' expected (JSP page line 3)
> > > if(__coreOut == out)
> > > __coreOut.write(__staticContent, 0, 1);
> > >
> >  > ^
> > >/jsp/test.jsp.java:30: 'case', 'default' or '}' expected (JSP page line 3)
> > > else
> > > com.evermind.server.http.EvermindJSPWriter.writeBytes(out,
> > > __staticContent, 0, 1, null);
> > >
> >  >  ^
> > >/jsp/test.jsp.java:35: 'case', 'default' or '}' expected (JSP page line 4)
> > > if(__coreOut == out)
> > > __coreOut.write(__staticContent, 1, 5);
> > >
> >  > ^
> > >/jsp/test.jsp.java:36: 'case', 'default' or '}' expected (JSP page line 4)
> > > else
> > > com.evermind.server.http.EvermindJSPWriter.writeBytes(out,
> > > __staticContent, 1, 5, null);
> > >
> >  >  ^
> >

RE: simple JSP bug with switch

2001-02-27 Thread Margulies, Adam
Title: RE: simple JSP bug with switch





OK, thanks, I understand that (which is how I fixed the code).


However, I believe this isn't the proper behaviour for JSP.
Orion should eat that newline. This is how other JSP engines behave,
including Sun's reference engine.


It shouldn't break the java code by inserting an erroneous println...
or am I smoking crack?



adam


-Original Message-
From: Nick Newman [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 27, 2001 11:40 AM
To: Orion-Interest
Subject: Re: simple JSP bug with switch



Hi Adam,


I don't think this is a bug, although I agree the messages are 
confusing.  Set the development="true" flag in the orion-web.xml and you 
get the reason explained more fully.  Basically what you have written in 
the broken version produces code like this:


switch(1){
 // write a new line (but can't be reached!)
case 1:
 // write newline, "One", newline
break;
 // write a new line (but can't be reached!)
default:
 // write newline, "Default", newline
break;
 // write a new line (but can't be reached!)
}


and the compiler complains (correctly) that some of the copde can't be reached.


Nick Newman





At 08:11 PM 2/26/01 -0500, you wrote:


>Forgive me if this is a known bug, but I didn't see it in the FAQ or 
>anywhere on orionsupport.com.
>
>I am using Orion 1.4.7 and I have tried having Orion use Jikes 1.12 as 
>well as all three of the 1.30 JDKs
>{Sun,IBM,Blackdown}. This is all running on RedHat 7.0 Linux 2.4.2.
>
>fixed version (but I shouldn't have to do this...):
>
><% switch(1) { case 1: %>
>One
><% break; default: %>
>Default
><% break;  } %>
>
>broken version:
>
><% switch(1) { %>
><% case 1: %>
>One
><% break; %>
><% default: %>
>Default
><% break; %>
><% } %>
>
>Gives the following error (this is the Blackdown error, but they're all 
>similar)
>
>500 Internal Server Error
>Error parsing JSP page /jsp/test.jsp
>Syntax error in source
>/jsp/test.jsp.java:29: 'case', 'default' or '}' expected (JSP page line 3)
> if(__coreOut == out) 
> __coreOut.write(__staticContent, 0, 1);
> ^
>/jsp/test.jsp.java:29: 'case', 'default' or '}' expected (JSP page line 3)
> if(__coreOut == out) 
> __coreOut.write(__staticContent, 0, 1);
> 
 > ^
>/jsp/test.jsp.java:30: 'case', 'default' or '}' expected (JSP page line 3)
> else 
> com.evermind.server.http.EvermindJSPWriter.writeBytes(out, 
> __staticContent, 0, 1, null);
> 
 >  ^
>/jsp/test.jsp.java:35: 'case', 'default' or '}' expected (JSP page line 4)
> if(__coreOut == out) 
> __coreOut.write(__staticContent, 1, 5);
> 
 > ^
>/jsp/test.jsp.java:36: 'case', 'default' or '}' expected (JSP page line 4)
> else 
> com.evermind.server.http.EvermindJSPWriter.writeBytes(out, 
> __staticContent, 1, 5, null);
> 
 >  ^
>/jsp/test.jsp.java:38: 'case', 'default' or '}' expected (JSP page line 4)
>  break;
>   ^
>/jsp/test.jsp.java:41: 'case', 'default' or '}' expected (JSP page line 6)
> if(__coreOut == out) 
> __coreOut.write(__staticContent, 6, 1);
> 
 > ^
>/jsp/test.jsp.java:42: 'case', 'default' or '}' expected (JSP page line 6)
> else 
> com.evermind.server.http.EvermindJSPWriter.writeBytes(out, 
> __staticContent, 6, 1, null);
> 
 >  ^
>/jsp/test.jsp.java:47: 'case', 'default' or '}' expected (JSP page line 7)
> if(__coreOut == out) 
> __coreOut.write(__staticContent, 7, 9);
> 
 > ^
>/jsp/test.jsp.java:48: 'case', 'default' or '}' expected (JSP page line 7)
> else 
> com.evermind.server.http.EvermindJSPWriter.writeBytes(out, 
> __staticContent, 7, 9, null);
> 
 >  ^
>/jsp/test.jsp.java:50: 'case', 'default' or '}' expected (JSP page line 7)
>  break;
>   ^
>/jsp/test.jsp.java:53: 'case', 'default' or '}' expected (JSP page line 9)
> if(__coreOut == out) 
> __coreOut.write(__staticContent, 16, 1);
> 
 >  ^
>/jsp/test.jsp.java:54: 'case', 'default' or '}' expected (JSP page line 9)
> else 
> com.evermind.server.http.EvermindJSPWriter.writeBytes(out, 
> __staticContent, 16, 1, null);
> 
 >   ^
>13 errors





simple JSP bug with switch

2001-02-26 Thread Margulies, Adam
Title: simple JSP bug with switch





Forgive me if this is a known bug, but I didn't see it in the FAQ or anywhere on orionsupport.com.


I am using Orion 1.4.7 and I have tried having Orion use Jikes 1.12 as well as all three of the 1.30 JDKs
{Sun,IBM,Blackdown}. This is all running on RedHat 7.0 Linux 2.4.2.


fixed version (but I shouldn't have to do this...):


<% switch(1) { case 1: %>
One
<% break; default: %>
Default
<% break;  } %>


broken version:


<% switch(1) { %>
<% case 1: %>
One
<% break; %>
<% default: %>
Default
<% break; %>
<% } %>


Gives the following error (this is the Blackdown error, but they're all similar)


500 Internal Server Error
Error parsing JSP page /jsp/test.jsp
Syntax error in source
/jsp/test.jsp.java:29: 'case', 'default' or '}' expected (JSP page line 3)
            if(__coreOut == out) __coreOut.write(__staticContent, 0, 1);
    ^
/jsp/test.jsp.java:29: 'case', 'default' or '}' expected (JSP page line 3)
            if(__coreOut == out) __coreOut.write(__staticContent, 0, 1);
   ^
/jsp/test.jsp.java:30: 'case', 'default' or '}' expected (JSP page line 3)
            else com.evermind.server.http.EvermindJSPWriter.writeBytes(out, __staticContent, 0, 1, null);
    ^
/jsp/test.jsp.java:35: 'case', 'default' or '}' expected (JSP page line 4)
            if(__coreOut == out) __coreOut.write(__staticContent, 1, 5);
   ^
/jsp/test.jsp.java:36: 'case', 'default' or '}' expected (JSP page line 4)
            else com.evermind.server.http.EvermindJSPWriter.writeBytes(out, __staticContent, 1, 5, null);
    ^
/jsp/test.jsp.java:38: 'case', 'default' or '}' expected (JSP page line 4)
 break;
  ^
/jsp/test.jsp.java:41: 'case', 'default' or '}' expected (JSP page line 6)
            if(__coreOut == out) __coreOut.write(__staticContent, 6, 1);
   ^
/jsp/test.jsp.java:42: 'case', 'default' or '}' expected (JSP page line 6)
            else com.evermind.server.http.EvermindJSPWriter.writeBytes(out, __staticContent, 6, 1, null);
    ^
/jsp/test.jsp.java:47: 'case', 'default' or '}' expected (JSP page line 7)
            if(__coreOut == out) __coreOut.write(__staticContent, 7, 9);
   ^
/jsp/test.jsp.java:48: 'case', 'default' or '}' expected (JSP page line 7)
            else com.evermind.server.http.EvermindJSPWriter.writeBytes(out, __staticContent, 7, 9, null);
    ^
/jsp/test.jsp.java:50: 'case', 'default' or '}' expected (JSP page line 7)
 break;
  ^
/jsp/test.jsp.java:53: 'case', 'default' or '}' expected (JSP page line 9)
            if(__coreOut == out) __coreOut.write(__staticContent, 16, 1);
    ^
/jsp/test.jsp.java:54: 'case', 'default' or '}' expected (JSP page line 9)
            else com.evermind.server.http.EvermindJSPWriter.writeBytes(out, __staticContent, 16, 1, null);
 ^
13 errors