Re: WebLogic To Orion
Greg, This has been covered in previous postings. Here's a quote from one of them (start quote) This is a configuration problem... at least it was in earlier versions. You must make sure to include the attribute 'secure=true' in the web-site tag of your secure-web-site.xml file. Also, make sure that the attribute 'shared=true' appears in each web-app tag in this same file. This cleared up the problem for me. Cheers, Derek Akers Senior Software Architect Eldan Software Limited (416) 341-0070 www.eldan.com - (end quote) Nick At 09:18 AM 10/11/01 -0500, you wrote: We have migrated a current production application from Weblogic to Orion in an test to come up with an alternative platform and have come across some issues. Most of the issues we have been able to resolve except for one involving ssl and I.E. When we bring our application up in I.E. and https Orion invalidates the session within a minute. Our application security relies on certain objects within the session for enforcement which results in the user being kicked out of the application. We are evaluating V1.3.8., has this issue been resolved, is there a resolution or workaround? Thanks Greg Flores
Re: Date conversion problem ??
Hi Eddie, The code that Fredrick Lindgren sent to this list looks like the right way of obtaining a java.util.Date from a java.sql.Timestamp. As for your question of why, part of the answer may be that three java classes are somewhat confusing: - java.util.Date (not used by JDBC) contains a date and time down to millisecond precision - java.sql.Date (used by JDBC) contains a date, and inherits from java.util.Date - java.sql.Timestamp (used by JDBC) contains a date and time down to nanosecond precision, and inherits from java.util.Date The javadoc for java.sql.Timestamp explains exactly where it stores the milliseconds (actually nanoseconds). Another question is why Sun decided to write such strange code. I'm afraid I don't have an answer for that! Nick At 10:04 AM 10/8/01 +0200, you wrote: Thanks Frederik, But what I don't understand is why Date only contains the second part and not the millisecond part and when it does ? That is, when I create a Date object and print the millisecond part with the getTime() method, I do see the millisecond part but when I receive something from the database, the millisecond part is zero. Does this mean that is only zero when the date field is handled by the JDBC part ?? Eddie snip
Re: EJB Primary Key of int
int is not a valid primary key - it has to be an object, not a primitive. Use Integer instead. Nick At 04:56 PM 10/4/01 -0400, you wrote: I can not figure out how to get Orion's EJB CMP to work when the primary key is an 'int'. In the deployment descriptor (ejb-jar.xml), the code is: prim-key-classint/prim-key-class When starting up Orion, I get: Class 'int' not found Any help will be greatly appreciated, Marc
Orion confuses entities?
I have been chasing down an intermittent bug and I'm beginning to suspect it's in Orion. I wondered if anyone else may have suspected this problem. The problem seems to be that very occasionally orion (version 1.4.7) gets confused about its cache of entity beans. To illustrate, here is a snippet from a JSP page that I wrote to test this. EnvelopeHome envHome = (EnvelopeHome) jndi.lookup(java:comp/env/ejb/Envelope); for(int k=0; k4000; ++k){ Integer oid = new Integer(k); try { Envelope env = envHome.findByPrimaryKey(oid); if( ! oid.equals( env.getOid() ) ){ out.println(The envelope obtained with key +oid+ thinks its key is +env.getOid()+br); } } catch( FinderException fe ){ // not found is okay } } At the moment, this produces the output: The envelope obtained with key 3109 thinks its key is 2957 But as I say, this happens only very occasionally. If I restart the server then everything is fine again - for quite a while, anyway. Other details: the Envelope entity is EJB 2.0 type, the primary key is set only at creation time, and there is no remote interface method which can change the primary key. (I mention this to indicate that I cannot be attempting to illegally change the primary key.) Any thoughts about this? Is there any way it can be anything but a bug in orion? Thanks, Nick
Re: how to make classes visible in web applications
Hi Peter, I suppose one could say that web-module classes should not be (and indeed, are not) visible from EJB's because that violates the layered structure of the application (the logic/storage oriented EJB's shouldn't need to know about the presentation layer). If you have a class that needs to be visible from the EJB's you could put it in the EJB module. The web module will still be able to see it. Nick At 08:42 PM 8/14/01 +0200, you wrote: Hello Orion-List-Readers! I'm working on a web application consisting of an EJB and a web module. In our application there are certain model beans which are referenced from both the EJBs and the (Struts) action-beans which belong to the web module. Without any further measures classes in one module can't use or inherit from classes in the other module. During development we set a library path in server.xml so that the classes could be referenced from both modules. Now for deployment I'm looking for a cleaner solution. Is there a way to place classes or a jar-file in an .ear-archive that the classes can be referenced from EJB and web-module without setting a path in server.xml?? regards, Peter
Re: Directory Listing
You could use the java.net.URL class from your servlet to get the directory listing that is produced. Then you can process that however you like. The snag is that you would have to have the servlet at a different URL. In other words, if http://foo.com/ gives you the directory listing, you would have to put the servlet at (say) http://foo.com/prettyList - because if you arranged to have it served from http://foo.com/ it would be trying to read its own output, which would get it rather confused, I'd think. Nick At 01:01 PM 7/27/01 +0200, you wrote: I have an application with directory-browing=allow. When I request for a directory, orion displays a page with the directory list. How could I write a JSP/Servlet to customize this list ?? TIA -- ·· Juan Fuentes Nieto Essi Projects [EMAIL PROTECTED]t +34 977 221 182 http://www.essiprojects.com f +34 977 230 170 ··
Re: cmp and saving a file to a blob
Two part answer ... 1) Another possible option is to make up a unique file name, and write the file to that. Keep the name of the file (plus mime type, etc) in the EJB. The getFile and setFile methods would read/write to this file. You could use the ejbRemove method to delete the file. (And perhaps you will need other code to keep the files consistent with the DB). This is not so pretty in some ways (you have extra things to keep straight) but it avoids the need for anything special in the DB. Then again, perhaps this violates the strict specs about use of file IO in an EJB? In any case, this is what I have (successfully) used. 2) I don't think there's any reason you couldn't use BLOBs. The specs don't include them, but the specs don't even assume you have a database, do they? Nick At 10:06 AM 7/23/01 -0700, you wrote: Problem, persisting a downloaded file in a cmp ejb. Has anybody solved this problem? It seems like this is a problem not solved by the specification. A plan of attack: 1. web user uploads file through a form. 2. servlet processes file as an ArrayList of bytes with Nick Newman's servlet (www.orionsupport.com/articles/downloads/UploadServlet.zip) with some modifications. 3. file (now a List) is a member of a cmp bean with a list type Byte. If we use this method, each byte is stored in a separate table. Kindof ugly. Talk about a large table! B plan of attack: 1. web user uploads file through a form. 2. servlet processes file as a byte array with Nick Newman's servlet (www.orionsupport.com/articles/downloads/UploadServlet.zip). 3. A class called FileBytes is created which implements Serializable, the only member is the byte array. 4. A cmp ejb with members mimetype, name, datetime, and filebytes. Both of these methods require no hacking of the orion-ejb-jar.xml. We would have to be satisfied with sql type long raw for most databases, however, since the ejb spec doesn't include blobs. This means a limit of 2 GB...not enough for a movie, but plenty large enough for anything else. Obviously we should limit the size of the file, since all of the bytes have to be in memory. Otherwise, we can break up the persitance into many 1 MB ejb's, each with part of the file. This way, we don't have to have the file all in memory at once. If anybody has done this, let me know. I would like to hear some comments, also. I will keep you posted on my experiences. Regards, the elephantwalker
Re: Fwd: file upload
Hi Christoph, Sending a file to the server is a specialized little job. The Orion server supplies some orion-specific classes to help (see www.orionsupport.com and search for 'upload'). Alternatively, I have written some generic J2EE code for the same task, and you are welcome to have that - just drop me a line. (The orionsupport guys said they'd post it on their website, but so far it's not there.) Nick, SCIENTECH Inc At 04:09 PM 7/12/01 +0200, you wrote: resending cos it didnt appear on the list for 24 hours :) This is a forwarded message From: Christoph Sturm [EMAIL PROTECTED] To: orion-Interest [EMAIL PROTECTED] Date: Tuesday, July 10, 2001, 3:27:46 PM Subject: file upload ===8==Original message text=== Hello orion-Interest, I want to stream a uploaded file to the ejb server and save it in a cmp bean. The problem is that a FileInputStream is not serializable. Whats the best way to handle this? -- Best regards, Christoph mailto:[EMAIL PROTECTED]
Re: Fwd: file upload
Hi Joe, Here it is. (I hope you didn't mind my subtle hint. I know you're busy! ;-) I think that what's in the zip is a good starting point for most uses, but if you think I should add something before you want to show it, let me know and I'll see what I can do. Thanks! Nick At 01:18 PM 7/12/01 -0500, you wrote: Nick, can you resend that to me? On Thu, 12 Jul 2001, Nick Newman wrote: Hi Christoph, Sending a file to the server is a specialized little job. The Orion server supplies some orion-specific classes to help (see www.orionsupport.com and search for 'upload'). Alternatively, I have written some generic J2EE code for the same task, and you are welcome to have that - just drop me a line. (The orionsupport guys said they'd post it on their website, but so far it's not there.) Nick, SCIENTECH Inc At 04:09 PM 7/12/01 +0200, you wrote: resending cos it didnt appear on the list for 24 hours :) This is a forwarded message From: Christoph Sturm [EMAIL PROTECTED] To: orion-Interest [EMAIL PROTECTED] Date: Tuesday, July 10, 2001, 3:27:46 PM Subject: file upload ===8==Original message text=== Hello orion-Interest, I want to stream a uploaded file to the ejb server and save it in a cmp bean. The problem is that a FileInputStream is not serializable. Whats the best way to handle this? -- Best regards, Christoph mailto:[EMAIL PROTECTED] --- Joseph B. Ottinger [EMAIL PROTECTED] http://adjacency.org/ IT Consultant UploadServlet.zip
Re: Automatic recompilation of beans/servlets
For the servlet, I think the source has to be under /WEB-INF/src for the auto-compilation. Probably for the beans too. Nick At 01:02 PM 6/17/01 -0400, you wrote: Hi, I recently made the switch from Resin to Orion Server and am mostly pleased. The only thing I cannot get working is the automatic recompilation of beans and servlets. I have development=true set in my global-web-app.xml file, and JSPs are recompiling when changed correctly. Servlets and JavaBeans (not EJBs) are not. I have my source files in the same directory as the class files. (WEB-INF/classes/com/goldbarter/servlets/GoldStatus.java for example) When doing an ls -l on the directory, the moddate for the .java is much later than the .class. I don't think there's any time synchronization issue. Thanks, -Todd Lipcon Goldbarter.com -- It's not that easy being green; Having to spend each day the color of the leaves. When I think it could be nicer being red, or yellow or gold... or something much more colorful like that. -Kermit the Frog
Re: Force Logon after X minutes
The problem is that with BASIC authentication the *browser* remembers the logon information and resends it whenever needed. Hence things like invalidating the session will not work, since the browser will simply log the user in again without their intervention. So far as I know, there is no solution to this problem. If you use BASIC authentication, the user has to shut down the browser to log off. If someone knows differently, I too would certainly love to hear the answer. Nick At 03:18 PM 6/13/01 -0400, you wrote: is it too obvious to say: send out the pages w/ an expire time set the http session expiration to a desired interval to prevent use after x minutes...create a logoff function that invalidates their session... is that too simplistic? regards, Mike Conway cybermaster wrote: % if (session != null) { session.invalidate(); } % --peter -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Smith Jason Sent: Wednesday, June 13, 2001 6:38 AM To: Orion-Interest Subject: Force Logon after X minutes I am custom user-authentication. The user and groups are in a database and I am using BASIC authentication. How can I allow users to logoff w/o them closing their browser? How can I force them to logon again after x minutes? Thxs, Jason
Re: FRUSTRATION: Session keeps timing out despite setting session-timeout. WHY?
Just grabbing at straws here, but perhaps there's a typo in the docs and the units are actually seconds, not minutes. Worth a try? Nick At 02:11 PM 6/7/01 -0700, you wrote: Hello, I have a http and https orion jsp application for which I want the session timeout to be a lot longer than the default 5 or 10 minutes BUT the session keeps timing out. I also have shared=true in the secure-web-site.xml and default-web-app.xml files. I set my web.xml file with: web-site session-config session-timeout 1000 /session-timeout /session-config /web-site Any and all help is appreciated! Keith
RE: DeadLock with 25 users SOLVED
Philippe, It's Monday morning. Could you please help my fuzzy brain by explaining WHY it is so stupid to set all transactions to required. I'm afraid it sounds reasonable to me... perhaps I don't understand what you mean by even when reading in the database. Thanks, Nick At 12:43 PM 5/14/01 +0200, you wrote: Hi, Thanks Johan and Kirk, you are both right. Those 2 parametres are usefull for tuning the app server. But pay attention, I've used the timeout (not inactivity-timeout) under 1.3.8, it doesn't work, need to upgrade to 1.4.7 for get this working. I've discover another one: In the file orion-ejb-jar.xml you could add this option ligne: call-timeout = n n = number of millisec for waiting on the EJB's interface reply, 0 for infinite. My principal error with this deadlock was to set ALL transactions to required, even when reading in the database... So stupid ;-) My bench show that 100 users could access to our app wihtout crashing! I'll try to bench the same .EAR under BEA... Regards, Philippe PAGET. -Message d'origine- De : Johan Fredriksson [mailto:[EMAIL PROTECTED]] Envoyé : lundi 14 mai 2001 10:23 À : Orion-Interest Objet : Re: DeadLock with 25 users Or decreasing the inactivity-timeout=10 so the resource is more quickly released back to the container ? Johan - Original Message - From: KirkYarina [EMAIL PROTECTED] To: Orion-Interest [EMAIL PROTECTED] Cc: PHiL [EMAIL PROTECTED] Sent: Friday, May 11, 2001 9:10 PM Subject: Re: DeadLock with 25 users I believe this is discussed in past; see the archives ( http://www.mail-archive.com/orion-interest%40orionserver.com/ ). Try increasing max-connections in data-sources.xml Kirk Yarina At 09:13 AM 5/11/01 +0200, you wrote: Hello, we just start some benchs with 25 fake users, here is the exeption: Those 25 users try to access the same EJB. Any idears, or points to check in our code to fix this kind of errors ??? Thanks. Philippe. ERROR | 09/05/2001 15:59:01:46 | NodeBmEJB : findNode(NodePK pk) | pk = (id = 0, space = WA17, componentName = news35) | Exception message: Transaction was rolled back: timed out, while waiting for (id = 0, space = WA17, componentName = news35) (started at Wed May 09 15:58:25 GMT+01:00 2001, terminated at Wed May 09 15:59:01 GMT+01:00 2001) com.evermind.server.DeadlockException: Transaction was rolled back: timed out, while waiting for (id = 0, space = WA17, componentName = news35) (started at Wed May 09 15:58:25 GMT+01:00 2001, terminated at Wed May 09 15:59:01 GMT+01:00 2001) at com.evermind.server.ejb.AbstractEJBObject.startCall(JAX) at NodeHome_EntityHomeWrapper3.findByPrimaryKey(NodeHome_EntityH omeWrapper3.ja v a:195) at com.stratelia.webactiv.util.node.control.NodeBmEJB.findNode(N odeBmEJB.java: 5 0) at com.stratelia.webactiv.util.node.control.NodeBmEJB.getFrequen tlyAskedChildr e nDetails(NodeBmEJB.java:252) at NodeBm_StatelessSessionBeanWrapper1.getFrequentlyAskedChildre nDetails(NodeB m _StatelessSessionBeanWrapper1.java:1677) at com.stratelia.webactiv.news.control.NewsSessionControl.getArc hiveList(NewsS e ssionControl.java:315) at __jspPage1_news_jsp_news_jsp._jspService(__jspPage1_news_jsp_ news_jsp.java: 4 73) at com.orionserver.http.OrionHttpJspPage.service(JAX) at com.evermind.server.http.HttpApplication.xu(JAX) at com.evermind.server.http.JSPServlet.service(JAX) at com.evermind.server.http.d4.s3(JAX) at com.evermind.server.http.d4.s1(JAX) at com.evermind.server.http.d4.forward(JAX) at com.evermind.server.http.ew.forward(JAX) at com.stratelia.webactiv.servlets.ComponentRequestRooter.doPost (ComponentRequ e stRooter.java:153) at com.stratelia.webactiv.servlets.ComponentRequestRooter.doGet( ComponentReque s tRooter.java:172) at javax.servlet.http.HttpServlet.service(HttpServlet.java:190) at javax.servlet.http.HttpServlet.service(HttpServlet.java:302) at javax.servlet.http.HttpServlet.service(HttpServlet.java:329) at com.evermind.server.http.d4.s3(JAX) at com.evermind.server.http.d4.s1(JAX) at com.evermind.server.http.eg.s9(JAX) at com.evermind.server.http.eg.dr(JAX) at com.evermind.util.f.run(JAX)
Re: User/Role problem
We have had similar problems, and I have reported them to orion (but they said they couldn't reproduce the problem). Here is what I found. If you have an EJB method foo(), and you restrict its access to a role MYROLE, then a user who, according to the XML files, should have access to foo() is denied access. If, however (and quite contrary to specs) you specify a GROUP name (e.g. MYGROUP) instead of a ROLE name (e.g. MYROLE), then access is granted (assuming your user is in that group). I would be very interested to know if you can confirm this. Nick At 03:52 PM 5/8/01 +0200, you wrote: Following situation: - I restricted method permission of method foo to role bar - if I do: roleManager.addToRole(ctx.getCallerPrincipal(),bar); foo(); everything works just fine. - if I create a (temporary) user (e.g. user123), add him to role bar then log him in with the RoleManager and finally do a foo(), I get as security-exception. (see below). Why? Are there some default-roles that I have to add a newly created user to? Are there any further group-permissions I've got to set for group bar? (I took the permissions of group users). For completeness: - I have also created a group named bar (in principal.xml) and specified a security-role-mapping (in orion-ejb.xml). - Furthermore I added a security-role definition for bar in both the application.xml and the ejb-jar.xml - I have also tried the lt;default-ejb-caller-rolegt; role and then changed the default-method-access to role bar. - I also tripple checked that ctx.isCallerInRole(bar) returns true; just the line before I call foo(). The exception: [java] javax.transaction.TransactionRolledbackException: com.evermind.server.rmi.OrionRemoteException: user123 is not allowed to call this EJB method, check your security settings (method-permission in ejb-jar.xml and security-role-mapping in orion-application.xml). [java] at com.evermind.server.rmi.bb.invokeMethod(JAX) [java] at com.evermind.server.rmi.a2.invoke(JAX) [java] at com.evermind.server.rmi.a3.invoke(JAX) Ideas, or even solutions? Armin Michel
Uploading files
In the past there has been some discussion about how to upload files to the server. The general solution is to use the O'Reilly servlet authored by Jason Hunter. That seems to work well, and it's nice of him to offer it. I took a look at RFC 1867 describing the upload format, and found that it's based on MIME, just like email attachments. As such, I thought that the Java Mail API (which is required to be present in a J2EE platform) could be used to do much of the work. Turns out it can. All the parsing can be done in essentially one line of (non-library) code! I put together a class (200 lines, half of them comments) using this approach, and a demo servlet to call it. Seems to work fine. Even if it doesn't do quite want you want, you should be able to modify it easily. Following Jason's example I'll offer it to anyone that wants it. (You don't even have to buy my book!) Just drop me a line, and promise to tell me about any bugs you find. Nick Newman, SCIENTECH Inc.
Removing Dependent Objects
Hi, I have an application in which an entity bean has a collection of dependent objects. When I ask for one of these dependent objects to be removed, Orion generates a SQL command with a WHERE clause which specifies all of the columns of the DO. If some of these columns are null, Orion generates WHERE ... COL = NULL ..., which is not valid SQL (should be COL IS NULL). With some databases this causes the remove to fail. Has anyone else had this problem and found a way to work around it? Thanks, NIck
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
RE: simple JSP bug with switch
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]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.j
RE: Orion FORM based authentication Configuraton problem
I suppose that you could use the SAME page for login and error. You could tell which context it's being called in by playing with a session variable, I think. That should give you the flexibility you want, and all within spec. Nick Newman At 11:31 AM 2/26/01 -0700, you wrote: I agree with Jeff the Servlet 2.2 Spec only specifies that an error page is returned - so Orion's behaviour is up to spec. To allow continuation of the login process from loginError page would be an add-on ... cerrtainly a useful one, because it's more user friendly. But of course, it is Orion's developers who call the shots. --peter -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Jeff Schnitzer Sent: Monday, February 26, 2001 8:06 AM To: Orion-Interest Subject: RE: Orion FORM based authentication Configuraton problem If I'm reading the steps correctly, this behavior is actually fully spec-compliant. This is the reason I don't use FORM-based login. j_security_check is only required to be valid immediately after an attempt to visit a secured page. There is no provision to be able to re-enter credentials from the failure page, and the Orion implementation doesn't allow it. The user must hit the back button :-( Also, Orion performs a forward() rather than a redirect() when a successful login does occur. Thus the ugly url in the user's browser. I logged bug #126 against this issue but it was denied :-) Jeff
Re: What documentation?
I think I can answer the second question about the dangling sentence. In the DTD the tag description looks like this: !-- The deployment info for a J2EE-application. Manually created or automatically produced when auto-deploying a J2EE-application (.ear). It extends and substitutes the assembly info found in the -- !ELEMENT orion-application (ejb-module*,web-module*,client-module*,security-role-mapping*, persistence?, library*, principals?, mail-session*, user-manager?, log?, data-sources?, namespace-access?) and from that it seems fairly clear that the intention was for the sentence to run on into the tag name. That is, the author thought it would be fairly clear that it was supposed to end " ...assembly info found in the orion-application". Unfortunately, once the automatic formatting tool got through with it to produce the HTML documentation it is nothing like so clear! (At least, that's my guess. Anyone got anything better?) Nick Newman At 05:37 PM 2/26/01 -0600, you wrote: A few weeks ago after I asked some questions and posted some opinion I was sent by some guys to RFM. Well, I still have the same problems and I am asking the same question: why is not possible to use a GUI tool to specify all I want for deploying my application? Why do I need to go into the application-deployments folder and modify what Orion has alredy deployed. If you are stuck and still do not get go and play with Sun's RI or WebLogic and ypu will udnerstand what I mean. Speaking about documentation and RFM please go into "orion-application.xml.html" and read this: "The deployment info for a J2EE-application. Manually created or automatically produced when auto-deploying a J2EE-application (.ear). It extends and substitutes the assembly info found in the " Where is the rest of the sentence? Sayonara! Danut _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
RE: No influence on CMP 2.0 getter setter methods - a feature or abug?
My two cents ... Putting checks in the EJB's will give you much better information on exactly what has gone wrong. Adding checks in the DB as well can't hurt, but without the EJB checks it might be hard to know what action to take in the face of a generic SQL error. Nick Newman At 01:11 PM 2/22/01 -0500, you wrote: The search engine is back up. Here is the start of the thread on database constraints vs. ejb constraints: http://archives.java.sun.com/cgi-bin/wa?A2=ind0007L=ejb-interestP=R49824 http://archives.java.sun.com/cgi-bin/wa?A2=ind0007L=ejb-interestP=R49824 There seems to be some smart-ass named "Robert Krueger" who thinks he knows all the answers :) :) :) Thanks Robert! -tim -Original Message- From: Robert Krueger [mailto:[EMAIL PROTECTED]mailto:[EMAIL PROTECTED]] Sent: Thursday, February 22, 2001 4:42 AM To: Orion-Interest Subject: RE: No influence on CMP 2.0 getter setter methods - a feature or abug? At 19:16 21.02.2001 , you wrote: hi, check EJB-INTEREST archives for discussions on this. I think most pros and cons (including my view on things ;-) were in a discussion a few months ago. at the moment the server hosting the search seems to be down, so I cannot give you the exact thread. regards, robert This makes we want to ask a question that has nagged me for a while. Where do you put data constraints? In the database? or in the entity bean? For example, let's say we have a field called "absoluteTemp" in Kelvin. We all know this value can never be negative (in my universe anyway). This isn't a business rule, it a law of nature. Do you implement it as a database constraint which will throw a SQLException if violated, or do you check for in some facade-setter of the entity and throw some other Exception if violated? What are the pros and cons of either? -tim (-) Robert Krger (-) SIGNAL 7 Gesellschaft fr Informationstechnologie mbH (-) Brder-Knau-Str. 79 - 64285 Darmstadt, (-) Tel: 06151 665401, Fax: 06151 665373 (-) [EMAIL PROTECTED], www.signal7.de
Re: Factoring EJB Homes from within Session EJB
Hi, We go one step further and use a plain class with static methods to obtain Home interfaces - one method per Home. The class uses a stateless session bean just as you describe for the FIRST lookup, but thereafter uses a cached value that it saves. That makes the scheme both more efficient and simpler to use (because the client can just write MyHomeFinder.getMyBeanHome() rather than having to go through the steps of looking up the stateless session bean). If you decide to try this scheme PLEASE NOTE that the client code STILL REQUIRES an ejb-ref for the stateless session bean. This is because the plain class is running in the same context as the client, and it may have to find the stateless session bean. Nick At 12:42 PM 2/7/01 +0100, you wrote: Hello Christian, CB I noticed that I needed to reference all the homes of my EJBs within the CB web.xml and I wanted to know if it was recommended/safe to create one CB stateless session bean which has all the ejb-ref needed in its ejb-jar.xml CB and only reference that stateless session bean from my web app. This way my CB web app only needs to know about one Session Bean and that bean's CB responsibility is factoring other home. CB Does anyone see any problem with this approach? We did that for our project and it works fine. One 'SystemBean' session beans has all ejb-refs, and all other beans only need to know about the SystemBean and can call a getHome( String jndiName ) to obtain home interfaces.. I don't see any disadvantages except of the small performance decrease, because you have an additional bean lookup/method call. But as far as I can see, this decrease is very very small. Greetings from Munich, /Thomas -- | /Thomas Hertz | [y] hybris GmbH | Software Engineering | | [EMAIL PROTECTED] | Schwere-Reiter-Strasse 35 | tel +49 89 306697- 0 | | www.hybris.de | Haus 16, D-80797 Muenchen | fax +49 89 306697-99 | | pgp fingerprint: D070 5D86 BE2D C3AF E2CC D2D8 C29A 7F68 7407 629E |
Re: Form-based authentication not working right
Gerald, I tried your exact example (see attached zipped up web app) and everything worked just as it should (using orion 1.4.5). Once again I ask, what happens if you remove the security and simply request the secured page? Nick At 03:52 PM 2/5/01 -0800, you wrote: Recently I asked about form-based authentication. I appreciate the help several people gave, but from the responses I got it seems that I might have miscommunicated somehow. I'm going to try again, this time explaining myself better. snip FormLogin.zip
Re: Form Login bouncing me to welcome page!
All I can guess is that your /Login.jsp contains a redirect to "/", which will then show your welcome file, if you have one declared. What happens if you remove the security constraint and THEN request /Login.jsp? If you STILL get the welcome page, then security clearly isn't the problem. Nick At 01:34 PM 2/1/01 -0800, you wrote: I agree that is the correct sequence, but that is not what I get. Assume I have a welcome file defined called welcome.jsp. The sequence of events is: - User requests secured page /Login.jsp - User is redirected to LoginForm.jsp - User enters correct credentials - User is logged in - User is displayed the contents of welcome.jsp. OR: - User requests secured page /Login.jsp - User is redirected to LoginForm.jsp - User enters INCORRECT credentials - User is NOT logged in - User is STILL displayed the contents of welcome.jsp. I also had the case where I didn't have a welcome file defined, but had directory browsing enabled, and I get the directory contents after doing the above sequences. This doesn't seem right to me, but I can't figure out what is wrong. What can cause this? Gerald. At 09:30 AM 2/1/2001 -0700, you wrote: The sequence of events is: - The user requests a secured page (/Login.jsp, in your case). - The server intercepts the request and redirects to the form-based login page (LoginForm.jsp) - If the user logs in successfully, the server allows the original request to proceed (ie. Login.jsp is displayed). So if by "the welcome page" you mean the Login.jsp page, then that is as expected. If you see something else, then this could possibly be the result of something you do on that page (such as redirection). Nick At 10:19 PM 1/31/01 -0800, you wrote: I've searched the mailing list, but there doesn't seem to be information on this. I'm a little desparate now. I'm using a form-based login for my web application. When a user hits Login.jsp, s/he must log in. I have the LoginForm.jsp and LoginError.jsp files in / of my context root. This redirection to the LoginForm.jsp does occur, but regardless of whether the user logged in successfully or not, he is dumped back to the welcome page. The actual logging in is successful, i.e. if he provided the correct credentials, he's logged in, but still dumped back to the welcome page. Here is the relevant portion of my web.xml: security-constraint web-resource-collection web-resource-nameLoginTrigger/web-resource-name descriptionLoginTrigger/description url-pattern/Login.jsp/url-pattern http-methodGET/http-method http-methodPOST/http-method /web-resource-collection auth-constraint role-nameportal_gamer/role-name /auth-constraint /security-constraint login-config auth-methodFORM/auth-method realm-namedefault/realm-name form-login-config form-login-pageLoginForm.jsp/form-login-page form-error-pageLoginError.jsp/form-error-page /form-login-config /login-config security-role role-nameportal_gamer/role-name /security-role Which part of the magic am I missing?
Re: JSP Syntax
That seems odd. Could you please tell us what the two versions produce. That might help. Nick At 04:53 PM 2/1/01 +0100, you wrote: I have two very similar lines of code - one of them causes a weird syntax interpretation on Orion. According to my reference books the two expressions should produce the same result. Does anyone know why these expressions work differently on Orion? Correct on Orion: p/sub%= t.getString() %/p Incorrect on Orion: p%= "/sub" + t.getString() %/p FYI: I am using 1.3.8. R.
Re: Form Login bouncing me to welcome page!
The sequence of events is: - The user requests a secured page (/Login.jsp, in your case). - The server intercepts the request and redirects to the form-based login page (LoginForm.jsp) - If the user logs in successfully, the server allows the original request to proceed (ie. Login.jsp is displayed). So if by "the welcome page" you mean the Login.jsp page, then that is as expected. If you see something else, then this could possibly be the result of something you do on that page (such as redirection). Nick At 10:19 PM 1/31/01 -0800, you wrote: I've searched the mailing list, but there doesn't seem to be information on this. I'm a little desparate now. I'm using a form-based login for my web application. When a user hits Login.jsp, s/he must log in. I have the LoginForm.jsp and LoginError.jsp files in / of my context root. This redirection to the LoginForm.jsp does occur, but regardless of whether the user logged in successfully or not, he is dumped back to the welcome page. The actual logging in is successful, i.e. if he provided the correct credentials, he's logged in, but still dumped back to the welcome page. Here is the relevant portion of my web.xml: security-constraint web-resource-collection web-resource-nameLoginTrigger/web-resource-name descriptionLoginTrigger/description url-pattern/Login.jsp/url-pattern http-methodGET/http-method http-methodPOST/http-method /web-resource-collection auth-constraint role-nameportal_gamer/role-name /auth-constraint /security-constraint login-config auth-methodFORM/auth-method realm-namedefault/realm-name form-login-config form-login-pageLoginForm.jsp/form-login-page form-error-pageLoginError.jsp/form-error-page /form-login-config /login-config security-role role-nameportal_gamer/role-name /security-role Which part of the magic am I missing?
Re: What is this strange error?
Gerals, For what it's worth, the principals.xml you specify below causes me no deployment problems if I replace one of my own files with it. Perhaps the problem is that orion isn't finding your file at all? The place that orion is looking for application.xml is specified in the orion-application.xml file. Nick At 11:13 AM 1/23/01 -0800, you wrote: I'm trying to deploy a very simple application, and am getting the error "Invalid principals config URL: principals.xml". What in the world does this mean? I've had this problem all the way from 1.3.x up to 1.4.5 and no one has been able to tell me what it means, or why it happens, or what I must do to get rid of it. It is not documented anywhere. Can someone, perhaps those who work on Orion, PLEASE tell me what this means. The Error: ... Copying default deployment descriptor from archive at C:\k\wrk\test\SingleSignon \Alpha\bld\alpha-app/META-INF/orion-application.xml to deployment directory C:\a \orion\application-deployments\alpha-app... Error instantiating application at file:/C:/k/wrk/test/SingleSignon/Alpha/bld/al pha-app.ear: Invalid principals config URL: principals.xml for alpha-app Auto-deploying file:/C:/a/orion/default-web-app/ (New server version detected). ... My orion-application.xml is: ?xml version="1.0"? !DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.2//EN" "http://java.sun.com/j2ee/dtds/application_1_2.dtd" application display-nameAlpha/display-name module web web-urialpha-web.war/web-uri context-root/alpha/context-root /web /module security-role descriptionUsers/description role-namesingle_signon_user/role-name /security-role /application My principals.xml: ?xml version="1.0"? !DOCTYPE principals PUBLIC "//Evermind - Orion Principals//" "http://www.orionserver.com/dtds/principals.dtd" principals groups group name="single_signon_user"/ /groups users user realname="Gerald" username="gerald" password="abc" group-membership group="single_signon_user"/ /user /users /principals
RE: Single Sign On
Hi Tony, It only took me two days to find the email I was referencing! It was direct to me rather than through orion-interest. Here is the relevant part: (This is what I asked) The J2EE spec makes it clear that single sign-on for web-based applications should be supported (J2EE spec, section 3.4.1.1). The specification says: "It must be possible for one login session to span more than one application, allowing a user to log in once and access multiple applications." Could you please explain how Orion makes this possible. We are particularly interested in using form-based login with the form being on a secure (HTTPS) server although the application(s) may be on a non-secure server. (This is what Magnus Stenman of Orion replied) Setting up the same web-app and mark is with shared="true" should handle that part. (web-app shared="true" ... / in both sites). The sessions will then be shared and also the logins since login is tied to session with form auth. Let us know how that works out. We'll look into sharing of logins across different web-apps but this is not a trivial thing to do in general (single signon is more targeted towards SSL and basic auth in general). Hope this helps! Nick At 11:37 AM 1/18/01 +, you wrote: That's interesting. I tried using certificate based security for SSO (even though that doesn't *really* fit with the way we want to do things ... although it's better than BASIC), but it didn't seem to be happen for me. Do you have a record of the correspondence you had with the Orion folks (regarding SSO and FORM based auth) ? If you do, I would be most grateful if you could post it. At the moment, info on this subject is really hard to come by. I'm sure you guys are finding the same problem - if not, please tell me where all the docs are ;) Tony. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Nick Newman Sent: 16 January 2001 17:52 To: Orion-Interest Subject: RE: Single Sign On Hi, We had a similar problem. The solution we came up with was to use BASIC authentication for all the relevant web-apps, and to specify the same realm-name for each web-app. That way, the browser supplies the required logins as you switch between web-apps. Yes, it would be nicer to use FORM based login, but so far as we could tell (with some help from the orion folk) this does not work with SSO. They (orion) indicated that certificate based security was a better fit for SSO, as I recall. Nick At 09:53 AM 1/16/01 +, you wrote: Gerald, Did you ever get any direct replies to this SSO query ? We are trying to do the same. Maybe we could work together in some way ? Kind regards, Tony. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Gerald Gutierrez Sent: 02 December 2000 20:09 To: Orion-Interest Subject: Single Sign On Does Orion do any sort of single sign-on for multiple applications deployed on the same application server? If so, how can one get this working?
Re: Having trouble forcing browser-side XSL transformations
Jeff, It looks as if you are not telling the page about its content type. Add the tag: %@ page language="java" contentType="text/xml" % That may get you further. Nick At 11:57 AM 1/19/01 -0600, you wrote: Hi Folks, Although I'm an experienced Java and Web developer, I'm very new to Orion and am trying a tactic that I've seldom seen mentioned on this newsgroup. My search of posts for the last few months shows one person doing something pretty similar, but recommendations to his note haven't solved my problem. Basically, I would like a JB to emit pure XML into a JSP which wraps it in the proper code to cause IEv5.5 to perform the XML/XSL transformation (instead of the server). I've been able to get this logic to work in other web crafting environments (Tango and ASP), but have not been able to get it to work from JSPs. I've got a local JB (ClassInfoBean2.java) with a method that emits a chunk of XML. The following code is in the associated JSP. [NOTE: The xsl:output... lines were the recommendation I found in a note from 1/8/01 who's subject is "XSL on Orion returns content type text/xml instead of text/html". Whether these lines are present or not has made no difference.] This JSP code is about as simple as it gets. ?xml version="1.0"? ?xml-stylesheet type="text/xsl" href="ClassInfo2.xsl"? xsl:output method = "html" indent = "yes" doctype-system = "http://www.w3.org/DTD/HTML4-strict-dtd" doctype-public = "-//W3C//DTD HTML 4.0//EN" media-type= "text/html" / jsp:useBean id="ClassInfoBeanId" scope="session" class="school.ClassInfoBean2" / jsp:setProperty name="ClassInfoBeanId" property="*" / root jsp:getProperty name="ClassInfoBeanId" property="xmlData" / /root The associated XSL file is too long to try to post in this note. The content probably isn't a part of the problem since the browser doesn't even try to do the transformation. When I copy the following XML into an XML file, the browser loads the file and performs the transformation perfectly. However the browser refuses to perform the transformation when the same XML is emitted from a JSP file. Here's the XML output that the JSP emits: ?xml version="1.0"? ?xml-stylesheet type="text/xsl" href="ClassInfo2.xsl"? xsl:output method = "html" indent = "yes" doctype-system = "http://www.w3.org/DTD/HTML4-strict-dtd" doctype-public = "-//W3C//DTD HTML 4.0//EN" media-type= "text/html" / root titleClass Info/title stylesheetresources.css/stylesheet studentinfo id234567890/id /studentinfo class id23/id nameThisName/name descrRelatively lon Description/descr sectionThisSection/section deptThisDept/dept maxsize18/maxsize credits3/credits startdate1-18-2001/startdate starttime13:00/starttime finishtime15:30/finishtime buildingthisBuilding/building roomthisRoom/room /class /root Now when this is sent to IEv5 (with the latest XSLT updates installed), the XSL file should be loaded and used to transform the XML data into the appropriate HTML--but this is not happening and I can't tell what's missing. Specifically, I can't tell if the browser isn't able to find the XSL file (thus the subject of this note), or if the browser doesn't know that this is really an XML page that warrants XML/XSL processing, or if the browser thinks there's a valid reason (ie., security) to avoid doing the transformation. No errors are produced, the browser simply refuses to do the transformation. In this setting, I have several questions. 1. Given the ?xml-stylesheet... statement shown above, where should I put the XSL file? Perhaps with the JSP files? (This worked for the CSS files in this project.) Perhaps a different path in the href value would be appropriate? Any suggestions? 2. Do I need to explicitly tell Orion to handle XSL and/or CSS file types? There wouldn't be much for Orion to do except emit their contents 'as is' and let the downstream device do the processing. If I don't do this then it would seem that these files would be (apparently) served from a different server (http://whatever:8080/something vs http://whatever/something). I mention this because it occurred to me that the browser's sandbox might be interfering with loading the XSL file from what appears to be a different domain that where the original page is served from. My gut feeling is that this shouldn't be necessary, but I don't want to leave any stone unturned in this search. 3. There's a possibility that the browser is confused since the URL ends in JSP but I'm returning XML content. That is, the browser may not realize that it is appropriate for it to do the XSL transformation. The first two lines should remove any of the browser's doubt about the content type of the page, but since nothing I've done has made a difference I don't want to
Writing user managers
Hi, I seem to recall someone within the last few weeks saying that they implemented the UserManager and other associated interfaces in just a few days. Would whoever it was care to drop me a line please. Thanks Nick
RE: Single Sign On
Hi, We had a similar problem. The solution we came up with was to use BASIC authentication for all the relevant web-apps, and to specify the same realm-name for each web-app. That way, the browser supplies the required logins as you switch between web-apps. Yes, it would be nicer to use FORM based login, but so far as we could tell (with some help from the orion folk) this does not work with SSO. They (orion) indicated that certificate based security was a better fit for SSO, as I recall. Nick At 09:53 AM 1/16/01 +, you wrote: Gerald, Did you ever get any direct replies to this SSO query ? We are trying to do the same. Maybe we could work together in some way ? Kind regards, Tony. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Gerald Gutierrez Sent: 02 December 2000 20:09 To: Orion-Interest Subject: Single Sign On Does Orion do any sort of single sign-on for multiple applications deployed on the same application server? If so, how can one get this working?
Traversing JNDI namespace
Hi, How can I find what's in an entity bean's java:comp/env namespace? If I ask the InitialContext for a list of what is in it (using initialcontext.list("") ) I get a list of things (mainly home interfaces) plus entries for "java:comp" and "ejb" which are both Contexts. If I ask for what's in "java:comp" I get a few strange entries, but NOT one for "env", which is the one I would have expected. If I ask for what's in "java:comp/env" I get nothing back (empty context). However, lookups for entries named java:comp/env/foo succeed where they should. Any ideas? Thanks, Nick
Re: dependent object - deepCopy()?
Hi Tim, The important word in the error message is ABSTRACT. In other words, you DON'T implement it! You just write: public abstract Address deepCopy(); and orion does the rest. Nick At 12:13 PM 10/16/00 -0400, you wrote: I have an EJB, Contact, and a dependent object, Address. I have the deployment descriptor setup using the dependents and relationships area (based on another user's post). When I deploy, Orion throws this message at me: Error Compiling file ...: The dependent class tfc.Address should implement a "public abstract tfc.Address deepCopy() method" How do I implement this? Where is the documentation on this method? I tried: public Address deepCopy() { Address a = new Address(this.street1, this.street2, ); return a; } but I still got the same error upon deployment. Any ideas? -tim
Re: Invalidating an Entity bean
Hi Peter, I'm not claiming guru-hood, but as far as I know you CAN'T do that cleanly. My thoughts on your best options are: 1) Tell Orion that the entity beans do not have exclusive write-access to the database by setting exclusive-write-access="false" in the orion-ejb-jar.xml (which is orion-specific). I believe this causes the data to be re-read at the start of every transaction. 2) Re-write your session bean to makes its database changes through the entity beans rather than through direct JDBC. Nick At 12:02 PM 10/12/00 +0100, you wrote: Hi gurus How do I do this cleanly. I have and Entity that has attributes A,B,C and D. These attributes are all read from database tables. A and B are read from Table 1 C and D are read from Table 2 So I have Entity Bean 1, this is loaded by the app server (perhaps by a findByPrimaryKey) method. This means that Entity Bean 1 is now a cache of the data in A,B,C and D. However while this entity bean is in the cache, via a session bean I change the data of C and D in table 2. This mean that Entity Bean 1 now has dirty data. So the question is how do I force the Entity beans to do and EJB Load. Also the data in C and D in table 2 may be shared by N number of entity beans so I may need to refresh N number of Entity Beans depending on which ones are in the cache. I only want to call EJB load for Entity beans currently in the cache and of these I only want to call ejb load for the ones that refer to the changed data. Cheers Peter
RE: Invalidating an Entity bean
Sorry, but as I said, there is (as far as I know) no clean (ie. portable) way to tell an entity bean to refresh itself. The specs even specifically say that an entity bean does NOT have to worry about the database being changed "behind its back" (although you should peraps check the exact details). I agree that separate entity beans seem to be too small. How about using dependent objects? If you had a big entity bean that contained Collections of dependent objects (images and text) then changing these dependent objects inside the bean will leave the bean in a "clean" state. The changes will be persisted to the DB automatically. (EJB 2.0 would perhaps be better than EJB 1.1 for this approach). I'll have to leave you to decide if that's really workable. If you decide you have to stick with direct JDBC access to write to the DB from a Session bean, then I think you'll be stuck with non-portable solutions. Good luck! Nick At 07:59 PM 10/12/00 +0100, you wrote: the situation is this. this is the current data model I have and entity bean called "Content" this repsents 1 row in a table called "content". The content enitity bean can have N number of images (corresponds to n number of rows in the images table) and N number of text blocks (corresponds to n number of rows in the text table). However images and text blocks are independent of content. Content is only a grouping of these assets if you like. So we get a many to many relationship. 1 content can reference many images 1 image can be referenced by many content. (same for text) so when a content entity bean loads up it loads into its attributes all the data from the images and text that it references. So lets assume all this data is now in a cache. if i then change the data in an image or text independently of the entity bean (perhaps by a session bean) then the data that is cached in the entity bean is dirty (does not match what is in the database). SO how do i notify the entity bean to refresh it's self ? Another model you hinted on was that Image and text could be enitity beans. They are certainly independent enities (qualify as enities). However i consider them to be too fine grained. For example text block could be as small as "hello this is a sentance" which is just a small string and so wrapping this small string in an entity bean seem way too much overhead. But the flip side is it would so the cache problem. the session bean would do updates via the image and text beans and so they would always contain the correct data. And content would get the data from the image and text entity bean each time. However if the content has 50 text block and 50 images that is 100 calls (one to each of the entity beans that represent this data), which as you see is a major overhead Any thoughs on how i best model this..... cheers -Original Message- From: Nick Newman [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 12, 2000 5:08 PM To: Orion-Interest Subject: Re: Invalidating an Entity bean Hi Peter, I'm not claiming guru-hood, but as far as I know you CAN'T do that cleanly. My thoughts on your best options are: 1) Tell Orion that the entity beans do not have exclusive write-access to the database by setting exclusive-write-access="false" in the orion-ejb-jar.xml (which is orion-specific). I believe this causes the data to be re-read at the start of every transaction. 2) Re-write your session bean to makes its database changes through the entity beans rather than through direct JDBC. Nick At 12:02 PM 10/12/00 +0100, you wrote: Hi gurus How do I do this cleanly. I have and Entity that has attributes A,B,C and D. These attributes are all read from database tables. A and B are read from Table 1 C and D are read from Table 2 So I have Entity Bean 1, this is loaded by the app server (perhaps by a findByPrimaryKey) method. This means that Entity Bean 1 is now a cache of the data in A,B,C and D. However while this entity bean is in the cache, via a session bean I change the data of C and D in table 2. This mean that Entity Bean 1 now has dirty data. So the question is how do I force the Entity beans to do and EJB Load. Also the data in C and D in table 2 may be shared by N number of entity beans so I may need to refresh N number of Entity Beans depending on which ones are in the cache. I only want to call EJB load for Entity beans currently in the cache and of these I only want to call ejb load for the ones that refer to the changed data. Cheers Peter
RE: getting EJB home from JSP
Hi Krishnan, Is that REALLY your code? If so, the problem is probably that you declare the variable on the left to be a CategoryHome, but the right hand side is a CategoryManagerHome. The fact that Orion returns a CategoryManagerHome_StatelessSessionHomeWrapper3 rather than a CategoryManagerHome is expected; after all, the home is an interface, not a class, and so cannot be instantiated. Nick At 11:14 AM 10/9/00 -0700, you wrote: Hi, I am casting the narrowed object properly my code is CategoryHome catHome = (CategoryManagerHome)PortableRemoteObject.narrow( ctx.lookup("java:comp/env/CategoryManager");, CategoryManagerHome.class); but this throws up a wrong ( maybe intermediate class) .(CategoryManagerHome_StatelessSessionHomeWrapper3). I am using Resin as the servlet/ web server now and it works fine ( as resin acts like any other java client would do). I would rather use orion for the full setup if i can get over with this problem. Thanks Krishnan
Re: Home interfaces and stateless session beans
At 01:20 PM 10/11/00 -0400, you wrote: Sorry for the newbie question... In the business methods in my stateless session beans I've always done what seems like the usual pattern - lookup and narrow entity bean home interfaces in the method that uses them. However, to save some time, I'd like to do these lookups in the SLSB's ejbCreate method and save them in instance variables. I've rtfm, along with RMH, and can't see a reason why this wouldn't work, both with Orion and portably. Have I missed something? Yes. Table 3 of EJB1.1 spec doesn't say that enterprise bean access is available from the ejbCreate method of a stateless session bean. (Hence it isn't.) Better yet, can these be put into a class field and only looked once, rather than every bean instance. For example private static BeanHome beanhome = null; ... ejbCreate() { ... if(beanhome == null) { beanhome = (lookup/narrow beanhome... ) } ... } I don't see why not, so long as you don't try to populate them from ejbCreate. Why not use a getBeanHome() method which acts as a cache? ie private static BeanHome beanhome = null; private BeanHome getBeanHome(){ if( beanhome==null ) .set the variable return beanhome; } I believe that there could conceivably be more than one instance of this static variable in a distributed application (multiple VM's) but nevertheless I don't see a problem with this solution. Nick
Re: Home interfaces and stateless session beans
I think that you would be pushing the specs by doing that! I think that the access to the JNDI is there to let you connect to other resources (eg. database) rather than home interfaces. At 04:37 PM 10/11/00 -0400, you wrote: Could table 3, which says that jndi access to java:comp/env is available in ejbCreate, support the home interface lookup, but not it's use? I.e. the returned home interface could be saved and used later, but a hi.create() would not be valid in ejbCreate()? At 12:07 PM 10/11/00 -0600, you wrote: At 01:20 PM 10/11/00 -0400, you wrote: Sorry for the newbie question... In the business methods in my stateless session beans I've always done what seems like the usual pattern - lookup and narrow entity bean home interfaces in the method that uses them. However, to save some time, I'd like to do these lookups in the SLSB's ejbCreate method and save them in instance variables. I've rtfm, along with RMH, and can't see a reason why this wouldn't work, both with Orion and portably. Have I missed something? Yes. Table 3 of EJB1.1 spec doesn't say that enterprise bean access is available from the ejbCreate method of a stateless session bean. (Hence it isn't.) Better yet, can these be put into a class field and only looked once, rather than every bean instance. For example private static BeanHome beanhome = null; ... ejbCreate() { ... if(beanhome == null) { beanhome = (lookup/narrow beanhome... ) } ... } I don't see why not, so long as you don't try to populate them from ejbCreate. Why not use a getBeanHome() method which acts as a cache? ie private static BeanHome beanhome = null; private BeanHome getBeanHome(){ if( beanhome==null ) .set the variable return beanhome; } I believe that there could conceivably be more than one instance of this static variable in a distributed application (multiple VM's) but nevertheless I don't see a problem with this solution. Thanks! Nick Kirk Yarina [EMAIL PROTECTED]
Re: Oracle pooled connections?
Hi Gary, The JNDI name should be "java:comp/env/jdbc/OracleEJBDS" - you missed the "env". Odd thing about the com.evermind.sql.ConnectionDataSource class. I assumed it would be in the orion.jar, but I don't see it there. Perhaps something to do with the obfuscation technique that they use? Nick At 04:29 PM 10/6/00 -0600, you wrote: I have set up the data-sources.xml file using Oracle, following the advice of Magnus R. at orion, the result looks like: ?xml version="1.0"? !DOCTYPE data-sources PUBLIC "Orion data-sources" "http://www.orionserver.com/dtds/data-sources.dtd" data-sources data-source class="com.evermind.sql.ConnectionDataSource" connection-driver="oracle.jdbc.driver.OracleDriver" connection-retry-interval="1" ejb-location="jdbc/OracleEJBDS" inactivity-timeout="30" location="jdbc/OracleDS" max-connect-attempts="3" max-connections="100" name="oracle-inst1" password="change_on_install" pooled-location="jdbc/OraclePooledDS" schema="database-schemas/oracle.xml" url="jdbc:oracle:thin:@localhost:1521:inst1" username="sys" xa-location="jdbc/xa/OracleXADS" / /data-sources With this data-sources file I don't even have a java:comp/jdbc Context, much less the right entries. I am unable to verify that a class named ConnectionDataSource even exists. Magnus said to use the jdbc/OracleEJBDS source for connections, claiming they would be automatically pooled. So far I'm not getting anywhere! Ideas? Gary
Re: ONe - one dependent relation - orion bug?
I reported this in Bugzilla as #45, #46. (I don't know how it got there twice!) Nick At 04:07 PM 9/26/00 -0700, you wrote: Hi, whenever i try to persist a 1-1 relationship between a bean and dependent class i get the following exception during deployment Auto-deploying Cart (ejb-jar.xml had been touched since the previous deployment) ... CartEJB_PersistenceManager2.java:87: Incompatible type for =. Explicit cast needed to convert cart.CartItem to CartItem_Dependent0. this.cartItem = value; ^ 1 error Is this an Orion Bug. THe same classes work fine if i use 1-many relationship? Thanks much Krishnan
Re: Cascade Delete
Hi, If you are using EJB 2.0 then (according to the draft specs) it is up to you to decide if dependent objects are deleted or not. However, if you are using EJB 1.1 and are storing a Collection of things in an Entity bean, then IMHO the container MUST delete the dependent objects along with the entity. I have reported this as bugzilla # 52. See that for further details. Nick At 04:53 PM 9/26/00 -0700, you wrote: Hi, Having some problems while deleting a EJB. When i delete the ejb by ejbobject.remove() method the dependent objects and relationship entries are not deleted from the database. Should this not be done automatically by the app server. Is this a problem in Orion or is there some explicit delete that needs to be done in the remove method implementation in the bean. Would appreciate any help on this. Thanks Krishnan
RE: Cascade Delete
I don't think it's wrong to call business methods from ejbRemove. See bugzilla bug #37. Nick At 12:53 PM 9/27/00 -0700, you wrote: Hi, Regarding the same cascade delete problem. I have a clearFields() method which empties each of the collection holding relationships or dependent objects. If i call this from the client the objects gets deleted properly. But if i call this inside the ejbRemove() ( call clearFields() then call ejbStore()) this is not deleted in the database! Is it wrong to call such methods from ejbRemove? Thanks Krishnan -Original Message- From: Nick Newman [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 27, 2000 9:13 AM To: Orion-Interest Subject: Re: Cascade Delete Hi, If you are using EJB 2.0 then (according to the draft specs) it is up to you to decide if dependent objects are deleted or not. However, if you are using EJB 1.1 and are storing a Collection of things in an Entity bean, then IMHO the container MUST delete the dependent objects along with the entity. I have reported this as bugzilla # 52. See that for further details. Nick At 04:53 PM 9/26/00 -0700, you wrote: Hi, Having some problems while deleting a EJB. When i delete the ejb by ejbobject.remove() method the dependent objects and relationship entries are not deleted from the database. Should this not be done automatically by the app server. Is this a problem in Orion or is there some explicit delete that needs to be done in the remove method implementation in the bean. Would appreciate any help on this. Thanks Krishnan
Re: SV: FORM based login ACTION
Hi, I hope I'm not being too silly here, but one possible explanation is that you are directly presenting the logon form from your code. A security login will work only if you let the server present the form. You do this by specifying the appropriate security in the web.xml, and then when you try to reach a secured page, orion will pop up the password dialog. Nick At 09:59 AM 9/20/00 -0300, you wrote: Hi.. It remains not working, with the same message: 404 Not Found Anybody else have another idea? []s Guilherme Ceschiatti [EMAIL PROTECTED] On Wed, 20 Sep 2000, you wrote: Try clear your ACTION so the form starts like this: form lots of html with a couple of fields for user and passwd... /form This works for me :) Hi! I'm having problems in loging into my application. I'm using FORM based login, with a form with the ACTION="j_security_check". When I submit the form, Orion just replies: 404 Not Found Is it a bug? How do I fix it? []s Guilherme Ceschiatti [EMAIL PROTECTED]
Re: How to use EJB2.0 on Orion
Perhaps the EJB 2.0 spec on javasoft would be a place to start. The whole thing is quite long, but Chapter 9 explains the new persistence mechanism, and that's probably all you need. The main differences (but by no means all the differences) are: 1) you need to specify the appropriate dtd at the top of the ejb-jar.xml, so that the first few lines look like: ?xml version="1.0"? !DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.2//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_2_0.dtd" 2) the "bean" class is abstract, and has pairs of abstract get/set methods instead of data fields for the persistent fields. Nick At 10:19 AM 9/20/00 -0700, you wrote: Please for God's sake some benevolent soul do reply to this mail. I have been sending this mail for quite some time but to no avail. Can somebody send me the source code of EJB2.0 based ATM example or any other example of how to use EJB2.0 on Orion. I am running version 1.3.1 and the ATM that has come with this is still EJB1.1 based. TIA Vimal __ Do You Yahoo!? Send instant messages get email alerts with Yahoo! Messenger. http://im.yahoo.com/
Re: How to use EJB2.0 on Orion
I gather the ATM EJB 2.0 app is out now - but perhaps a very simple app will still be useful. See attached. The only problem I have had with EJB 2.0 in Orion is trying to do a 1-1 mapping to a dependent class. Nick At 12:43 PM 9/20/00 -0700, you wrote: Thanks a lot Nick. Can you also send me a sample code or whatever and moreoever, have you yourself been able to get this stuff working on Orion? Vimal snip ejb2.zip
Re: Doubts on finder methods orion-ejb-ar.xml
Hi Sven, The field names should be the "name", not the "persistence-name". So you should use "$1 = $_fantasia". You can check this by viewing the generated SQL after deployment. I'm not sure about the LIKE construction - but it sounds reasonable. Nick At 10:23 AM 9/19/00 -0300, you wrote: I have a couple of doubts concerning the finder-method tag. specifically, I would like to implement a query like "select * from table where field LIKE '%value'" Considering I have: cmp-field-mapping name="_fantasia" persistence-name="FANTASIA" / in my orion-ejb-jar.xml. and the docs tell me: finder-method partial="true|false" query="$1 = $myField AND $myOtherField 5" I suppose (not really clear in the docs) that $1 is the value passed to the finder method and $MyField is the persistence name, in the above example FANTASIA and not _fantasia. Is that correct? in this case can I create a query like: finder-method query="$1 LIKE '%' + $FANTASIA + '%'" Sven -- == Sven E. van 't Veer http://www.cachoeiro.net Java Developer [EMAIL PROTECTED] ==
RE: User/Group manager guide
Hi Arved, Can I suggest you try the following. In the ejb-jar.xml file that specifies the ejb security, specify the GROUP name instead of the ROLE name. (Even though that's the wrong thing to do.) Then delete the orion-ejb-jar.xml file (to get rid of the old references to the role name that are in there). Then redeploy and try again. If that works, maybe you could throw your weight behind Bugzilla report #55 so we can get it fixed! Nick At 10:26 AM 9/19/00 -0300, you wrote: I'm looking forward to docs and examples myself. One thing that I've noticed, after copious experimentation with the DataSourceUserManager, is that the group = mapping is somewhat deficient. In other words, I have my users and groups tables set up, and I've made suitable mods and adjustments to principals.xml, orion-application.xml, ejb-jar.xml, and orion-ejb-jar.xml as required (or suggested). In some cases I'm flailing about, frankly. In any case, a login with username and password is obviously finding the group, and mapping the group to role, because when I check the role after login it's OK. I don't have to hardcode it, which is vital. However, and I've tried everything, I don't believe this knowledge is being passed on to the EJB container. No role, however declared in the various J2EE/Orion descriptors, is able to access *any* method in an EJB that has method-permissions. So my assessment on the user/role managers is that it is reasonably useful: one can assign roles based on login, and test for that as required. But method-level security in EJBs does not work, at least not in a documented, demonstrated and reliable manner. The odd thing is, is that this may not be that much of a big deal. I've been writing J2EE for pretty much a full year, and I have yet to see a situation where method-level permissions gain me anything at all. It's literally never been necessary. It seems to be one of these J2EE things that made ostensible sense at the time but has little practical value. Just a thought. The only reason it disturbs me is because it should work and doesn't. :-) If an example can be supplied - complete with Orion-specific deployment descriptors - I'll be overjoyed. Arved Sandstrom -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Lawrence Fry Sent: Monday, September 18, 2000 6:36 PM To: Orion-Interest Subject: RE: User/Group manager guide Guilherme, Here Here! I'm glad somebody said it. But without documentation, you should look at the archives to this list, because many of these problems have already been worked out. For example...it isn't said anywhere in the documentation, but the EJBUserManager is the most useful device for ecommerce. With this, you can automatically login users and create users for your website...without one call to the EJBUserManager stuff. In order to use this, you will have to add the following to your orion-application.xml file: user-manager class="com.evermind.ejb.EJBUserManager" property name="home" value="com.evermind.ejb.EJBUser" / property name="defaultGroups" value="users" / /user-manager I found this tidbit in the mail archive. Then you can use the role manager to allow users access to ejb resources, and the role manager automatically uses the your databank with cmp to create userscreate a user like this: try { RoleManager roleManager = (RoleManager)new InitialContext().looku("java:comp/RoleManager"); if(roleManager.getPrincipal(username) != null) throw new DuplicateAccountException(username) Principal principal = roleManager.createPrincipal(username, password); roleManager.addToRole(principal, role); roleManager.store(); } catch(NamingException e){} catch(UserAlreadyExistsException e){} catch(InstantiationException e){} catch(IOException e){} and like magic, a user database is created. Of course, you also have to make sure your roles are part of your groups. This is the great secret of orion...great stuff, no documentation! It took me weeks to figure this out. I wish there was a tutorial on these simple issues: How do you login in a client through a database of usernames/passwords? How do you enroll a client into a database of usernames/passwords? How do you control access to web resources (ejb's, jsp's, servlets)? The existing documentation on this is about as clear as mud. Regards, Lawrence -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Guilherme Ceschiatti Sent: Monday, September 18, 2000 1:58 PM To: Orion-Interest Subject: User/Group manager guide Hi! I'm almost leaving Orion because the lack of documentation, mainly about how to manage User/Groups. As many people have lots of doubts related to it too, I'm asking the Orion team or anybody else to write a tutorial about it. I really don't want to leave Orion, because I've made good things on it, but I'm spending a lot of time trying to
Re:
Sorry James, I didn't realize that you were working with a remote client. I'm not the guy to be helping you with that... Nick At 07:34 PM 9/19/00 +1000, you wrote: On Mon, 18 Sep 2000 08:54:01 -0600, you wrote: Hi Nick, Um...I cannot have it as the same app...this is what my system looks like... EACH supplier, will have a EJB deployed, which can be called from this 'virtual supplier'. So the EJBs are deployed at the supplier's side, wheras the servlet is deployed at the virtual supplier side.. :(( 3) I have been told to use the global EJB name (or something like that) to lookup the EJB? so I thought "Stamp" would be the one.. :(( I've tried using java:comp/env/Stamp, it is just not found...maybe that's because they are in different apps...I think it would worth a try to deploy them locally in one app to test it out... 4) What exactly is that passwd/id for in the context? isn't that used to access the directory/naming service in Orion? Sorry if I sound too silly, as I am a newbie in orion/EJB stuff. :) Thanks heaps for your help.. regards, James. Hi, 1) I think the EJB and the servlet will have to be two modules in the same application. 2) The ejb-ref should NOT be commented out. 3) The lookup string should be "java:comp/env/Stamp", not "Stamp" 4) The context should be set calling just new InitialContext() without args (the id/password being supplied in the datasource.xml). Good luck! Nick At 06:56 PM 9/18/00 +1100, you wrote: Hi all, I have a urgent problem regarding EJB and servlet, I cannot find the home interface of the bean from the servlet (whereas a standalone client works very well)...Can anyone pls give me some hint as to what maybe be wrong here? Below is the background info, sorry, it is kind of long... snip
Re: Deletes with Complex OR Mapping
Hi Bill, Inside the ejbRemove method (which is called automatically by the container) just ask it to remove the "child" beans. Nick At 01:24 PM 9/19/00 -0400, you wrote: Is there a way to instruct the container to delete ejbs referenced from parent ejbs that are being deleting (something like a cascading delete) when using CMP? If not, What is the best way to do this, expecially if you are passing a value object passed in through a session bean (Details pattern @ www.theserverside.com)? I ask this because I've been spoiled by a feature in TOPLink where you can define an object reference as "privately" owned and it will be automatically deleted. If marked as not private, then you have to manually delete it. TIA, Bill = Bill Smith Senior Software Engineer iXL, Inc. 4600 Cox Rd. Glen Allen, VA 23060 tel: 804.217. fax: 804.217.8890 [EMAIL PROTECTED] This message is intended only for the use of the Addressee and may contain information that is PRIVILEGED and CONFIDENTIAL. If you are not the intended recipient, dissemination of this communication is prohibited. If you have received this communication in error, please erase all copies of the message and its attachments and notify us immediately.
Re:
Hi, 1) I think the EJB and the servlet will have to be two modules in the same application. 2) The ejb-ref should NOT be commented out. 3) The lookup string should be "java:comp/env/Stamp", not "Stamp" 4) The context should be set calling just new InitialContext() without args (the id/password being supplied in the datasource.xml). Good luck! Nick At 06:56 PM 9/18/00 +1100, you wrote: Hi all, I have a urgent problem regarding EJB and servlet, I cannot find the home interface of the bean from the servlet (whereas a standalone client works very well)...Can anyone pls give me some hint as to what maybe be wrong here? Below is the background info, sorry, it is kind of long... snip
Re: Security Role-Group/user mapping
Hi Denis, Yes! Thank you! I have reported this problem several times myself (before bugzilla). I found that if you change your ejb-jar.xml file to (incorrectly) use the GROUP name instead of the ROLE name, then access is granted. However, the behaviour also depends on where you specify the mapping between the group and the role. From your problem I guess you are specifying it in orion-application.xml. If you specify it in orion-ejb-jar.xml (for just one particular module rather than for the whole application) then it works as expected. Hopefully now that two of us have reported the same problem, it will finally get fixed! Nick At 02:35 PM 9/18/00 -0500, you wrote: Hello, After many time spent in trying to implement a demo J2EE application with security, I discovered a bug in the mapping between role and user/group process. snip
Re: general questions
Check the manifest.mf file inside the orion.jar file. That answers at least part of your question: the server starts with the main() method of com.evermind.server.ApplicationServer. Nick At 12:03 PM 9/15/00 -0400, you wrote: I've been having the worst time debugging some functionality, and was wondering: - Is there a way to check the class path the server is using? To check if it loaded the Path from the server.xml file correctly, or what its using and - What method does the server invoke first when started with the "java -jar -orion.jar"? any info would really help
Re: EJB question
Hi Kit, I'm not sure that I tell you for SURE why it failed, but here are a few thoughts. Firstly, I think that some of the code you write is unnecessary. What I would have written is: Context context = new InitialContext(); // No properties required Object homeObject = context.lookup("java:comp/env/MyCart"); // Note the required "java:comp/env/" prefix CartHome home = (CartHome)PortableRemoteObject.narrow(homeObject,CartHome.class); Cart cart = home.create(); // No cast required - home.create() returns a Cart But that probably didn't cause your problem. I would guess that it was caused by a discrepancy between the class types specified in the XML and in the code. Firstly note that in the WEB-INF/web.xml you should have a section looking something like the following: ejb-ref ejb-ref-nameMyCart/ejb-ref-name ejb-ref-typeSession/ejb-ref-type homecom.acme.MyCartHome/home remotecom.acme.MyCart/remote /ejb-ref (If you don't, the "lookup" will fail, even though it may have worked without the "java:comp/env/" prefix.) Then the error you have seems to be saying that what is in the home part of the xml doesn't match the CartHome class that is being used in your Java code. Hope this helps! Nick At 03:05 PM 9/14/00 -0400, you wrote: Hi all I am trying to build a servlet client to look up an ejb. But, i got the following error. 500 Internal Server Error java.lang.ClassCastException: CartHome_StatefulSessionHomeWrapper1 at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java, Compiled Code) at testCart.doGet(testCart.java, Compiled Code) at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code) at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code) at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code) at com.evermind.server.http.du.rr(JAX, Compiled Code) at com.evermind.server.http.du.forward(JAX, Compiled Code) at com.evermind.server.http.d5.rx(JAX, Compiled Code) at com.evermind.server.http.d5.rw(JAX) at com.evermind.util.f.run(JAX, Compiled Code) this is what i did to do the look up. final Properties properties = new Properties(); properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,"com.evermind.server. ApplicationClientInitialContextFactory"); properties.setProperty(Context.PROVIDER_URL,"ormi://localhost/ejbsamples"); properties.setProperty(Context.SECURITY_PRINCIPAL,"username"); properties.setProperty(Context.SECURITY_CREDENTIALS, "password"); Context context = new InitialContext(properties); Object homeObject = context.lookup("MyCart"); CartHome home = (CartHome)PortableRemoteObject.narrow(homeObject,CartHome.class); Cart cart = (Cart)PortableRemoteObject.narrow(home.create(), Cart.class); Can anyone tell me why it failed ? Thanks a lot. -kit
RE: Specifying finder-methods (full query)
At 08:57 PM 9/12/00 +0200, you wrote: Thanks for the reaction (also Nick). I realize now the potential security problems by allowing full specification of SQL on the client. Unfortunately the "Bob" example does not solve my problem. I managed to implement that example. That is where I came from. From there I tried to continue to implement a Query By Example frame and that's where I got stuck. Something like this: Say you have a table with products and you would like to create a flexible query frame for those products to run queries like all products for which the stock is low and which are purchased from comp xyz, or all products from categorie abc with names like %nic%. With specifying the query in orion-ejb-jar I came as far as either specifying a fixed name / number or you can use another fixed operator, e.g. '' or LIKE. Due to generated the quotes I could not let the client generate the selection part of the where clause. You get roughly the same error as when generating the whole statement. Probably you can write some ?Session? Bean that will query direct on the database returning a collection of primary keys, but for some reason that does not sound like music to me. Hi Frank, I apologise that my earlier reply was a bit off the mark. I hadn't read the whole email carefully enough to realize exactly what it was that you wanted to do. So far as I know, the accepted solution to your problem is exactly the one you tend to reject; using a stateless session bean to perform the direct SQL queries for you. I agree that this sounds a little unsatisfactory. After all, shouldn't the entity bean do everything to do with the entities? A slightly more elegant solution may arrive when EJB 2.0 is fully implemented. In EJB 2.0 the home interface of an EJB can also define arbitrary (non-finder, non-create) methods. That may be a more logical place to put a home-grown finder perhaps? Nick
RE: OR mapping of table joins for CMP
Hi Cory, Perhaps I can help a little... With CMP it is largely up to the server (orion) to decide how it will store its data. Books will generally not discuss the details of the storage precisely because it is up to the server vendor to decide. If you need complete control over the storage scheme, use BMP, not CMP. That said, it may still be quite possible for you to use CMP. In your example it looks like your two tables contain (id, first_name, job_id) and (job_id, job_description). Now, suppose you created two entity beans: - one called Job which has a primary key of job_id and a String field of job_description - one called Person which has a primary key of id, a String field of first_name, and a Job field of job_id. If you did this you would find that Orion would auto-create tables that are basically identical in form to those that you have, but probably with different names. If you now go into the orion-ejb.xml file that orion generates you can change the table and column names to those that you already have. When you have done this, you have the two tables linked transparently by Orion. Just asking for a Person will automatically retrieve the Job, and from that you can retrieve the job_description. I've skimmed a few details, but if you've played with Orion a bit I think you should be able to get it to work. Also, although what I have told you will work, I will not make any claims about this being the BEST solution for you! Nick At 05:47 PM 9/11/00 -0400, you wrote: If I have two tables and I would like to join them using CMP how would I accomplish that? So in essence I'm trying to do something like: select table1.id, table1.first_name, table1.job_id, table2.job_description from table1, tables2 where table1.job_id = table2.job_id; And perhaps any description on how to do the OR mapping for EJB. I have all of the books and can not seem to find the detail that I need to do CMP. Thanks, Cory At 03:55 PM 9/11/00 +0100, Joe Walnes wrote: Can somebody please point me to a good reference for managing joins across multiple tables while using CMP? There was a thread on the list that somebody pointed me to previously but it did not really give the information I needed. I just want to be able to specify tables and fields to do joins on with Orion for CMP. If you could go into a bit more detail about the problem, I'm sure someone could help you out. This might be what you're after: http://www.orionsupport.com/complex-or.html -Joe Walnes
Re: naming context problem
The non-bean should "inherit" the naming context of the EJB session bean from which it was called. Are you sure that you have specified the appropriate ejb-ref for the TestDocument1 entity bean in the xml for that session bean? Nick At 12:50 PM 9/6/00 -0400, you wrote: I have a servlet that finds/creates a session bean. The session bean instantiates a non-bean java object. That java object tries to find an EJB, but fails with the usual: javax.naming.NameNotFoundException: java:comp/env/ejb/TestDocument1 Why? Aren't the servlet, java object, and EJB all running in the same JVM and context? I've tried the three usual methods for finding the EJB: 1) Context ctx = new InitialContext(); Object boundObject = ctx.lookup("java:comp/env/ejb/TestDocument1"); 2) this one wants the application-client.xml: java.util.Properties props = new java.util.Properties(); props.setProperty("java.naming.factory.initial","com.evermind.server.Applica tionClientInitialContextFactory"); props.setProperty("java.naming.provider.url","ormi://localhost/docmgr"); props.setProperty("java.naming.security.principal","zzz"); props.setProperty("java.naming.security.credentials","zzz"); Context ctx = new InitialContext(props); Object boundObject = ctx.lookup("java:comp/env/ejb/TestDocument1"); 3) same as #2 but with RMIInitialContextFactory: props.setProperty("java.naming.factory.initial", "com.evermind.server.rmi.RMIInitialContextFactory"); Any hints as to what I'm doing wrong? -tim
Re: Help: Mapping roles to users.
Hi Karl, I find the ATM code is very confusing. It uses the security role name "users", and the config/principals.xml file defines a group named "users", and apparently these two concepts are magically united. Where is the group assigned to the role? How does the atm's own principals.xml fit in to the scheme? To try to answer these questions I assembled the smallest and simplest application I could think of (attached). I am fairly convinced that it demonstrates a bug in the security mechanism in orion. (And I have reported this, but not the extra information that I have just discovered - see below). The application contains one very simple stateless session EJB which delivers a "hello world" message. All of the methods are defined to be accessible to the "TestRole". The orion-application.xml assigns the "TestGroup" to the "TestRole". The principals.xml defines the "TestGroup" and a user named "nick" with password "newman" who is in the "TestGroup" (and hence in the "TestRole"). The application also contains two jsp pages, which are also made accessible to the "TestRole". The first page prints request.getRemoteUser() (which displays "nick") and request.isUserInRole("TestRole") (which displays "true"). This works as expected, and tends to suggest the mappings work. The second page tries to print the message from the session bean, but the access is denied ("nick is not allowed to call the ejb/Hello.create(...) method") After MUCH frustration and experimentation I have just found that if the ejb-jar.xml file is changed to set the role-name to TestGroup (not TestRole!) then access is granted. (You may have to delete the orion-ejb-jar.xml to get rid of existing references to TestRole before deploying). Surely access should be granted in terms of roles, not groups? Thanks, Nick Newman, SCIENTECH Inc At 05:11 PM 8/18/00 +0200, you wrote: Hello Dave and others, we'll post some better explanation on this soon, but until then, have you gotten the ATM to work with the user management? It is a good example of using roles and users in Orion Regards, Karl Avedal Dave Smith wrote: This has been a long running problem that I never received an answer to, despite much discussion on this list. SecurityBug.ear
Re: HELP: Transaction was rolled back: timed out
Hi Vidur, I think that your problem stems from the specifications themselves. See the EJB1.1 spec section 9.1.11 about concurrent access to an entity bean. As a work-around, you could perhaps copy the information from the entity bean to a normal bean, and share that. Nick Newman, SCIENTECH At 04:53 AM 7/30/00 -0400, you wrote: Hello, I need help in working around this exception. Here's the scenario. In a stateful session bean, a particular method takes several seconds (and maybe even a minute or so) to execute. While executing it _reads_ another entity bean. The session bean is marked "transaction required" and uses the default isolation setting. At any given time, there are several such session beans executing. My understanding is that since Orion does not support optimistic concurrency, the entity bean is "locked" by the first session while it is executing. Hence, any other session can not read the entity bean till the first session completes. Is my understanding correct? How can I workaround this? Is there a more general pattern I can use for allowing multiple clients concurrent read-only access to the entity beans? Thanks, Vidur
Re: new to orion datasources one simple question
Hi Robert, I certainly don't claim to fully understand, but it is my belief (from previous mailings - including from the Orion developers) that you should always be using the ejb-location. So why are the others there? I don't know..! Nick Newman, SCIENTECH Inc At 07:32 PM 7/30/00 -0400, you wrote: Hi, I am using a JDBC 2.0 driver and configured the data-sources.xml with this driver. I want to know which JNDI location I should be looking up to getConnection() in my application to use connection pooling - these are the choices: location="jdbc/DefaultDS" pooled-location="jdbc/DefaultPooledDS" xa-location="jdbc/xa/DefaultXADS" ejb-location="xx" Could someone explain when you use each of these contexts for a 2.0 driver. I'm especially confused about using location or pooled-location contexts.
Re: Wrapping orion around an existing database
Hi Jason, The EJB 1.1 specs do not specify how, or even if, an entity bean can be mapped on to an existing database. So I guess the answer is no, there is no correct way (nor incorrect way). Changing the persistent field names in the orion-ejb-jar.xml seems to be the best (only?) way to do it in Orion. Nick Newman, SCIENTECH Inc At 08:31 PM 7/30/00 -0700, you wrote: I'm looking into using orion to talk with a mySQL database that already exists (actually will exist). Is there a 'correct' way to map EJB's to existing tables (or any tools)? Or do I just create EJB's with the same name(s) and have persistent members that match the names of the existing table fields? Example table below: CREATE TABLE news ( title TEXT NOT NULL, linktext TEXT, sm_date VARCHAR(12) NOT NULL, sm_time TIME NOT NULL, ctprovider VARCHAR(255), copyright VARCHAR(255), author VARCHAR(255), body TEXT NOT NULL, photo_count VARCHAR(12), doc_id VARCHAR(255), rev_id INT, abstract TEXT, filter VARCHAR(255) NOT NULL, id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ) Thanks Jason Amy [EMAIL PROTECTED]
Re: Did someone get roles working ? How about Web Single Signon?
Hi David, I share some of your concern over this single-signon issue. I too read the specs and believe that they imply just what you say. The best I can offer as a solution today, however, is what I have already mentioned; use BASIC authentication, and specify the SAME realm-name for every web-app of interest. With that arrangment, the user will have to sign-on only once. As for the other user manager classes, I don't have any source of information other than the Orion-API section of the Orion docs. Nick Newman, SCIENTECH Inc At 11:09 AM 7/31/00 -0400, you wrote: - With FORM authentication, the browser does NOT know that authentication has been requested - it simply serves the login form like any other. That means that it cannot re-send the login information for you. It is also my belief that the session information (in which the authentication information is stored on the server side) cannot be shared between different apps /web-apps. (The "shared" option refers to sharing session information between sites that serve the SAME web-app.) This means that users will have to log-on to every app individually. According to the spec, "Web Single Signon" as specified in the J2EE bluprints, Page 3-13. It requires that the same login session represents a user to all the applications that they access. Can this be done for a single web-site/multiple applications.instead of multiple web-sites and applications? I thought servers are required to support this. - Also note that usernames and passwords do not HAVE to be supplied in the principals.xml file. The Orion team has supplied methods to obtain them from a database or from some other system via entity beans. Check the different user managers for these features. I hope this helps. Since it may be of interest to others I have copied it to a few other groups. Hope you don't mind. I've noticed these classes, but have no idea how to use them.is there documentation I don't know about? Or should I just know from reading the spec? Most of the spec/blueprints is just theory w/some xml config.can you write the steps, including modifications to all XML files..and how to use the UserManger's? I'm really frustrated right now trying to get all my sites to work with a single login and not making the user have to log in over and over. David
Re: orion on linux not serving jsp from /examples
Oops. I got your follow-up email about 5 seconds too late ... !! Hi Sven, Did you follow the installation instructions - the part about putting tools.jar into orion's directory? That might be the problem. Nick Newman, SCIENTECH At 02:52 PM 7/21/00 -0300, you wrote: I've just installed orion on my linux box and tried to access the example jsp's in the default web-app context, but I get an error 500. The servlets work however. I run orion on Linux RH 6.1 with jdk 1.2.2 RC2 (sun). I've also installed orion on my NT box where it serves jsp's just fine.. (with jdk1.3). Is this a jdk problem ? sven -- == Sven van 't Veer http://www.cachoeiro.net Java Developer [EMAIL PROTECTED] _/_ The answer / \ to the ultimate questionnnn|. .|nnn 42 =U== ==
Re: Entity beans and database
Hi Rick, The EJB spec says that once the entity bean is loaded from the database, the container (Orion) doesn't have any responsibility to keep track of any possible changes to the database. So what you are doing is basically sneaking behind Orion's back. The consequences of this depend on the circumstances, I believe. Here's my best guess ... Suppose the server had not been busy for quite a while. Under these conditions Orion would have written all its entity beans back to the DB and removed them from memory. If you now empty the DB, then all the entity beans are gone (in the sense that trying to find one from its primary key will fail). If the server is extremely busy when you emtied the DB, then all the entity beans may well have been in memory, and they will get recreated in the DB when Orion writes them out. Hope that helps. Nick Newman, SCIENTECH At 04:14 PM 7/20/00 -0400, you wrote: If I have entity beans associated with a table in a database, and I delete all the records in the database outside of the application server, ( .ie using the database command interactive SQL program ) what happens to the entity beans. ? When I try to recreate a record that I erased outside of the application server, I am told that the entity already exists. Thanks.
Finder methods
Congratulations on releasing v1.0. It is a nice feature that orion writes the custom finders for CMP in some cases. For those cases where it cannot, would it be possible to permit the user to give it a hint? For example: public interface FooHome extends EJBHome { .. public Foo findByActiveId (int id) throws RemoteException,FinderException; public static final String findByActiveId_sql = "$id=$1 and $active=1"; } You do a similar thing for object/relational mapping. Thanks, Nick