New OrionSupport article: Create custom user-authentication
Ok, (finally) got an article up on OrionSupport about implementing a custom UserManager that authenticates user from your own database (Relational DB, XML, LDAP, NT Domains, proprietary app, etc). Provides you with a SimpleUserManager allowing you to hook it up to your own system by just implementing 3 methods. http://uk.orionsupport.com/articles/usermanager.html Hope it's useful. -Joe Walnes
Re: Orion with tomcat!!!
At 16:54 28/02/2001 -0500, JangHo Ki wrote: Hello. I know it has been mentioned in serveral times. However, I could not make Orion as EJB server work with Apache Tomcat. A servlet is placed to access ejb at tomcat's WEB-INF/classes directory, along with application-client.xml under META-INF directory. The servlet looks as follows: *snip* Hashtable env = new Hashtable(); env.put("java.naming.factory.initial", "com.evermind.server.ApplicationClientInitialContextFactory"); env.put("java.naming.provider.url", "ormi://localhost:800/hello-planet"); env.put("java.naming.security.principal", "admin"); env.put("java.naming.security.credentials", "admin"); You should set the java.naming.factory.initial property to 'com.evermind.server.rmi.RMIInitialContextFactory', otherwise the web-app behaves like a J2EE client (which requires application-client.xml). -Joe Walnes
[New article on OrionSupport] Using PostgreSQL with Orion
Tim Drury has written a very nice step by step for configuring PostgreSQL and Orion for use with each other. http://www.orionsupport.com/articles/postgres.html -Joe Walnes
Re: Cocobase integration
I would be interested if the cocobase O/R mapping tool could be used to create BMP beans for orion. I`m very interested in orion and I would be glad if I could use cocobase to generate my BMP beans. Martin, It is possible to use Cocobase for O/R mapping from BMP entity beans using it's standard persitence mechanisms (I've never done it, but see no reason why it shouldn't). However you may save yourself a lot of time by using Orion's built in O/R mapping support for CMP entity beans. http://www.orionsupport.com/articles/complex-or.html -Joe Walnes
RE: weird Orion 1.4.4 JSP bug
As well as what Scott pointed out, This is invalid: webwork:param name="name" value=webwork:property name="$user"/ / ... as custom tags cannot contain other custom tags within attributes. Try something like: webwork:param name="name" value="%= something %" / (Scriptlets are allowed inside attributes - also, remember quotes). And... You may have problems with this: !-- webwork:include page="/request.jsp" -- ...as JSP will still interpret the tag... the result will just be in HTML comments. In order to stop JSP ignoring this tag, try: %-- webwork:include page="/request.jsp" --% -Joe Walnes At 17:03 15/12/2000 +1100, you wrote: AFAIK you cannot close a tag with parameters: /webwork:isnotnull name="$name" Try without the parameter -Original Message- From: Hristo Stoyanov [mailto:[EMAIL PROTECTED]] Sent: Friday, 15 December 2000 11:51 To: Orion-Interest Subject: weird Orion 1.4.4 JSP bug Hi-, It looks like The Orion 1.4.4 code generator for jsps has an error. First, here is the JSP itsel and below is the error message =JSP page= %@ taglib uri="webwork" prefix="webwork" % !-- webwork:include page="/request.jsp" -- webwork:notexists name="$name" webwork:isnotnull name="$name" webwork:include page="/template/standard/text.jsp" webwork:param name="label" value="User name:"/ webwork:param name="name" value=webwork:property name="$user"/ / /webwork:include webwork:include page="/template/standard/password.jsp" webwork:param name="label" value="Password:"/ webwork:param name="name" value=""/ webwork:param name="size" value="10"/ webwork:param name="maxlength" value="15"/ /webwork:include /webwork:isnotnull name="$name" /webwork:notexists Error message== Error parsing JSP page /webapp/login.jsp Syntax error in source/login_content.jsp.java:44: 'while' expected. } ^ /login_content.jsp.java:45: 'catch' without 'try'. catch(Exception __jspE2) ^ /login_content.jsp.java:57: 'try' without 'catch' or 'finally'. } ^ /login_content.jsp.java:57: '}' expected. } ^ 4 errors __ Do You Yahoo!? Yahoo! Shopping - Thousands of Stores. Millions of Products. http://shopping.yahoo.com/
Re: SV: Orionserver php
what exactly do you mean by "compile PHP as a servlet"? Isnt PHP written in C/C++? It's written in C and comes with different wrappers for executing it, the most common being a standalone CGI process or compiled into Apache as a module. However, there is also a Servlet wrapper, which uses JNI to bind to the native code. The advantages of using this over the standalone CGI executable are: - Speed (a new process does not need to be forked for each request, and the engine is reused) - Access to Java objects - PHP can construct objects, access attributes, methods and properties. - Request, Response, Session, RequestDispatcher, etc objects available to PHP page - Runs in same context. Calls to EJBs do not have to be passed over RMI The downside to running PHP as a Servlet is that it's tricky to install, and because it uses JNI it's not protected by the VM. There will be a howto for setting this up appearing on orionsupport.com within the next few days if you're interested. -Joe Walnes
Re: Orionserver php
Yes it does, and very well indeed. Nice thing is that PHP can interact with Java objects (such as EJB's) so it makes for a nice presentation layer. I await the flames. -Joe Walnes At 10:19 12/12/2000 +0200, you wrote: Hello folks, has anyone mixed orionserver and php? If you don't want to install Apache, but enable php, will it run over orionserver? Regards, Jukka
Re: SV: Orionserver php
Or, if you're feeling daring... Compile PHP as a servlet and then place the classes and necessary servlet-mappings in your web-app. Then from your PHP, you can do stuff like: % $ctx = new Java("javax.naming.InitialContext"); $myHome = $ctx-lookup("ejb/MyBean"); $me = $myHome-findByPrimaryKey($id); % Name: %= $me-name % Age: %= $me-age % (hypothetical example). It's nice because servlet/JSP controllers can forward to or include PHP pages as if they are normal servlet/JSP pages, and PHP can access EJB's, ServletRequest, etc etc. Useful when Java is too scarey for web-developers. -Joe At 13:35 12/12/2000 +0100, [EMAIL PROTECTED] wrote: This is actually VERY easy to do, just compile a normal php cgi executable without apache integration and install it in your path... Dont touch anything in orion, but restart it... Then make a file in your default webapp or something containing the following to test if it works: info.php - filename contents: ?php info(); ? If this shows a nice page with php information youre off and running :) Klaus Myrseth -Opprinnelig melding- Fra: Joe Walnes [mailto:[EMAIL PROTECTED]] Sendt: 12. desember 2000 13:07 Til: Orion-Interest Emne: Re: Orionserver php Yes it does, and very well indeed. Nice thing is that PHP can interact with Java objects (such as EJB's) so it makes for a nice presentation layer. I await the flames. -Joe Walnes At 10:19 12/12/2000 +0200, you wrote: Hello folks, has anyone mixed orionserver and php? If you don't want to install Apache, but enable php, will it run over orionserver? Regards, Jukka
RE: Off topic: development tools
While we're in the mood for 'me too' Together Control Center www.togethersoft.com is my main IDE/Modeller. I use it for initial analysis (use-cases, class-diagrams), through to design of system (db design, objects, patterns, frameworks, EJBs, interactions), then to actualy develop code, and finally through to deploying on Orion and debugging. Keeps me happy. I like it because it focuses on real enterprise app design. Alongside it I use: ant - to aid in the build process jikes - to save time cvs - to control my code textpad/vi - because sometimes I just need to jump to the source without consuming 100mb memory :) homesite - for JSP development -Joe Walnes -Original Message- From: Jarek Skreta [mailto:[EMAIL PROTECTED]] Sent: Lunes, 11 de Diciembre de 2000 8:03 To: Orion-Interest Subject: Off topic: development tools Hello everybody, I am in the process of selecting an IDE for developing J2EE applications on Orion. I would appreciate any advice on the subject. I've noticed from emails that JBuilder is quite popular. Other contenders that I know off are: Visual Café, JDeveloper (Oracle flavour of JBuilder), public domain tools like Ant, etc. The features I am mainly interested in are: ability to develop for different Apps Servers, visual debugging, validation of conformance with specifications (e.g. for EJBs). I will be grateful for your comments and recommendations. Thanks, Jarek Skreta
New howto on orionsupport: Configuring Cocoon
Article explaining how to use Cocoon on Orion. Includes: - advantages of using it - wrapper to allow XSP to work - add-on package to allow Cocoon to function as a Filter - how to use Cocoon to process JSP, Servlets, and virtually anything else. http://www.orionsupport.com/articles/cocoon.html Hope it is useful. -Joe Walnes
Re: Running two instances of Orion on the same IP and port
Setup the first instance of Orion as usual. Setup the 2nd instance of Orion on a different port. Use TunnelServlet in Orion 1 to forward requests to Orion 2 for necessary vhosts. -Joe Walnes At 21:46 28/11/2000, you wrote: Orioners, Has anyone ever tried to run two instances of Orion on the same machine, IP and port. What I am trying to do is have a second instance of Orion listen to only certain virtual hosts (headers) and the first pick up any unknown or blank headers. The reason for us doing it this way is to have a test installation of Orion that will be restarted often and a second 'stable 'installation that will run some ancillary sites for our internal network. I know that binding a second IP to the box and having the second Orion listen on that IP would probably work. Is there an obvious reason that the way I am attempting always gives me an "Error starting HTTP server: Address already in use" error on the second instance? thanx, Larry
New article: Running Orion on FreeBSD
Justen Stepka has kindly written this how-to about running Orion on FreeBSD. http://www.orionsupport.com/articles/freebsd.html -Joe Walnes
New app/tools how-tos required for OrionSupport
I'm going to start collating a new bunch of how-to's for www.orionsupport.com, describing how to run popular applications and tools with Orion. My current list of apps and tools consists of (with specific subjects to address or add-ons in brackets): - Cocoon (getting xsp to work, allowing to process servlets/jsp/cgi using a custom Producer and servlet 2.3 filters) - Struts - JetSpeed - Jive (integrating with orion's user-management and using orion's db pooling) - PHP (running as cgi and as servlet, and accessing ejbs from php code) - Cold-Fusion - Macromedia Generator - Velocity - LDAP (using OpenLDAP, Netscape Directory MS Active Directory as orion user-manager) - SOAP - Together (configuring control-center to deploy applications directly to orion) I'd be interested to know of any success or failure stories people have had with these so far (I have my own interesting tales), or any other things you would like to see addressed. As usual, all contributions welcomed :) Thanks -Joe Walnes
Re: Does Orion support CMP using user defined types?
Does Orion support CMP using user defined types? e.g. oracle objects? You can set the percistance-type in the orion-ejb.jar You can also use custom mappings such as storing one type of bean in a distinct oracle object. To do this you can implement your own FieldPersistenceManager. See http://www.orionserver.com/docs/api/ -Joe Walnes
Re: Running multiple application instances with Orion
Kurt, Thank you for this article - it has been published on OrionSupport. A comment I have, is that instead of specifying a data-source for *every* entity-deployment in orion-ejb-jar.xml, you can specify a default-data-source in orion-application.xml which will automatically be used by every cmp entity in the entire application. Likewise, orion-application.xml also allows you to specify a data-sources.xml file to be used for the specific application - this allows you to separate configuration of data-sources in each applications. -Joe Walnes At 16:07 31/10/2000, Kurt Hoyt wrote: I've put together a how-to on running the same J2EE application, but with each instance using a different data source, using Orion. It would be nice if there was a simpler way to do this (particularly in associating data sources with applications, which causes the bulk of the work). If the orionsupport.com folks are listening, you have my permission to add this to your site (just be sure to give credit where due). Kurt in Atlanta
Re: DataSourceUserManager caches table with users and passwords
The preferred way of changing the password is to use the RoleManager. Example (change bob's password to cheese): - RoleManager roleManager = (RoleManager)context.lookup("java:comp/RoleManager"); User user = (User)roleManager.getPrincipal("bob"); user.setPassword("cheese"); roleManager.store(); - See http://www.orionserver.com/docs/api/ for docs on RoleManager. Briefly, it's job is to provide an interface to the current UserManager for the developer to work with. -Joe Walnes At 10:47 27/10/2000, you wrote: Hello, I use the DataSourceUserManager to check usernames and passwords on my site. I have a jsp page on my site that allows the users to change their password in the database. The problem is this: it seems that Orion caches the table, so when a user changes his password the old one stays active until I restart the orion server. Is there a way to do one of the following: - disable the caching - set an expiration date on the cache - make the DataSourceUserManager do an extra lookup if the given password seems to be wrong. Thanks -- Jurgen Schepers Bricsnet Koning Albertlaan 165 B-9000 Gent
Re: Internal Orion requests vs External Requests?
How I've tackled it is by setting a request scope attribute in the filter. Before the filter is applied, a check is performed to see if this attribute has been set or not.. if it has then the request is an internal request. In doFilter() // Check if filter has been marked as applied if ( request.getAttribute( "filterapplied" ) != null ) { // Been done already - jump to next filter getFilterConfig().getNext().doFilter( request, response ); } else { // Hasn't been applied yet, mark it as applied and do request.setAttribute( "filterapplied", Boolean.TRUE ); // do filter stuff } -Joe Walnes At 10:27 25/10/2000, you wrote: I'm implementing a clickstream analysis application, and I've run into a problem. Using servlet filter to intercept requests and add to the streams, I intercept all of the Orion internal requests as well! (ee jsp:include requests) Is there anyway to tell from looking at a request object or it's headers, whether the request came from Orion as an include, or from an external user? Cheers, Mike -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Jeff Schnitzer Sent: Wednesday, October 25, 2000 5:52 PM To: Orion-Interest Subject: TheServerSide forgot Orion The latest newsletter from TheServerSide.com includes this little snippet, included in a discussion of "What makes an application server succeed": * Being compliant with the latest specs. Again, BEA has shined here. They were 6 months ahead of the pack with their EJB 1.0 product, which positioned them extremely well. And they pulled it off again, recently releasing their EJB 2.0 beta server far sooner than any other vendor. History, it seems, has repeated itself, and other vendors are playing catch-up. I think those of us who have been using the EJB2.0 support in Orion to develop our beans for the last several months can see the error in that statement :-) WebLogic doesn't even have support yet for container-managed relationships. Geez. I sent TheServerSide a little note urging them to issue a correction. It's more likely to happen if they get many more comments. Jeff Schnitzer [EMAIL PROTECTED]
New howto on OrionSupport: Virtual Hosts
Setting up Virtual Hosts on Orion http://www.orionsupport.com/articles/vhosts.html Step by step guide to deploying 2 web-sites with different virtual hosts on the same server. Thanks to Damian Van Dooren for contributing this. -Joe Walnes
New howto on OrionSupport: Using JDBC from Servlets
How to setup a JDBC data-source in Orion and access it using JNDI from Servlets/JSP. http://www.orionsupport.com/articles/jdbc.html -Joe Walnes
New howto on OrionSupport: Virtual Hosts
Setting up Virtual Hosts on Orion http://www.orionsupport.com/articles/vhosts.html Step by step guide to deploying 2 web-sites with different virtual hosts on the same server. Thanks to Damian Van Dooren for contributing this. -Joe Walnes
New howto on OrionSupport: Using Apache as a front-end to Orion
How to use Orion in an environment where you have to use Apache as the front-line web-server. http://www.orionsupport.com/articles/apachefrontend.html Thanks to Joshua Goodall for this little gem. -Joe Walnes
Re: Idea for Orion Support - post changes.txt
Jim, Thanks for the idea, (and the others you have posted). We have had an overwhelming response to our documentation cry, and are hard at work making things happen - thank you to everyone who has suggested subjects or written articles. Anyway, it may be helpful to know that at http://www.orionserver.com/orion/ is an unpacked version of the latest Orion distribution. You can view changes.txt at the URL: http://www.orionserver.com/orion/changes.txt This site is useful in situations where you have messed up the configuration for something and you want to look at the original version in the distribution. -Joe Walnes At 14:59 24/10/2000, you wrote: Just an idea for you guys running orionsupport.com... It would be handy to be able to see the changes in the latest version of Orion before I run the auto update tool, so I can decide if I need anything in the new release and so want to risk an upgrade. So, is it possible to keep the latest changes.txt file posted? Just an idea... You guys are doing a great job and we all appreciate it! Jim
Re: get reference to UserTransaction fails
now i'm trying this from an ordinary app-client but it caught an exception: "java:comp/UserTransaction not found" In the JNDI properties, are you specifying the application name as well as the server? e.g. java.naming.provider.url=ormi://localhost/myapp (Correct) java.naming.provider.url=ormi://localhost (Wrong) -Joe Walnes
Re: Orion doesn't interpret Javascript correctly
Andrew, The reason this is happening, is that when JSPs are compiled, Orion recreates them slightly to insert code for url-rewriting for session-tracking. Obviously it is always recreating the tag with attributes enclosed in "". The short term solution to your problem is to switch around your '' with your "". e.g. from: onmouseout='csne_button.src="/images/lv1-off_04.gif"' to : onmouseout="csne_button.src='/images/lv1-off_04.gif'" The long term solution is to register a bug report with Orion (they do not have time to read all messages on this list). You can do this by using the bug-tracking system at http://www.orionserver.com/bugzilla/, or mailing [EMAIL PROTECTED]. -Joe Walnes At 16:20 24/10/2000, you wrote: All, I have a fully functional webapp that runs perfectly under Tomcat (albeit a little slow). The main menu bar consists of rollovers that utilize the onmouseover and onmouseout routines of Javascript. For example, one of the tags looks like this: a href="/news/" onmouseout='csne_button.src="/images/lv1-off_04.gif"' onmouseover='csne_button.src="/images/lv1-on_04.gif"' img src="/images/lv1-off_04.gif" alt="" border=0 height=18 name=csne_button width=117 /a which, of course basically changes the image when the mouse pointer crosses it. Anyway, any time I try to view the pages in any browser that are served by Orion, I get tons of javascript errors, complaining about various aspects of the onmouseout and onmouseover calls, most notably of which seems to be a replacement of the single quote delimiters (') with double quotes, such as a href="/news/" onmouseout="csne_button.src="/images/lv1-off_04.gif"" onmouseover="csne_button.src="/images/lv1-on_04.gif"" img src="/images/lv1-off_04.gif" alt="" border=0 height=18 name=csne_button width=117 /a which is obviously wrong, and which was obtained by examining the source of the returned page. It looks like Orion is not keeping the single-quote delimiters properly. Is anyone else having this problem? Better yet, is there some solution? -- Andrew Kidder L3 SW/Support Engineer, IBU Tivoli Systems 512-436-4544 [EMAIL PROTECTED] http://www.tivoli.com
RE: Orion in production - new howto
I've just added a new HowTo to orionsupport.com. Details one approach to running Orion securely on UNIX/Linux. Also includes a useful shell script for administering Orion with. http://www.orionsupport.com/articles/unixprocess.html This is just one way of securing Orion... as Mike said, we'd love to hear how others approached the problem. -Joe Walnes -- At 05:28 22/10/2000, Mike Cannon-Brookes wrote -- This sounds fascinating - I'd love to know more about *ix permissions, securing Orion properly etc. You sound like you've got it all down pat, if you wouldn't mind, I'd love to learn more about your setup - as I'm sure other Orion users would. How about writing a quick how to doc about securing Orion on *ix? The OrionSupport team will love you for it ;)
Re: customize finder method
Actually it makes more sense to place the % in the finder method as it abstracts the SQL from the underlying code. A developer working with entity beans should never need to use any SQL (even if it only is one character). The reason the attempted finder method isn't working is to do with how JDBC prepared statements work. To fix the problem, in your finder-method tag in the deployment descriptor, replace: like '%$1%' ... with ... like '%' + $1 + '%' -Joe Walnes - Original Message - From: "DeVincentiis Giustino" [EMAIL PROTECTED] To: "Orion-Interest" [EMAIL PROTECTED] Sent: Thursday, October 19, 2000 11:59 AM Subject: R: customize finder method Hi Leung, You should'nt use the '%' symbols in the finder definition, instead you should attach them to the parameter you pass to the finder method. i.e. finder definition: finder-method query="select catname,description from cat_ejb_Category where $description like $1" finder calling: findBy...("%" + description + "%"); Hope this help Giustino De Vincentiis -Messaggio originale- Da: Yeung Man Leung [mailto:[EMAIL PROTECTED]] Inviato: giovedì 19 ottobre 2000 9.57 A: Orion-Interest Oggetto: customize finder method Hi all, I have try to customize the a findBy method in one of my Bean in the following. finder-method query="select catname,description from cat_ejb_Category where $description like '%$1%'" partial="false" !-- Generated SQL: "select catname,description from cat_ejb_Category where cat_ejb_Category.description like '%?%'" -- method ejb-namecat.ejb.Category/ejb-name method-namefindByDesc/method-name method-params method-paramjava.lang.String/method-param /method-params /method /finder-method However when I try to execute the findBy method, I got the following exception: com.evermind.server.rmi.OrionRemoteException: Database error: ORA-01006: bind variable does not exist Did anyone know what went wrong in my sql, thx Leung
Re: customize finder method
I agree Joe, but can you tell me how did you find out about this? I had the same problem long time ago and I end up with Giustino's solution! Just want to learn how to find the best answer to my questions. Figured it out :-) If $1 is a String, it is escaped and quoted before putting it in the SQL statement. So if $1 = "Joe's Test", it gets interpolated as 'Joe\'s Test'. Therefore: like '%$1%' -- like '%'Joe\'s Test'%' (invalid SQL) like '%' + $1 + '%' -- like '%' + 'Joe\'s Test' + '%' (valid SQL) -Joe Walnes
Re: Does Orion have an FTP service?
See http://www.orionserver.com/faq/#-855510329 -Joe Walnes - Original Message - From: "Neville Burnell" [EMAIL PROTECTED] To: "Orion-Interest" [EMAIL PROTECTED] Sent: Monday, October 02, 2000 7:14 AM Subject: Does Orion have an FTP service? Hi, Does orion have an FTP service? If not does anyone know of a good Java FTP server that might be used with orion? We are looking at uploading the latest .EAR etc via FTP to an NT Server running Orion, and IIS is not loaded at all right now. TIA Neville Burnell Business Manager Software
Re: JUnit with Orion, source included
RE: JUnit with Orion, source included[going off topic slightly] A problem that JUnit does not handle particularly well is Web-App testing. For any users of JUnit who want to test Servlet/JSP/etc output, have a look at HttpUnit, and addon for JUnit that simulates web-requests to the server and parses the results into a DOM tree that can be easily tested. http://httpunit.sourceforge.net/ -Joe Walnes From: Jeff Schnitzer [mailto:[EMAIL PROTECTED]] Sent: den 28 september 2000 20:08 To: Orion-Interest Subject: JUnit with Orion, source included I wrote an extension to JUnit for testing EJB/server-side code that I think others might find useful. I've recently been bitten by the XP bug so this is the first thing I had to do :-) Basically it's a servlet that will execute test cases and spit back the results as HTML. It includes a small Ant buildfile for anyone that is interested. You can find it at http://www.infohazard.org/junitee http://www.infohazard.org/junitee Enjoy :-) Jeff Schnitzer [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] I apologize if anyone is receiving this twice. It looks like the mailing list, including the archive, was sporadically losing traffic for a day or two. The most recent message in the archive is dated three days ago. Anyone know what's up? I seem to be receiving traffic fine at the moment.
Re: Servlet Filters - Apache Mod_Rewrite
Has anyone thought of writing a Mod_Rewrite clone using Servlet Filters? Using something like the Jakarta ORO regex package this should be quite doable? Any reason that wouldn't work? (I've never actually used Mod_Rewrite, just read about it). I've done something similar, but filters are not required. Simply create a servlet that sends appropriate redirects then use servlet-mappings to assign it to URL's. -Joe Walnes
RE: Deploying Servlet for EJB access, PLLLSS Help
In the init() method of the servlet, I had... env.put("java.naming.factory.initial","com.evermind.server.Applica tionClientInitialContextFactory"); env.put("java.naming.provider.url","ormi://mysite/stamp"); env.put("java.naming.security.principal","admin"); env.put("java.naming.security.credentials","passwd"); context = new InitialContext(env); James, The factory you've specified as a parameter is com.evermind.server.ApplicationClientInitialContextFactory, which is designed for application-clients. From within a servlet, a com.evermind.server.ApplicationInitialContextFactory should be used instead. By default, all the required properties for the InitialContext will be already set in the system properties by Orion. Short answer, use : context = new InitialContext(); // no properties -Joe Walnes
RE: EJB 2.0's Message Driven Beans in Orion 1.2.9 ?
Is there any example or documentation about message driven EJB's (which should be in Orion 1.2.9)? Or is Sun's documentation about EJB 2.0 all there is to it? Have a look at messagelogger in the demo directory. In a peanutshell, a message bean... - is similar to a session bean. - has no home or remote interface. - has a main class that implements javax.ejb.MessageDrivenBean. - has a method that handles in coming messages: void onMessage(javax.jms.Message). - has a corresponding message-driven entry within ejb-jar.xml/enterprise-beans - is bound to a JMS topic. Messages sent to this topic from a client will be handled by the onMessage() method. -Joe Walnes
RE: Specifying finder-methods (full query)
Ok, here's some methods to allow slightly more flexible queries. There is rarely more than a few fields to query, but the permutations of different combinations can make this a bit of a headache. If you have name, age and score, you may end up with finder methods like: findByName(String name) findByAge(int age) findByScore(int score) findByNameAndAge(String name, int age) findByNameAndScore(String name, int score) . etc This could be merged into one finder statement findByCriteria(String name, int age, int score) Where the SQL query supplied to the finder-method is: ($name LIKE $1 OR $1 IS NULL) AND ($age = $2 OR $2 = 0) AND ($score = $3 OR $3 = 0) This way, if 0 (or null) is supplied as a parameter to the finder method the result set will not be filtered with that criteria. You can also pass across parameters that aren't necessarily fields, but useful for the query: findByAge(int age, int allowedRange) ($age = $1 - $allowedRange) OR ($age = $1 + $allowedRange) findByAge(int age, boolean older) // if true, returns all people older than age, // otherwise all people younger ($2 = 1 AND age = $1) OR ($2 = 0 AND age = $1) Also (if your database supports it), sub-selects are your friend (particularly when using OR mapping) $blah IN (SELECT id FROM xxx WHERE yy = $1) If you still can't achieve what you're attempting, the session bean to query the database for the keys will work - it may not be clean but sometimes you do have to resort to methods like this. If it's any consellation, I have done this because the query that needed to be generated was way too complicated for CMP, and it did work. The problem is that you then have nasty SQL inside your beans - where it shouldn't be. -Joe Walnes 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. Frank On Tuesday, September 12, 2000 6:16 PM, Joe Walnes [SMTP:[EMAIL PROTECTED]] wrote: Frank, The actual SQL for query should be within the deployment descriptor and not the client code. So, if you wanted to find all MyProducts by a particular name, orion-ejb-jar.xml would contain: finder-method query="$name = $1" partial="false" And the client code would contain: ...findByName("Bob") It is not possible to pass SQL statements from the client to the finder method at runtime when using CMP as PreparedStatements are created in advance. Allowing this would impact performance, breach security and allow all havoc to break out. -Joe Walnes -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Frank Eggink Sent: 12 September 2000 16:06 To: Orion-Interest Subject: Specifying finder-methods (full query) I'm running into trouble specifying finder queries in orion-ejb-jar. As far as I can make sense of it the cause is in the quotes. Is that correct and does anyone know how the get around that? I've changed the default finder method to: finder-method query="$1" partial="false" !-- Generated SQL: "?" -- method ejb-nameMyProduct/ejb-name method-namefindByName/method-name method-params method-paramjava.lang.String/method-param /method-params /method /finder-method I call the method in my client with: ...findByName("select id, name, description, price from MyProduct"); The following is the resulting output: Printing a list of all products: System/communication error: Database error: Unexpected token: 'select id, name,
RE: Why!?.... NoClassDefFoundError
Make sure the files orion.jar, ejb.jar and naming.jar (in the orion dir) are in your classpath. -Joe Walnes -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Carl Troedsson Sent: 13 September 2000 17:26 To: Orion-Interest Subject: Why!? NoClassDefFoundError Hi, I have installed Orion server. The example JSP-pages and servlets works fine, but when I try the EJB examples (ProductClient etc) I recieve a Exception in thread "main" java.lang.NoClassDefFoundError. javax/ejb/CreateException I have also tried to compile these classes and then recieved package javax.ejb does not exist. This is strange since I think that I have followed the instructions for running the examples. I have also tried to add the all the needed jar files to my path and classpath variables and still have the same problem. I am running the Orion server on win2000 advanced server with SQLserver7 I would really appriciate if someone could help me out so that I can try the examples. /Carl
RE: Help with OR-Mapping
Does anyone know how to map a CMP field with type byte [] to a column in Oracle 8i DB. Particulary what would the tag for this type look like in the oracle.xml file under database-schemas directory. I see that a byte type maps to number(10,0) as shown below. type-mapping type="byte" name="number(10,0)" /. but what would a byte array map to is the question. Your response would be highly appreciated. type-mapping type="byte[]" name="blob" / (or whatever you want the type to be) -Joe Walnes
RE: 3rd post, no answer
Dale, Can you confirm that you are using JNDI to lookup the MailSession with the location "java:comp/env/mail/MailSession"? If you are not, you may be using a MailSession you're not expecting. That's my only suggestion anyway - if you are already using this location, ignore me :) -Joe Walnes -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Dale Bronk Sent: 09 September 2000 04:12 To: Orion-Interest Subject: 3rd post, no answer Sorry to keep posting this, but I really need an answer. I have a problem that I hope isn't not normal behavior and something I have configured incorrectly. Snip of my sever.xml: global-application name="MyDomain" path="c:\webapps\mydomain-web-app\config\mydomain-application.xml" /-- application name="Client1Domain" path="c:\webapps\Client1Domain-web-app\config\Client1Domain-application.xml" / application name="Client2Domain" path="c:\webapps\Client2Domain-web-app\config\Client2Domain-application.xml" / application name="Client3Domain" path="c:\webapps\Client3Domain-web-app\config\Client3Domain-application.xml" / application name="Client4Domain" path="c:\webapps\Client4Domain-web-app\config\Client4Domain-application.xml" / application name="Client5Domain" path="c:\webapps\Client5Domain-web-app\config\Client5Domain-application.xml" / In mydomain-application.xml, I have: (note that this is my global application) mail-session location="mail/MailSession" smtp-host="mail.mydomain.com" property name="mail.transport.protocol" value="smtp" / property name="mail.smtp.from" value="[EMAIL PROTECTED]" / property name="mail.from" value="[EMAIL PROTECTED]" / /mail-session Now I want to also place the same mail session entries in each of my clients application.xml files except specifying their domain: mail-session location="mail/MailSession" smtp-host="mail.Client1Domain.com" property name="mail.transport.protocol" value="smtp" / property name="mail.smtp.from" value="[EMAIL PROTECTED]" / property name="mail.from" value="[EMAIL PROTECTED]" / /mail-session I have a FormMailServlet that I install on all my clients web.xml files which uses mail.jar classes send the email. My problem is it doesn't matter which one I go to, Orion always uses my mail-session entries from the global application. It doesn't seem to get over written for each other application. I also tried to explicitly set the mail server in my FormMailServet to what is passed in. I pass in mail.Client1Domain.com and inside my class I do the following: properties.put( "mail.smtp.host", "mail.Client1Domain.com"); properties.put( "smtp-host", "mail.Client1Domain.com"); // Not needed as far as I know I also turn verbose on so I can see what is happening. It always uses mail.mydomain.com! If I comment out the mail-session entries from my global application xml then it works fine as long as I pass in the value and explicitly set the mail.smtp.host as above. In other words, it seems to ignore the mail-session in the Clientxxx-application.xml files as I pointed the smtp-host entry in one of the application.xml files to an existing server, but a different one. When I explicitly set the entries it uses the entries I set, not the mail-session entries. Seems to only use the mail-session entries only if in the global application xml file and no where else. When in the global application xml file, it seems you can only use that one even if I explicitly set it to a different one. What gives? Sorry for the long email, but I wanted to be sure to give all the data. Dale Bronk Dale Bronk [EMAIL PROTECTED] Windscape Consulting, Inc. http://www.windscape.com
RE: Orion Log file analyser
You can use any analyser really as you can configure the output log format to be however you want. I use NetTracker - it costs a bit really, but it can generate virtually any kind of report you can think of. (www.sane.com) -Joe Walnes -Original Message- I've read in this list about log file analysers that can Analyse Orion Logs ( somehow changed via web-site.xml /web-site/access_log ) But i've lost this information. :( What analyzers i can use with Orion ( and how )
RE: Inheritance
I know the EJB 1.1 and 2.0 specs avoid (finesse?) the issue of bean inheritance, but has anyone tried doing anything that mimics inheritance using Orion? If so, can you share how you accomplished it? EJB does not directly support inheritance - the main reason being that the Home interface for a bean could not fit into an inheritance model. There are however some alternatives. Firstly, suppose you have a Person EJB and want to extend it to become an Employee. You would create (and deploy) your Person EJB as normal, then have the remote interface and EJB implementation of Employee extend those of the Person. The home interface for EmployeeHome cannot extend PersonHome as it has a different return type for findByPrimaryKey() etc. Upon deployment, the EJB must be treated as a seperate entity, with a seperate JNDI lookup and all the appropriate fields redefined. This solution allows behaviours of beans to be reused, and once a entity has been found it is seen to the client as a 'is a' relationship and exhibits polymorphism. The problem lies in that find the EJB two seperate home interfaces need to be looked up. A solution to this is to create a session EJB that has reference to both beans and can use the finder methods of both entities and return an appropriate one. Another solution is to use the State (or Strategy) design pattern (see the GoF Design Patterns book - or just trawl the web for what it is). The advantage of this is that an object can change it's state at any time without having to be recreated and all the different states can be used in one entity. The best way to do implement this is to determine behaviours/fields that are common across all implementations of the inheritance model and place them in the main EJB, then place behaviours/fields that vary in your ConcreteState/Strategy classes. The problem with this approach is how to map keep a reference to the which state/strategy is being used and how to store the individual fields. Solution 1 is to simply serialize the class and store it as a field in the main EJB. This solves both problems but may not be ideal, particularly because the data is just stored as a bunch of binary data only recognizable to java (useless for finder methods). If you happen to be using an Java Object database you can perform write finder methods that use these objects - but most people aren't. Solution 2 to this is to create your own way of serializing/deserializing the objects. For example, the ejbStore() method could convert the state into an XML representation which could be stored in a normal text field, and the ejbLoad() could recreate it again. Another idea is to store the various properties for the state/strategy in a Map on ejbStore() - Orion can easily map a Map to a database with it's sophisticated OR features, and the table is easily queryable. If all else fails, use bean managed persistance. I'm sure there are many other methods and I would be interested to hear them. Inheritance is one of the draw-backs to EJB and if you are using it purely for object-relational (OR) mapping purposes, EJB may not necessarily be your best answer - but EJB will probably solve every other problem you have, so don't stray :) Relevant info: http://monsoon.wirestation.co.uk/or/ - Advanced OR mapping with Orion http://www.ambysoft.com/mappingObjects.html - Tips for OR mapping and creating own persistance layer http://www.helsinki.fi/~jplindfo/pattern/State.html - Diagram of state pattern http://www.helsinki.fi/~jplindfo/pattern/Strategy.html - blah -Joe Walnes
RE: datasource user manager
I can't seem to find which xml file I should put my init-params for DataSourceUserManager. Does anybody know this? orion-application.xml -Joe Walnes
RE: v1.2 Admin crashes Win2000 SP1 JDK1.3
I have exactly the same version of java, win2000 and orion and am having no problems at all. -Joe Walnes -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of hanasakiSent: 15 August 2000 14:17To: Orion-InterestSubject: v1.2 Admin crashes Win2000 SP1 JDK1.3C:\java -version java version "1.3.0" Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C) Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode) C:\ver Microsoft Windows 2000 [Version 5.00.2195] C:\ Run the updater... as of 8/14/2000 start java -jar orion.jar start java -jar orionconsole.jar Watch the fireworks. Repeatable.
RE: Entity bean creation
Is there a tool for creating an entity EJB ( Home, Remote and EJB) from a JDBC database table ? Together 4 Enterprise can analyse a JDBC database and create all the necessary beans for you. An expensive package but well worth it for its features. www.togethersoft.com -Joe Walnes
RE: Servlet handling both *.html and /
I have a servlet that I want to handle all the URLs. It acts as a super servlet and allows us to parse the URLs we receive and act accordingly. Right now I have it set up to handle .html. However, when someone makes a request to a directory such as: http://www.domain.com/whatever/ You need to set up a servlet-chain for mime-type text/html. This will allow orion to process all pages as normal, and then pass the final output to your servlet if the mime-type is text/html,however the page is produced (static html file, servlet, jsp, cgi, etc). Have a look at the docs for orion-web.xml to see how to do this. -Joe Walnes
RE: Deployment time for lots of beans
It seems that Orion is regenerating all my beans whenever I even a small change in the orion-ejb-jar.xml (even though as my last email said, it's just ignoring the changes). Is there a way around this? It's quite a nuisance to have to wait for several minutes while it's regenerating all the beans after making one simple change. Joel, I'm not sure of a way around this, but I found the majority of the time spent was on the ejb wrappers being compiled. Switching from javac to jikes got my deployment time down from over 8 minutes to 15 seconds (and a massive increase in time it takes to compile jsp's). Jikes: http://www10.software.ibm.com/developerworks/opensource/jikes/ To get orion to use it for compiling, add to config/server.xml: compiler executable="/path-to/jikes" classpath="/path-to-real-jdk/jre/lib/rt.jar" / -Joe Walnes
RE: Help, with HypersonicSQL/ Orion
Anyone knows what I'm not doing right, I want to connect to a HypersonicSQL database using the webserver connection. But when I use the following URL: connection-driver="hSql.hDriver" Try changing the driver to org.hsql.jdbcDriver (which was recently updated in the hsql distribution). -Joe Walnes
RE: Error initializing userManager
Trying to install EJBUserManager: error message: Error instantiating application 'xx' at file:xx.ear: Error initializing userManager 'com.evermind.ejb.EJBUserManager' : NamingException: com.evermind.ejb.EJBUser not found You also need to deploy the actual EJB package which is located in /orion/demo/ejb/. (Read section 4 of install.txt for info) -Joe Walnes
RE: OBJECTS IN ENTITYS
I have an enity bean but I want that I field of that entity to be a complex object. Is this possible from the point of view of the specification??? , and from the point of view of Orion? Yes and yes. So long as the object (and all contained objects) implement java.io.Serializable. ¨What is the influence of having lots of entity beans in my application? ¨Is negative? Not really. In general, it's better to have lots of very simple coarse grained entities than a few complex ones, but then ofcourse each situation varies. -Joe Walnes
RE: find by Set
I would like to make a finder method like this: Collection findByIds( Set idSet ) which should make a query like: "SELECT * FROM a WHERE a.id IN ?" Is anything like this possible in Orion? I posted a similar question last week, and it turns out... no. Oh well, I'm sure it won't be long until the trusty Orion lot let us do it :) -Joe Walnes
RE: Can't deploy example atm with datasource db2
How can I change the type-mapping from longvarbinary to longvarchar for the LogEntries ? If you look in [orion-dir]/config/database-schemas you will find a bunch of xml files with type-mappings for various databases. Copy one of these files to db2.xml and edit it to reflect the appropriate type mappings. (see http://www2.orionserver.com/docs/database-schema.xml.html ) In config/data-sources.xml, edit the data-source being used by the application so it has the parameter schema="database-schemas/db2xml". -Joe Walnes
RE: Can't deploy example atm with datasource db2
In the database-schemes the "type" is the Java-Class and the "name" is the Column-Type in the database. So the entry for name should be name="long varchar", but what is the entry for type ? java.io.Serializable -Joe Walnes
RE: EJB under Orion/Windows-98
Is it possible to run EJB's under Orion/Windows-98 or does it need to be Windows-NT ? Orion is written in pure Java and will run on any platform that has a Java2 VM available. In order to use EJB's, you will require a transactional JDBC compliant database, however there are many available for win98 which may not scale well but provide enough functionality for development. There are also many pure java ones too (HypersonicSQL, Pointbase, Cloudscape, jDatastore). -Joe Walnes
RE: jsp:plugin generates wrong for params
Instead of name it sets null. Have anybody seen this before or have a solution ? jsp:param name"cache_option" value="Plugin" / You forgot the = sign. :) -Joe Walnes
Passing Collections or arrays to finder methods.
Say I have 2 cmp entities with properties: Office - int id - String tel - String fax - String address Employee - int id - String name - Office office I have 2 finders in EmployeeHome that finds all employees in a particular office: public Collection findByOffice(int officeId) throws... public Collection findByOffice(Office office) throws... and they both have the following entries in orion-ejb-jar.xml: finder-method query="$office = $1" ... All's good and working fine, but I need to pass across to the Employee finder method a group of Offices (either in a Collection or an array). I have tried adding the following methods: public Collection findByOffice(int[] officeIds) throws... public Collection findByOffice(Office[] offices) throws... public Collection findByOffice(Collection offices) throws... with: finder-method query="$office IN ($1)" / But I get the following errors: - When using int[], upon deploying the ejb-jar file: Bean-type 'int' used in or-mapping not found - When using Office[], upon deployment: java.lang.NullPointerException: at com.evermind.server.ejb.deployment.eg.vk(JAX) at com.evermind.server.ejb.database.eh.yw(JAX) at com.evermind.server.ejb.compilation.e2.aad(JAX) at com.evermind.server.ejb.compilation.ew.o6(JAX) ... very long stack trace. - When using Collection, the ejb deploys fine, but upon calling the finder method, an SQL error msg is thrown by the db (Sybase 11.9.2): Operand type clash: IMAGE is incompatible with INT This suggests that orion is simply passing across the serialized Collection as a blob of data. (IMAGE is Sybase's equivalent of BLOB). Does anyone know if it's possible to pass across Collections or arrays to finder methods, and if so what I'm doing wrong. I'm convinced it's possible because in the orion documention for orion-ejb-jar/enterprise-beans/entity-deployment/finder-method/method/method -params/method-param, it uses int[] as the example. Thanks in advance. -Joe Walnes
RE: taglib processing
foo:mytag value="view.%= bar %"/ receives the literal string "view.%= bar %" instead of having the contents of bar stuck in there. In taglib.tld, set the value of the rtexprvalue to "true" for the "value" attribute. Also, try changing your tag to foo:mytag value="%= "view." + bar %"/. I'm unsure as to where this is in the spec, but I find taglibs only seem to recognise dynamic expressions if the entire attribute is in %= %. -Joe Walnes
RE: XML/XLS
On the OrionServer.com page it states that Orion does XML/XLS ... how? Can I find examples anywhere or help based on this? Look in the examples/xsl directory of the default-web-app. -Joe Walnes
Re: Persisting Entity Beans to Hard-Disk
I need to find out how one persists an Entity Bean to Disk as opposed to a Database. The J2EE developer docs suggest that no use can be made of the java.io package within an Entity Bean. This indicates to me that I should be using services provided by the Orion container in order to do this. I can't find these services however and would appreciate some information regarding how I should go about this. It is feasible to do this, by rolling your own persistance daemon which can do something like run in another VM (or thread with appropriate privileges) and handle all file writing/reading and be available via RMI (or another transport layer). The main reason this is not advised is that the data-stores need to exhibit transactional features - the application server can not utilise these if they do not exist. -Joe Walnes
Re: Java Mail with POP3
And when I execute the servlet, next error apear: javax.mail.NoSuchProviderException: No provider for pop3 I put the pop3 jar in the orion/lib and /orion ... but nothing. Cosmin, this is a shot in the dark, but try putting the jar file in path-to-jdk/jre/lib/ext. If you don't want to do that, try editing the MANIFEST file in orion.jar and append the path to pop3.jar on the line that starts with "Classpath:". -Joe Walnes
Re: Generating primary keys in CMP?
For bean managed persistance you would simply use the functions that your DBMS provides, like sequences or auto-increased columns. But how do I do this with CMP beans? In books and example code everyone avoids the subject entirely, with create(int id) as the creation method. Annoyingly enough, most EJB resources tend to avoid this subject. Wish they wouldn't. A solution I've seen suggested is to use a separate session bean to generate unique integers, but they are generally a mess to implement and use. So what I'm looking for is something better than that. There are 2 main approaches 2 generating IDs. Firstly you could use the internal features of your database - many db's support SEQUENCES. This solution seems fairly simple and elegant but using a db specific approach can cause problems if you later decide to switch databases. The preferred way to generate ID's is using a session bean and an entity bean. The entity uses a reference to the table or bean name as a primary key, and has a second field which stores the next id to use for that table. The session bean is used as a wrapper around the entity to easily request the next id per table. In fact, updating the entity every time a new id is needed can be quite a cumbersome and inefficient process, so a HIGH/LOW strategy is more appropriate. Briefly, this is where the session bean is stateful and instead of requesting and incrementing the entity each time an id is required, a block of id's (eg: 20) are requested from the entity (which then increments the count by that number) and the session counts out each id until the block runs out, at which point it requests another block. Multiple sessions can be used and each session will count with a seperate block. Concurrent access can be handled by catching transaction exceptions and trying again. The drawbacks to this is that the id's in the db table are not guaranteed to be in order and there may be some gaps if a session is destroyed before it uses all of it's block of ids. The main advantage is that you will not be tied in to any particular db. There's a nice little paper that may be of use that describes this method (although it has nothing to do with Java or EJB's): http://www.ambysoft.com/mappingObjects.html -Joe Walnes
Re: Orion and Visibroker 4: ClassLoader probs(?)
Thanks to Magnus for solving this one. If anyone else runs into this problem, the problem is solved by copying the appropriate VisiBroker jar files to /path-to-jdk/jre/lib/ext/. Weird behaviour by the VM classloader. -Joe Walnes At 04:49 PM 3/22/00 +, Joe Walnes wrote: I'm trying to use Orion as a client for some CORBA based objects that are accessible via Visibroker. The following code works as a standalone client, providing the correct jars are in the classpath and the appropriate system properties are set, and the ORB is running on the localhost: - // Get context Properties p = new Properties(); p.put(Context.INITIAL_CONTEXT_FACTORY,"com.inprise.j2ee.jndi.CtxFactory"); p.put(Context.URL_PKG_PREFIXES,"com.inprise.j2ee"); Context context = new InitialContext(p); // Lookup CustomerHome Object ref = context.lookup("customer"); CustomerHome home = (CustomerHome) PortableRemoteObject.narrow(ref,CustomerHome.class); - However, I'm trying to allow servlets/jsps access to the objects from within Orion. All the appropriate system properties (-Dxx=yy) where set on the command line when starting orion, the appropriate jars where placed in orion/lib and the orb was running on localhost. In a Servlet running in Orion, when the code got as far as creating the new InitialContext, a NoClassDefFoundError for com.inprise.j2ee.jndi.CtxFactory was thrown, however, Class.forName("com.inprise.j2ee.jndi.CtxFactory") did not throw an error. The problem appeared to be a ClassLoader problem, where InitialContext was using a different method for loading classes that the servlet was using, and only seemed to be looking in the base jars in the orion dir. I added the appropriate jndi/corba/iiop/orb classes to orion/jndi.jar and the code succesfully managed to lookup the required object. Hurrah! However, the object returned by context.lookup() is of type org.omg.CORBA.portable.ObjectImpl which needs to be narrowed to appropriate type before casting. This always throws a ClassCastException, even though the ObjectImpl says it is the correct type. I'm stuck! I've been trying to get round this problem for days now unsuccesfully. I can access the corba objects as standalone java apps, and from within Sun Web Server, mod_jserv and jRun with no problem, just not Orion. Can anyone help, or shed some light on what the problem may be. I suspect the problem is related to ClassLoader. Could one of the Orion team explain how the ClassLoader works in the server please. Note, in this case Orion is simply being used as a web-server for serving jsp/servlets. EJB/JTS/etc is not required, and the JNDI service is replaced by that that Visibroker supplies. Thanks in advance -Joe Walnes
Re: PHP
The Orion-server is supposed to be able to run PHP-script isn't it? Well, I can't seem to enable the CGIServlet that is mapped to handle PHP. Anyone done this? What to do? Repeat post. -Joe Walnes --- Date: Tue, 22 Feb 2000 10:46:14 + To: Orion-Interest [EMAIL PROTECTED] From: Joe Walnes [EMAIL PROTECTED] Subject: Re: CGI, PHP, etc... Has anyone successfully managed to get PHP workingwith Orion? Their is some mention of "com.evermind.server.http.CGIServlet", but that doesn't seem to come with the Orion package, and the evermind site is in German - or something - and I can't find the classes. (I only speak english!:p) The CGI Servlet is a wrapper to a fork a native CGI. If you install PHP as a CGI and ensure the php executable is in your PATH before starting orion, it should work. Briefly, Orion has the following Servlet called php setup: servlet auto-reload="false" servlet-namephp/servlet-name servlet-classcom.evermind.server.http.CGIServlet/servlet-class init-param param-nameinterpreter/param-name param-valuephp/param-value /init-param /servlet This calls the CGIServlet telling it to use 'php' as the interpreter for the page. This param-value can easily be switched for any other interpreter such as Python, Perl, Bash, Cold-Fusion, Q-Basic(!) etc. If the executable is not in the PATH environment variable, use the full path to the interpreter in the param-value. A mapping is then set to map all files that end in .php to the php servlet. servlet-mapping servlet-namephp/servlet-name url-pattern/*.php/url-pattern /servlet-mapping That's it really. On another note, the PHP4 beta's 3 and 4 contain some Java mappings which allow java objects to be used directly in php. On top of that, a servlet wrapper has evolved allowing PHP to be invoked from a servlet without having to start a new process each time and have persistent resources (such as db connections and session variables) - greatly improving performance. Have a look in /ext/java/ and /sapi/servlet/ of the PHP distribution for information on this. -Joe Walnes
Orion and Visibroker 4: ClassLoader probs(?)
I'm trying to use Orion as a client for some CORBA based objects that are accessible via Visibroker. The following code works as a standalone client, providing the correct jars are in the classpath and the appropriate system properties are set, and the ORB is running on the localhost: - // Get context Properties p = new Properties(); p.put(Context.INITIAL_CONTEXT_FACTORY,"com.inprise.j2ee.jndi.CtxFactory"); p.put(Context.URL_PKG_PREFIXES,"com.inprise.j2ee"); Context context = new InitialContext(p); // Lookup CustomerHome Object ref = context.lookup("customer"); CustomerHome home = (CustomerHome) PortableRemoteObject.narrow(ref,CustomerHome.class); - However, I'm trying to allow servlets/jsps access to the objects from within Orion. All the appropriate system properties (-Dxx=yy) where set on the command line when starting orion, the appropriate jars where placed in orion/lib and the orb was running on localhost. In a Servlet running in Orion, when the code got as far as creating the new InitialContext, a NoClassDefFoundError for com.inprise.j2ee.jndi.CtxFactory was thrown, however, Class.forName("com.inprise.j2ee.jndi.CtxFactory") did not throw an error. The problem appeared to be a ClassLoader problem, where InitialContext was using a different method for loading classes that the servlet was using, and only seemed to be looking in the base jars in the orion dir. I added the appropriate jndi/corba/iiop/orb classes to orion/jndi.jar and the code succesfully managed to lookup the required object. Hurrah! However, the object returned by context.lookup() is of type org.omg.CORBA.portable.ObjectImpl which needs to be narrowed to appropriate type before casting. This always throws a ClassCastException, even though the ObjectImpl says it is the correct type. I'm stuck! I've been trying to get round this problem for days now unsuccesfully. I can access the corba objects as standalone java apps, and from within Sun Web Server, mod_jserv and jRun with no problem, just not Orion. Can anyone help, or shed some light on what the problem may be. I suspect the problem is related to ClassLoader. Could one of the Orion team explain how the ClassLoader works in the server please. Note, in this case Orion is simply being used as a web-server for serving jsp/servlets. EJB/JTS/etc is not required, and the JNDI service is replaced by that that Visibroker supplies. Thanks in advance -Joe Walnes
Re: CGI, PHP, etc...
Has anyone successfully managed to get PHP workingwith Orion? Their is some mention of "com.evermind.server.http.CGIServlet", but that doesn't seem to come with the Orion package, and the evermind site is in German - or something - and I can't find the classes. (I only speak english!:p) The CGI Servlet is a wrapper to a fork a native CGI. If you install PHP as a CGI and ensure the php executable is in your PATH before starting orion, it should work. Briefly, Orion has the following Servlet called php setup: servlet auto-reload="false" servlet-namephp/servlet-name servlet-classcom.evermind.server.http.CGIServlet/servlet-class init-param param-nameinterpreter/param-name param-valuephp/param-value /init-param /servlet This calls the CGIServlet telling it to use 'php' as the interpreter for the page. This param-value can easily be switched for any other interpreter such as Python, Perl, Bash, Cold-Fusion, Q-Basic(!) etc. If the executable is not in the PATH environment variable, use the full path to the interpreter in the param-value. A mapping is then set to map all files that end in .php to the php servlet. servlet-mapping servlet-namephp/servlet-name url-pattern/*.php/url-pattern /servlet-mapping That's it really. On another note, the PHP4 beta's 3 and 4 contain some Java mappings which allow java objects to be used directly in php. On top of that, a servlet wrapper has evolved allowing PHP to be invoked from a servlet without having to start a new process each time and have persistent resources (such as db connections and session variables) - greatly improving performance. Have a look in /ext/java/ and /sapi/servlet/ of the PHP distribution for information on this. -Joe Walnes
Re: Wrong content-type for JSP
I have found some sort of bug with the content-type of JSPs in Orion 0.9.1b. When I reloaded a JSP-generated page a few times in Netscape I was suddenly prompted with a "save file" dialog. I checked with telnet to port 80 on the server machine, and it turned out that Orion _sometimes_ sends "application/jsp" instead of "text/html" as the content-type for JSP pages. I have a similar problem involving XML files (both static and dynamic) that have been passed through the XSL servlet. The wrong content-type seems to be returned about 4 out of 5 times (it's the 1 in 5 times that it works that bugs me). Anyone else had this problem? Try the examples in the examples/xsl directory and reloading them a few times. Using 0.9.1g -Joe Walnes
Re: Support of WAR files.
Does anyone know if or when OrionServer will support .war files? Orion currently supports .war files and the latest version supports .ear files as well (the first server I've seen that does). -Joe Walnes
[Slightly-OT] Linux VM and Threading
I developed a project java about 4 months involving hundreds of people connected concurrently to a server. In development (on an NT machine) everything ran smoothly, but upon deployment to a Linux server the VM would often cause a segmentation fault. Further investigation showed that these would always happen when 256 threads were running. Unfortunately as java tcp sockets currently have no select() method (yet) each socket needed it's own thread so I was stumped. Over the course of a month, I tried many different linux distributions, kernels, and VMs (including virtually every IBM, Blackdown and Kaffe one) with no joy and even tried playing around with the sourcecode to the kernel to increase the threads - with no joy. Eventually the application was moved to a box running Solaris7 and the SunVM and it ran with no problems. I am now faced with a project to be produced by the middle of February, and would really prefer to go with Linux over Solaris (for a variety of non-orion-related reasons) but am concerned about the linux threading problem. The site in question will be very heavily hit and it is feasible that hundreds of people could be requesting information at the same time. I really need advice on whether it's sensible to go with Orion on Linux. Also, can someone advise me on which VM to use. I believe the only two 1.2 VM's available for Linux are the BlackDown and the Sun ones. The sun VM has very good reports so far, but I believe it's based on an earlier version of the Blackdown one, which is now far better. Thanks in advance -Joe Walnes