RE: getClass().getClassLoader().getResource(fileName) problem
I Believe the Orion directory is the root for File access. Or at least it was for me as I started the server up from there. Hope this helps. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Min-Hua Luo Sent: 15 February 2002 03:33 To: Orion-Interest Subject: getClass().getClassLoader().getResource(fileName) problem Hi, I tried to open a property file from within my custom UserManager program, however, Orion was unable to find my file. I just don't know where should I put my property file so it can be located by the following command: props_ = new Properties(); try { URL aURL = getClass().getClassLoader().getResource(fileName); InputStream in = (InputStream)aURL.openStream(); props_.load(in); Thanks a lot. __ Do You Yahoo!? Got something to say? Say it better with Yahoo! Video Mail http://mail.yahoo.com
RE: Error Accessing an EJB through a Bean
Don't know if this is the problem but its possible. When you use the client the classes you reference are the ones on the server with ejb. When you use the other server you are referencing old version of the classes and so you get a class cast exception. Make sure the classes are the same. Hope this helps. Owen -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Cugier (extern) Sent: 10 October 2001 15:40 To: Orion-Interest Subject: Error Accessing an EJB through a Bean We created a Bean to access an EJB from JSPs. First we tested the Bean from a Java Client and everything worked fine. Then we copied the Bean to the Orion server and tried to acces the EJB by using a JSP that instanciates the Bean that accesses the EJB. But we can not get it to work. The test with the Java client still works properly. But using the Bean from JSP always creates a ClassCastException. Here's the sniplet from the Bean where the lookup is performed. private static GUIServiceSBHome getHome(){ GUIServiceSBHome toReturn = null; try { Hashtable env = new Hashtable(); //ToDO if this bean runs inside a container this Env property will not be //necessary env.put(Context.INITIAL_CONTEXT_FACTORY, com.evermind.server.rmi.RMIInitialContextFactory); env.put(Context.SECURITY_PRINCIPAL, admin); env.put(Context.SECURITY_CREDENTIALS, xyz); env.put(Context.PROVIDER_URL, ormi://164.139.33.191:23791/bizDataNew); // Replace EJB ModuleName below with the EJB module name identified // in your deployment profile Context ctx = new InitialContext(env); Object ref = ctx.lookup(GUIServiceSB); logger.debug(Got an Object.. Class = + ref.getClass()); toReturn = (GUIServiceSBHome)PortableRemoteObject.narrow(ref, GUIServiceSBHome.class); logger.debug(Lookup5); } catch(Throwable ex){ logger.error( Unable to perform lookup for GUIServiceBean Home interface\nException = + ex.toString() ); } return toReturn; } The logger.debug statements create the following output. From the Client: de.mgi.frontend.GUIServiceProxyBean: Got an Object.. Class = class __Proxy0 de.mgi.frontend.GUIServiceProxyBean: Lookup5 On the Server (Bean used by JSP): de.mgi.frontend.GUIServiceProxyBean: Got an Object.. Class = class GUIServiceSBHome_StatelessSessionHomeWrapper215 de.mgi.frontend.GUIServiceProxyBean: Unable to perform lookup for GUIServiceBean Home interface Exception = java.lang.ClassCastException: GUIServiceSBHome_StatelessSessionHomeWrapper215 was not an instance of interface de.mgi.orca.business_data.ejb.session.gui.GUIServiceSBHome, the interface it implements is de.mgi.orca.business_data.ejb.session.gui.GUIServiceSBHome Next to the relevant question why does the Bean get an exception when it is executed on the server, there are also two more questions that I have when I look at the ouput. 1. Why is the return value of ref.getClass() different? The client and the JSP are accessing the same EJB on the same Orion server. 2. Why does it says the retrieved object is not an instance of the interface ...GUIServiceSBHome but an instance of ...GUIServiceSBHome? For me the two interface classe names look the same. And hint why the bean is not working on the server is greatly appreciated. Peter Cugier Database and Web Technology Consulting Georg-Simon-Ohm-Str. 4, 45701 Herten (GERMANY) Phone: +49(0)209 3593777 Fax: +49(0)209 3593766 E-Mail: [EMAIL PROTECTED]
RE: Query help please ??
This might seem like a stupid suggestion but try changing the order you pass the parameters in so the number of records you are retrieving is first and the id is second. If you look at the generated queryit uses P1 and P2 and if they standard for parameters they are the wrong way around. Its worth a try. Owen -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of EddieSent: 08 October 2001 19:53To: Orion-InterestSubject: Query help please ??Hellu,I have problems with a advanced finder, in combination with the Ms SQLserver.I have a the following finder: finder-method query="select top $2 * from sgssmsmo where acc_id=$1 orderby dattimrec desc" partial="false" !-- Generated SQL: "select top ? * from sgssmsmo where acc_id=? orderby dattimrec desc" -- method ejb-namenl.unwired.sgs.sms.SmsMo/ejb-name method-namefindByAcc_IdNext/method-name method-params method-paramint/method-param method-paramint/method-param /method-params /method /finder-method-The SUN jdbc-odbc driver (I also tried the i-net Opta driver) fires thefollowing query (see with the Ms profiler):declare @P1 intset @P1=NULLexec sp_prepexec @P1 output, N'@P1 int,@P2 int', N'select top @P1 * fromsgssmsmo where acc_id=@P2 order by dattimrec desc', 0, 2select @P1---Which gives the following error:- Nested exception is:java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '@P1'. at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source) at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source) at sun.jdbc.odbc.JdbcOdbc.SQLExecute(Unknown Source) at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(UnknownSource) ..-If I change the $2 argument in the finder to a constant:--- finder-method query="select top 5 * from sgssmsmo where acc_id=$2 orderby dattimrec desc" partial="false" !-- Generated SQL: "select top 5 * from sgssmsmo where acc_id=? orderby dattimrec desc" -- method ejb-namenl.unwired.sgs.sms.SmsMo/ejb-name method-namefindByAcc_IdNext/method-name method-params method-paramint/method-param method-paramint/method-param /method-params /method /finder-method--Everyting goes fine ?!!!, that is, the driver fires the following query:-declare @P1 intset @P1=1exec sp_prepexec @P1 output, N'@P1 int', N'select top 5 * from sgssmsmowhere acc_id=@P1 order by dattimrec desc', 0select @P1-Any idea what it is ??? (I am not such a Ms SQL server expert yet ...)I print the input argument and they aren't zero or null: public Collection findByAcc_IdNext(int acc_Id, int num) throwsRemoteException, FinderException;BTW: I use Orion 1.5.1 and are parsing it all so that it can be used on theMs SQL database, whereas it worked on the Postgres database.Why isn't Orion/the JDBC driver just firing the generated query that I seein the orion-ejb.jar file ???.What am I missing here :(Eddie
RE: explicit table-names in CMP
Hi, You can change this in the orion-ejb-jar.xml file in the application-deployments directory. Owen -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Toni Menzel Sent: 05 October 2001 12:39 To: Orion-Interest Subject: explicit table-names in CMP dear all, We want to define an explicit table name for CMP's in OrionAppServer. By default, CMP tables have the names of the full qualified classname (entitybean). E.g. if the ejb-entity-class is net.quintessence.core.Leg then the table's name is: net_quintessence_core_leg. But we want to use already existing tables which where mapped into ejb-entities. Is that possible? how? thanx in advance, Toni Menzel --- [EMAIL PROTECTED] quintessence consulting GmbH - germany
RE: The Security (again)
Title: En blanco If you are running a separate application (not the default one) you need to put the group and user permissions in the application-deployment principals.xml file. Not the one in the config directory. Hope this helps Owen Fellows -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of David BonillaSent: 21 September 2001 18:22To: Orion-InterestSubject: The Security (again) I discover myself how to get a dialog to put the login and password when my application starts, now, the problem is that... it doesn´t work properly !!! I write the correct login and password but the server doesn´t recognize it !!! Someboy has a good idea about what happens ? Thank you very much !!! __David Bonilla FuertesTHE BIT BANG NETWORKhttp://www.bit-bang.comProfesor Waksman, 8, 6º B28036 MadridSPAINTel.: (+34) 914 577 747Móvil: 656 62 83 92Fax: (+34) 914 586 176__
RE: OC4J datasource / server crash problem
When you get the connection you will need to put it in a try and catch. At the end use a finally to return the connection. e.g. try { Connection c = YourClass.getConnection(); } catch (SQLException ex) { //Do something with the exception } finally { YourClass.returnJDBCConnection(c); } -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Ian S. Hagen Sent: 11 September 2001 08:21 To: Orion-Interest Subject: OC4J datasource / server crash problem Hi, I am currently part of a project developing a servlet/stateless EJB solution to be run on the Orion platform. We are experiencing some problems using our datasource connection to our Oracle 9i database. The server will on occasion leak connections, which eventually results in both the Orion server and the database crashing. I include our data-sources.xml file to indicate how things are set up. We currently only use the ejb-location for database access from our EJBs and servlets. ?xml version=1.0? !DOCTYPE data-sources PUBLIC Orion data-sources http://xmlns.oracle.com/ias/dtds/data-sources.dtd; data-sources !-- Setting up the data source for the zellsoft provider -- data-source class=com.evermind.sql.DriverManagerDataSource name=zellsoft location=jdbc/zellsoft xa-location=jdbc/xa/zellsoft ejb-location=jdbc/ejb/zellsoft pooled-location=jdbc/pool/zellsoft connection-driver=oracle.jdbc.driver.OracleDriver url=jdbc:oracle:thin:@oracle.zellsoft.com:1521:UTF username=zs password=zs max-connections=20 min-connections=5 max-connect-attempts=10 connection-retry-interval=1 inactivity-timeout=30 wait-timeout=30 / /data-sources Our code for retrieval of the database connection: private static Connection getConnection( String provider, String prefix ) throws InitializerException { try { if (ic==null) ic = new InitialContext(); DataSource ds = (DataSource) ic.lookup(prefix+provider); Connection conn = ds.getConnection(); conn.setAutoCommit(false); return conn; } catch (NamingException cfe) { throw new InitializerException(Unable to lookup Datasource ); } catch (SQLException se) { throw new InitializerException(Unable to get DB connection); } } Returning the connection: public static void returnJDBCConnection(Connection conn) throws InitializerException { try { conn.close(); } catch (SQLException se) { throw new InitializerException(Unable to return DB connection); } } The exception we are getting is: OrionCMTConnection not closed, check your code! LogicalDriverManagerXAConnection not closed, check your code! Created at: java.lang.Throwable: OrionCMTConnection created at com.evermind.sql.OrionCMTConnection.init(OrionCMTConnection.java:39) at com.evermind.sql.OrionCMTDataSource.getConnection(OrionCMTDataSource.jav a:56) at com.zellsoft.services.dbconnection.Initializer.getConnection(Initializer .java:79) at com.zellsoft.services.dbconnection.Initializer.getJDBCConnection(Initial izer.java:46) at com.zellsoft.session.SessionManagerEJBBean.logOnAdmUser(SessionManagerEJ BBean.java:1276) at com.zellsoft.session.SessionManagerEJBBean.logOnUser(SessionManagerEJBBe an.java:1250) at com.zellsoft.session.SessionManagerEJBBean.executeCmd(SessionManagerEJBB ean.java:475) at SessionManagerEJB_StatelessSessionBeanWrapper0.executeCmd(SessionManager EJB_StatelessSessionBeanWrapper0.java:71) at com.zellsoft.media.web.adm.AmmWeb.doPost(AmmWeb.java:157) at javax.servlet.http.HttpServlet.service(HttpServlet.java:211) at javax.servlet.http.HttpServlet.service(HttpServlet.java:309) at javax.servlet.http.HttpServlet.service(HttpServlet.java:336) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestD ispatcher.java:508) at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(Servle tRequestDispatcher.java:177) at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHa ndler.java:576) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java: 189) at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:62) I have experiemented using the oracle.jdbc.pool.OracleConnectionPoolDataSource, but is appears to cause connections to be leaked at an even higher rate. Environment: Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode) SuSE Linux Can you say if we are doing anything wrong? I have inspected the code, and cannot find anywhere where connections are never returned. All our JDBC is within
RE: Debugging with Orion/Kawa Pro 5.0
I remember seeing something about orion not working in Kawa Enterprise. We had a problem where if you install Enterprise the uninstalled. Then installed Kawa Pro you could not run orion from inside. Can't remember if this was orion but there where issues with changing Kawa'a (if think kawa released a patch to fix it). -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of DENNIS STRAIGHT Sent: 07 September 2001 06:48 To: Orion-Interest Subject: Debugging with Orion/Kawa Pro 5.0 I appreciate Dave Smith's write-up on debugging with Orion/Kawa but, unfortunately, I think I'm missing something and need more info. Here is what I did: Created a new project with all of my java files (servlets, EJBs, and regular Java). Added Orion.jar to the Kawa classpath. Set the class to run to com.evermind.server.ApplicationServer Made sure JVMDI was turned off Added breakpoints, hit F5 and... nothing happens, I don't see orion starting in Kawa's output pane... I don't see anything. Next, I open a web browser set to a localhost url that works fine when I run Orion from DOS and, of course, the page is not found. Because Orion hasn't started, I'm sure. Does anybody know what I'm doing wrong (Why Kawa isn't starting Orion)? Below I'll print Dave Smith's debugging tips, if anybody can tell me anything that is missing I would greatly appreciate it. Thanks, Dennis Dave Smith adds: Debugging with Orion and Kawa is a pleasure. Get Kawa Pro (not the enterprise version) from Tek-Tools and install it. Configure your JDK as required when you first run Kawa. (Note that Kawa is a Win32 application, which is one of the reasons I don't use it.) Create a new project for your servlets or EJBs. Add orion.jar, any additional jars required by the application, and the deployed class directory (i.e., c:\applications\myApp\myApp-web\WEB-INF\classes or c:\applications\myApp\myApp-ejb, or both). From the Project/Interpreter menu, set the Java class to run to com.evermind.server.ApplicationServer and remember to tell it to use this class (as this image, given me by Chris Miller, shows). Turn off JVMDI debugger from the Customize/Options/Advanced Paths form, which is for performance only and is not vital. Add the breakpoints to your servlets and/or EJBs. F5 starts debugging, and Dave adds to Relax, sit back and enjoy the ride. The speed kills NetBeans dead. Also from Dave: For a real screamer, use Jikes: Customize/Options/Advanced Paths/Compiler = D:\jikes\jikes.exe +E And set Orion to use jikes from $ORION/server.xml.
RE: Not in an application scope
Hi, Ensure there is a reference to your principals file in either server.xml (if running a previous version) or in application.xml in the latest version. Not sure about the -userThreads as I run something like java -jar orion.jar -userThreads and this seems to work fine. Hope this helps. Owen -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Carles Pairot Sent: 03 September 2001 10:31 To: Orion-Interest Subject: Not in an application scope Hi all, I have written an application client but when it tries to get the InitialContext it appears a java.lang.SecurityException: Invalid username/password for jle2-test (user). The user is on the principals.xml file of orion/config and on the application deployment directory. Apart from that, in the Orion window appears the next message: [OrionDataSourceManager].javax.naming.NamingException: Not in an application scope - start Orion with the -userThreads switch if using user-created threads I have tried with -userThreads option but the message is the same again. The application client I have created contains both application-client.xml and orion-application-client.xml in the Meta-Inf directory. Does anybody know what I am doing wrong ? Thanks in advance. ·· Carles Pairot Gavaldà Essi Projects [EMAIL PROTECTED] t +34 977 221 182 http://www.essiprojects.com f +34 977 230 170 ··
RE: External EJB Client
You need the application-client.xml file on the client machine. If you place it in a META-INF directory below the location where your program is running it should be able to find it. In the application-client.xml you need to define the resource you are trying to look up. If you get it working could you post the step you went through as i have gone through the examples proved with orion and i still can not get a client to use an ejb. Hope this helps. Owen Fellows -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Ed Brown Sent: 28 August 2001 04:44 To: Orion-Interest Subject: External EJB Client I'm trying to call an EJB from outside of the Orion enviornment. I get the following stack trace: javax.naming.NamingException: META-INF/application-client.xml resource not found at com.evermind.server.ApplicationClientInitialContextFactory.getInitialContext (JAX) at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:668) at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246) at javax.naming.InitialContext.init(InitialContext.java:222) at javax.naming.InitialContext.init(InitialContext.java:198) at com.ekb.email.ReceiptMailServer.getContext(ReceiptMailServer.java:62) at com.ekb.email.ReceiptMailServer.init(ReceiptMailServer.java:85) at com.ekb.email.ReceiptMailServer.main(ReceiptMailServer.java:224) - I'm using ant to build and deploy. I defined the following in the build.xml file: target name=ejb-meta-inf depends=prepare copy file=${etc.dir}/ejb-jar.xml tofile=${lib.dir}/ejb/META-INF/ejb-jar.xml / copy file=${etc.dir}/application-client.xml tofile=${lib.dir}/ejb/META-INF/application-client.xml / /target Does anyone know why I'm still getting the exception? Thanks in advance. Ed Brown _ This mail sent via toadmail.com, web e-mail @ ToadNet - want to go fast? http://www.toadmail.com
RE: Deploying EJBs
If you open the orionconsole I think it will tell you all the EJB's etc that have been deployed in your application. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Tom Jordan Sent: 14 August 2001 06:53 To: Orion-Interest Subject: Deploying EJBs Is there anyway to determine that a set of EJBs that are in an ear have been deployed onto that server. I just want to know if an ear that was suppose to autodeploy has infact deployed. Thanks Tom _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
Problems getting an Application-Client to use a datasource in Orion
I have an orion server using a datasource. I want to connect to this datasource from outside the application but I'm having problems. I have created this program. import java.util.*; import java.sql.*; import javax.naming.*; import com.evermind.sql.*; public class TestConnect { public TestConnect() { try { System.out.println (Before IC); InitialContext ic = new InitialContext(); System.out.println (After IC); OrionPooledDataSource ds = (OrionPooledDataSource)ic.lookup(java:comp/env/external/DATASOURCE); Connection c = ds.getConnection(); System.out.println (After Connection, c is isClosed = + new Boolean (c.isClosed()).toString()); String query = SELECT COUNT(*) FROM USERS; PreparedStatement s = c.prepareStatement(query); System.out.println (After createStatement, s is null = + new Boolean (s==null).toString()); ResultSet rs = s.executeQuery (); rs.next(); System.out.println (User Count = + rs.getString (COUNT (*))); rs.close(); s.close(); c.close(); } catch (SQLException ex) { System.out.println (ex.getMessage()); ex.printStackTrace(); } catch (NamingException ex) { System.out.println (ex.getMessage()); } } public static void main (String[] args) { new TestConnect(); } } I have also set up the jndi.properties file java.naming.factory.initial=com.evermind.server.ApplicationClientInitialContextFactory java.naming.provider.url=ormi://localhost/app java.naming.security.principal=admin java.naming.security.credentials=password The program runs and i getting the following output and error. Before IC After IC Exception in thread main java.lang.NullPointerException at com.evermind.sql.OrionPooledDataSource.d7(JAX) at com.evermind.sql.OrionPooledDataSource.d8(JAX) at com.evermind.sql.OrionPooledDataSource.getConnection(JAX) at TestConnect.init(TestConnect.java:17) at TestConnect.main(TestConnect.java:45) Has anyone got any ideas why i would be getting this error. I have also tried different DataSource classes to see if you had to us a specific one for remote connections. Still not luck. Thanks Owen