MD5 of a String in a EJB

Hello,
I've tried to get a message digest of a pwd, and it works. But the problem is, that I alway get the same digest message. Consider, that it is always the same password, but this could not be the problem --> see MD5 Algorithm.
This are the lines of code:
MessageDigest md = MessageDigest.getInstance("MD5");
md.reset();
byte[] digest = md.digest(pwd.getBytes("UTF-8"));
return digest.toString();I think there could be a problem cause of using it in a Bean.
Could anybody give me some hints?

direct question with direct answer.
Here are three sequences of computing a MD5, how I
understood it
1. "text" -> MD5 ->"@f=l"
2. "hello -> MD5 ->"[o0\_"
3. "text" -> MD5 ->"@f=l"
Consider step 1. and step 2. have the same input
"text" and the result is the same "@f=l" Hash-value.
Is this right, or do I�ve not understand it?Don't you mean step 1 and step 3? I will assume so.
If the MD5 of a value is not the same each time then what is the point? If you are using this to scramble a password then how would one compare a presented password with a stored password if the MD5 hash values were not the same each time you hashed a particular value!

Similar Messages

  • Problems with string literals in ejb-ql's

    I have a couple EJB-QL's that look like:
    <![CDATA[SELECT OBJECT(o) FROM AssignedStatus AS o WHERE o.recipientID = ?1 AND o.statusID = ?2 AND o.state <> 'r']]>
    which used to work in Orion without a problem but in OC4J I get the following errors:
    com/sun/ejb/ejbql/StringLiteral
    EJB QL statement : 'SELECT OBJECT(o) FROM AssignedStatus AS o WHERE o.recipientID = ?1 AND o.statusID = ?2 AND o.state <> 'r'
    EJB QL method : public abstract com.mongoosetech.reputation.ejb_entity.AssignedStatus com.mongoosetech.reputation.ejb_enti
    ty.AssignedStatusHome.findByRecipientIDAndStatusIDNotRevoked(java.lang.String,java.lang.String) throws javax.ejb.FinderExcept
    ion,java.rmi.RemoteException
    at com.sun.ejb.ejbql.parser.EjbQLParser.parse(EjbQLParser.java:226)
    at com.sun.ejb.ejbql.EjbQLDriver.parse(EjbQLDriver.java:86)
    at com.sun.ejb.sqlgen.SQLGenerator.generateSQLForEjbQLQueries(SQLGenerator.java:628)
    at com.sun.ejb.sqlgen.SQLGenerator.generateSQL(SQLGenerator.java:270)
    at com.evermind.server.ejb.deployment.EJBPackage.init(EJBPackage.java:1947)
    at com.evermind.server.ServerComponent.init(ServerComponent.java:199)
    at com.evermind.server.ejb.EJBPackageDeployment.getPackage(EJBPackageDeployment.java:645)
    at com.evermind.server.ejb.EJBContainer.postInit(EJBContainer.java:513)
    at com.evermind.server.Application.postInit(Application.java:429)
    at com.evermind.server.Application.setConfig(Application.java:136)
    at com.evermind.server.ApplicationServer.addApplication(ApplicationServer.java:1479)
    at com.evermind.server.ApplicationServer.initializeApplications(ApplicationServer.java:1436)
    at com.evermind.server.ApplicationServer.setConfig(ApplicationServer.java:1099)
    at com.evermind.server.ApplicationServerLauncher.run(ApplicationServerLauncher.java:93)
    at java.lang.Thread.run(Thread.java:479)
    at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:49)
    Error in application ACME Portal: Error loading package at file:/C:/dev/staging/portalstudio/ee/image/deploy/portal/portal-ej
    b.jar, Failure to initialize EJBQL descriptors: com/sun/ejb/ejbql/StringLiteral
    EJB QL statement : 'SELECT OBJECT(o) FROM AssignedStatus AS o WHERE o.recipientID = ?1 AND o.statusID = ?2 AND o.state <> 'r'
    EJB QL method : public abstract com.mongoosetech.reputation.ejb_entity.AssignedStatus com.mongoosetech.reputation.ejb_enti
    ty.AssignedStatusHome.findByRecipientIDAndStatusIDNotRevoked(java.lang.String,java.lang.String) throws javax.ejb.FinderExcept
    ion,java.rmi.RemoteException
    Am I doing something wrong here? These QL's work in several other App Servers so I am lost as to why this doesn't work.

    Kevin,
    We are aware of this bug in the developer's preview and will be fixed when next version of OC4J 9.0.3 will be released.
    regards
    Debu Panda
    Oracle

  • Finding md5 of a string in java

    can any one tell me how to find md5 of a string in java

    md5 is dead. stop using it.There are still cases where it is very useful.
    Have the contents of my file changed since the last time its digest was taken and stored?
    * MD5 implementation
    * written Santeri Paavolainen, Helsinki Finland 1996
    * (c) Santeri Paavolainen, Helsinki Finland 1996
    * modifications Copyright (C) 2002-2004 Stephen Ostermiller
    * http://ostermiller.org/contact.pl?regarding=Java+Utilities
    * This program is free software; you can redistribute it and/or modify
    * it under the terms of the GNU General Public License as published by
    * the Free Software Foundation; either version 2 of the License, or
    * (at your option) any later version.
    * This program is distributed in the hope that it will be useful,
    * but WITHOUT ANY WARRANTY; without even the implied warranty of
    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * GNU General Public License for more details.
    * See COPYING.TXT for details.
    * The original work by Santeri Paavolainen can be found at
    * http://www.helsinki.fi/~sjpaavol/programs/md5/
    */

  • How to use MD5 format of string

    i want to change a password string to md5 format
    how can i do it

    http://www.twmacinta.com/myjava/fast_md5.php

  • Does OC4J support "LIKE" operation in ejb-ql?

    I have a sql in ejb-jar.xml:
    <query>
              <query-method>
                   <method-name>findByZoneidTypeLnameInfo1</method-name>
                   <method-params>
                        <method-param>java.lang.String</method-param>
                        <method-param>int</method-param>
                        <method-param>java.lang.String</method-param>
                   </method-params>
              </query-method>
              <ejb-ql>
                   <![CDATA[ SELECT OBJECT(a) FROM rrdata AS a WHERE a.zoneid = ?1 AND a.type = ?2 AND a.lname = ?3 AND a.info1 LIKE 'udns%.ultradns.net.' ]]>
              </ejb-ql>
         </query>
    When compiling, I got an error:
    com/sun/ejb/ejbql/StringLiteral
    EJB QL statement : 'SELECT OBJECT(a) FROM rrdata AS a WHERE a.zoneid = ?1 AND a.
    type = ?2 AND a.lname = ?3 AND a.info1 LIKE 'udns%.ultradns.net.''
    EJB QL method : public abstract java.util.Collection com.ultradns.j2ee.compon
    ents.ultradns.rrdata.ejb.RrdataHome.findByZoneidTypeLnameInfo1(java.lang.String,
    int,java.lang.String) throws javax.ejb.FinderException
    at com.sun.ejb.ejbql.parser.EjbQLParser.parse(EjbQLParser.java:226)
    at com.sun.ejb.ejbql.EjbQLDriver.parse(EjbQLDriver.java:86)
    at com.sun.ejb.sqlgen.SQLGenerator.generateSQLForEjbQLQueries(SQLGenerat
    or.java:628)
    at com.sun.ejb.sqlgen.SQLGenerator.generateSQL(SQLGenerator.java:270)
    at com.evermind.server.ejb.deployment.EJBPackage.init(EJBPackage.java:19
    47)
    at com.evermind.server.ServerComponent.init(ServerComponent.java:224)
    at com.evermind.server.ejb.EJBPackageDeployment.getPackage(EJBPackageDep
    loyment.java:645)
    at com.evermind.server.ejb.EJBContainer.postInit(EJBContainer.java:513)
    at com.evermind.server.Application.postInit(Application.java:429)
    at com.evermind.server.Application.setConfig(Application.java:136)
    at com.evermind.server.ApplicationServer.addApplication(ApplicationServe
    r.java:1479)
    at com.evermind.server.ApplicationServer.initializeApplications(Applicat
    ionServer.java:1436)
    at com.evermind.server.ApplicationServer.setConfig(ApplicationServer.jav
    a:1099)
    at com.evermind.server.ApplicationServerLauncher.run(ApplicationServerLa
    uncher.java:93)
    at java.lang.Thread.run(Thread.java:484)
    at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:49)
    Error in application dnsmanager: Error loading package at file:/C:/java/oc4j/j2e
    e/home/applications/dnsmanager/ejb/, Failure to initialize EJBQL descriptors: co
    m/sun/ejb/ejbql/StringLiteral
    EJB QL statement : 'SELECT OBJECT(a) FROM rrdata AS a WHERE a.zoneid = ?1 AND a.
    type = ?2 AND a.lname = ?3 AND a.info1 LIKE 'udns%.ultradns.net.''
    EJB QL method : public abstract java.util.Collection com.ultradns.j2ee.compon
    ents.ultradns.rrdata.ejb.RrdataHome.findByZoneidTypeLnameInfo1(java.lang.String,
    int,java.lang.String) throws javax.ejb.FinderException

    I would suggest to try
    "from Brukerkonto as o"
    instead of
    "from Brukerkonto o"

  • How to include md5 package in application

    Hi All,
    First of all sorry I posted in another users thread. In the thread http://forums.sun.com/thread.jspa?threadID=5426671 the person used org.bouncycastle.crypto.digests.MD5Digest for doing md5.
    I need some help here on how you include the org.bouncycastle.crypto.digests.MD5Digest library in my java code as I want to use the md5.
    I am also working on something similar like that but without the web application part and a detail which consists on OTP part using md5.
    As the md5() doesn't work in j2me so was also searching for something which will work on MIDP.
    package com.abc; //package define
    public class messDig5 //class define
        private String generateHash(String OTP, int loopNum) {
            byte[] secretBytes = OTP.getBytes();
            for (int x = 0; x < loopNum; x++) {
                byte[] tempStore = new byte[16];
                tempStore = hash(secretBytes);
                secretBytes = tempStore;
         //   return convertToHex(secretBytes);
            return byteArrayToHexString(secretBytes);
        public byte[] hash(byte[] secretBytes) {
           org.bouncycastle.crypto.digests.MD5Digest digest = new org.bouncycastle.crypto.digests.MD5Digest();
            digest.reset();
            // Update MD5 digest with user secret in byte format
            digest.update(secretBytes, 0, secretBytes.length);
            // get length of digest to initialise new md5 byte array
            int length = digest.getDigestSize();
            // create md5 byte array using length
            byte[] md5 = new byte[length];
            // calculate MD5 hash, using md5 byte array, 0 for buffer offset
            digest.doFinal(md5, 0);
            return md5;
    //    private static String convertToHex(byte[] data) {
    //        StringBuffer buf = new StringBuffer();
    //        String Hex;
    //        String formattedHex;
    //        for (int i = 0; i < data.length; i++) {
    //            int halfbyte = (data[i] >>> 4) & 0x0F;
    //            int two_halfs = 0;
    //            do {
    //                if ((0 <= halfbyte) && (halfbyte <= 9)) {
    //                    buf.append((char) ('0' + halfbyte));
    //                } else {
    //                    buf.append((char) ('a' + (halfbyte - 10)));
    //                halfbyte = data[i] & 0x0F;
    //            } while (two_halfs++ < 1);
    //        Hex = buf.toString();
    //        formattedHex = "\n" + Hex.substring(0, 4) + " " + Hex.substring(4, 8) + " " + Hex.substring(8, 12) + " " + Hex.substring(12, 16) + " " + Hex.substring(16, 20) + " " + Hex.substring(20, 24) + " " + Hex.substring(24, 28) + " " + Hex.substring(28, 32);
    //        return formattedHex;
        static String byteArrayToHexString(byte byteValues[]) {
            byte singleChar = 0;
            if (byteValues == null || byteValues.length <= 0) {
                return null;
            String entries[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
                "a", "b", "c", "d", "e", "f"};
            StringBuffer out = new StringBuffer(byteValues.length * 2);
            for (int i = 0; i < byteValues.length; i++) {
                singleChar = (byte) (byteValues[i] & 0xF0);
                singleChar = (byte) (singleChar >>> 4);
                // shift the bits down
                singleChar = (byte) (singleChar & 0x0F);
                out.append(entries[(int) singleChar]);
                singleChar = (byte) (byteValues[i] & 0x0F);
                out.append(entries[(int) singleChar]);
            String rslt = new String(out);
            return rslt;

    Camellia,
    I take you already added bouncycatsle to your project as a compile dependency, since it compiles (unless it does not).
    All you have to do for your code to work on the phone, you need to build your JAR file (that you use to distribute your MIDlet) with bouncycastle packaged in. This will all depend on the method you use to build your JAD and JAR files.
    I use antenna tool, which provides me with ant tasks to compile, build jar, package external libraries etc. Your scenario can be different, but all you have to do is to search manuals and/or google for methods on how to package external libraries with your build.
    Daniel

  • Problem with Stateful EJB in JBOSS

    Hi,
    J have a problem with invoking stateful EJB methods from my web application deployed in Jboss 4.0.5.GA both. The same EJB with WebLogic functions perfectly, instead with Jboss it often throws the following exception:
    ERROR [org.jboss.ejb.plugins.LogInterceptor]
    EJBException in method: public abstract java.lang.String
    infrastruttura.server.ejb.sessionproxy.SessionProxy.getCodiceGruppo() throws
    java.rmi.RemoteException:
    javax.ejb.EJBException: Application Error: tried to enter Stateful bean with
    different tx context, contextTx: TransactionImpl:XidImpl[FormatId=257,
    GlobalId=pitjb01/305, BranchQual=, localId=305], methodTx:
    TransactionImpl:XidImpl[FormatId=257, GlobalId=pitjb01/306, BranchQual=,
    localId=306]
    at
    org.jboss.ejb.plugins.StatefulSessionInstanceInterceptor.invoke(StatefulSessionInstanceInterceptor.java:283)
    at
    org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
    at
    org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
    at
    org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
    at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
    at
    org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
    at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
    at org.jboss.ejb.Container.invoke(Container.java:954)
    at sun.reflect.GeneratedMethodAccessor79.invoke(Unknown Source)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at
    org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    at
    org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
    at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
    at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:209)
    at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:195)
    at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
    at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
    at
    org.jboss.proxy.ejb.StatefulSessionInterceptor.invoke(StatefulSessionInterceptor.java:121)
    at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
    at $Proxy83.getCodiceGruppo(Unknown Source)
    at org.apache.jsp.jsp.main_jsp._jspService(main_jsp.java:117)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at
    org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
    at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    at
    org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    at
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:199)
    at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282)
    at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:767)
    at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:697)
    at
    org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:889)
    at
    org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    at java.lang.Thread.run(Thread.java:595)
    2008-02-27 20:19:54,458 ERROR
    [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[PitagoraOlo].[jsp]]
    Servlet.service() for servlet jsp threw exception
    java.rmi.ServerException: EJBException:; nested exception is:
    javax.ejb.EJBException: Application Error: tried to enter Stateful bean with
    different tx context, contextTx: TransactionImpl:XidImpl[FormatId=257,
    GlobalId=pitjb01/305, BranchQual=, localId=305], methodTx:
    TransactionImpl:XidImpl[FormatId=257, GlobalId=pitjb01/306, BranchQual=,
    localId=306]
    at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:365)
    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:209)
    at
    org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
    at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
    at org.jboss.ejb.Container.invoke(Container.java:954)
    at sun.reflect.GeneratedMethodAccessor79.invoke(Unknown Source)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at
    org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    at
    org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
    at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
    at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:209)
    at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:195)
    at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
    at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
    at
    org.jboss.proxy.ejb.StatefulSessionInterceptor.invoke(StatefulSessionInterceptor.java:121)
    at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
    at $Proxy83.getCodiceGruppo(Unknown Source)
    at org.apache.jsp.jsp.main_jsp._jspService(main_jsp.java:117)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at
    org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
    at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    at
    org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    at
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:199)
    at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282)
    at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:767)
    at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:697)
    at
    org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:889)
    at
    org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    at java.lang.Thread.run(Thread.java:595)
    Caused by: javax.ejb.EJBException: Application Error: tried to enter Stateful
    bean with different tx context, contextTx: TransactionImpl:XidImpl[FormatId=257,
    GlobalId=pitjb01/305, BranchQual=, localId=305], methodTx:
    TransactionImpl:XidImpl[FormatId=257, GlobalId=pitjb01/306, BranchQual=,
    localId=306]
    at
    org.jboss.ejb.plugins.StatefulSessionInstanceInterceptor.invoke(StatefulSessionInstanceInterceptor.java:283)
    at
    org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
    at
    org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
    at
    org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
    at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
    ... 47 more
    Is there someone can help me?
    thanks forward.

              We got resolved it through bea. This is a know problem of WLS6.1 Sp4. Bea has provided
              us with a patch, after which every thing seems to be working fine.
              Please open a case with bea mentioning the CR092146. You can read the description
              of this CR on internet.
              This will certainly solve your problem.
              Bob Butkus <[email protected]> wrote:
              >We are experiencing the same issue. Did you ever get this resolved?
              

  • Stand-alone JNDI lookup of an EJB in an Enterprise Application (EAR) build

    Hi All,
    I am having some difficulty doing JNDI look up an EJB 3.0 Bean that is part of an Enterprise Application (EAR) build. Below are all the related codes:
    package ejb;
    import javax.ejb.Local;
    @Local
    public interface Hello1Local {
        public String getHello1();
    package ejb;
    import javax.ejb.Stateless;
    @Stateless
    public class Hello1Bean implements Hello1Local {
        public String getHello1() {
            return "I am Hello1 Bean!";
    package ejb;
    import javax.ejb.Remote;
    @Remote
    public interface Hello2Remote {
        public String getHello2();
    package ejb;
    import javax.ejb.Stateless;
    import javax.ejb.EJB;
    @Stateless
    @EJB(name="ejb/Hello1",
         beanInterface=Hello1Local.class,
         beanName="Hello1Bean")
    public class Hello2Bean implements Hello2Remote {
        @EJB private Hello1Local hello1bean;
        public String getHello2() {
            return hello1bean.getHello1();
    There is no problem looking up Hello2 Bean using an Application Client such as the following:
    public class LocalHelloApplicationClient {
        @EJB(name="Hello2")
        private static Hello2Remote hello2Bean;
        public static void main(String[] args) {
            System.out.println("hello2Bean.getHello2(): " + hello2Bean.getHello2());
    }There is also no problem doing JNDI lookup (from a Stand-Alone Client the same bean if both Hello1 and Hello2 were created by themselves. ie not part of an Enterprise Application (EAR) build. However, I am wondering whether it is possible to do JNDI lookup of the same bean (Hello2) that is part of an Enterprise Application (EAR) built. Below are the type of JNDI lookup entries that I have tried without success:
    public class StandalonePojoCallHelloWorld {
        public static void main(String [] args)
            try
                InitialContext jndiContext = new InitialContext();
                Hello2Remote hello2Bean =  (Hello2Remote) jndiContext.lookup("ejb.Hello2Remote");
                                                                     or
                Hello2Remote hello2Bean =  (Hello2Remote) jndiContext.lookup("LocalHelloEnterpriseApplication.Hello2.remote");
                                                                     or
                Hello2Remote hello2Bean =  (Hello2Remote) jndiContext.lookup("LocalHelloEnterpriseApplication.ejb.Hello2Remote");
                                                                     or
                Hello2Remote hello2Bean =  (Hello2Remote) jndiContext.lookup("LocalHelloEnterpriseApplication.Hello2Remote");
                                                                     or
                Hello2Remote hello2Bean =  (Hello2Remote) jndiContext.lookup("LocalHelloEnterpriseApplication.LocalHelloEnterpriseApplication-ejb.Hello2Remote");
                System.out.println("hello2Bean.getHello2(): " + hello2Bean.getHello2());
            catch (javax.naming.NamingException ne)
             ne.printStackTrace();
    They all came up with the same error message:
    javax.naming.NameNotFoundException: LocalHelloEnterpriseApplication.LocalHelloEnterpriseApplication-ejb.Hello2Remote not found
            at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:216)
            at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:188)
            at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:74)
            at com.sun.enterprise.naming.RemoteSerialContextProviderImpl.lookup(RemoteSerialContextProviderImpl.java:129)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)Any suggestion would be appreciated.
    Thanks,
    Jack

    Hello
    I've somme problems to get access to ejb interface from remote stand-alone client.
    Here is my EJB code :
    package stateless;
    import javax.ejb.Stateless;
    @Stateless(name = "TestSB", mappedName = "ejb/stateless/TestSB")
    public class TestEJBBean implements TestEJBRemote {
        public String getMessage() {
           return "Hello EJB World";
    }And the remote interface :
    package stateless;
    import javax.ejb.Remote;
    @Remote
    public interface TestEJBRemote {
        String getMessage();
    } In client side, i just edit main.java like this :
    package testclient;
    import java.io.FileInputStream;
    import java.util.Properties;
    import javax.naming.InitialContext;
    import stateless.TestEJBRemote;
    public class Main {
        public static void main(String[] args) throws Exception {
            Properties props = new Properties();
            props.load(new FileInputStream("jndi.properties"));
            InitialContext ctx = new InitialContext(props);
            TestEJBRemote testEJB = (TestEJBRemote) ctx.lookup("ejb/stateless/TestSB");
            System.out.println(testEJB.getMessage());
    }here is my jndi.properties file (my glassfish server IP is 192.168.0.10) :
    java.naming.factory.initial = com.sun.enterprise.naming.SerialInitContextFactory
    java.naming.factory.url.pkgs = com.sun.enterprise.naming
    java.naming.factory.state = com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl
    org.omg.CORBA.ORBInitialHost = 192.168.0.10
    org.omg.CORBA.ORBInitialPort = 3918when i run client on the same machine than the glassfish app server, it works fine.
    But i run it on the different machine than the glassfish app server (on the same LAN without firewall), it fails with this error message :
    eclan@eclan-laptop:~/NetBeansProjects/TestClient$ java -jar dist/TestClient.jar
    24 ao&ucirc;t 2008 09:53:05 com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl <init>
    ATTENTION: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: 127.0.1.1; port: 3918"
    org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 201  completed: No
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2690)
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2711)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:261)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:274)
         at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:130)
         at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:192)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:181)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:325)
         at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
         at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69)
         at com.sun.enterprise.naming.SerialContext.narrowProvider(SerialContext.java:131)
         at com.sun.enterprise.naming.SerialContext.getRemoteProvider(SerialContext.java:220)
         at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:160)
         at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
         at javax.naming.InitialContext.lookup(InitialContext.java:392)
         at testclient.Main.main(Main.java:14)
    Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:347)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:244)
         ... 13 more
    Caused by: java.net.ConnectException: Connection refused
         at sun.nio.ch.Net.connect(Native Method)
         at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:507)
         at com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:105)
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:332)
         ... 14 more
    24 ao&ucirc;t 2008 09:53:05 com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl <init>
    ATTENTION: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: 127.0.1.1; port: 4038"
    org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 201  completed: No
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2690)
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2711)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:261)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:274)
         at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:130)
         at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:192)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:181)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:325)
         at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
         at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69)
         at com.sun.enterprise.naming.SerialContext.narrowProvider(SerialContext.java:131)
         at com.sun.enterprise.naming.SerialContext.getRemoteProvider(SerialContext.java:220)
         at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:160)
         at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
         at javax.naming.InitialContext.lookup(InitialContext.java:392)
         at testclient.Main.main(Main.java:14)
    Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:347)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:244)
         ... 13 more
    Caused by: java.net.ConnectException: Connection refused
         at sun.nio.ch.Net.connect(Native Method)
         at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:507)
         at com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:105)
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:332)
         ... 14 more
    24 ao&ucirc;t 2008 09:53:05 com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl <init>
    ATTENTION: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: 127.0.1.1; port: 4138"
    org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 201  completed: No
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2690)
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2711)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:261)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:274)
         at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:130)
         at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:192)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:181)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:325)
         at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
         at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69)
         at com.sun.enterprise.naming.SerialContext.narrowProvider(SerialContext.java:131)
         at com.sun.enterprise.naming.SerialContext.getRemoteProvider(SerialContext.java:220)
         at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:160)
         at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
         at javax.naming.InitialContext.lookup(InitialContext.java:392)
         at testclient.Main.main(Main.java:14)
    Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:347)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:244)
         ... 13 more
    Caused by: java.net.ConnectException: Connection refused
         at sun.nio.ch.Net.connect(Native Method)
         at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:507)
         at com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:105)
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:332)
         ... 14 more
    24 ao&ucirc;t 2008 09:53:05 com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl <init>
    ATTENTION: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: 127.0.1.1; port: 3918"
    org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 201  completed: No
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2690)
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2711)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:261)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:274)
         at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:130)
         at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:192)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:181)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:325)
         at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
         at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69)
         at com.sun.enterprise.naming.SerialContext.narrowProvider(SerialContext.java:131)
         at com.sun.enterprise.naming.SerialContext.getRemoteProvider(SerialContext.java:220)
         at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:160)
         at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
         at javax.naming.InitialContext.lookup(InitialContext.java:392)
         at testclient.Main.main(Main.java:14)
    Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:347)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:244)
         ... 13 more
    Caused by: java.net.ConnectException: Connection refused
         at sun.nio.ch.Net.connect(Native Method)
         at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:507)
         at com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:105)
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:332)
         ... 14 more
    24 ao&ucirc;t 2008 09:53:05 com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl <init>
    ATTENTION: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: 127.0.1.1; port: 4038"
    org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 201  completed: No
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2690)
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2711)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:261)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:274)
         at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:130)
         at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:192)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:181)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:325)
         at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
         at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69)
         at com.sun.enterprise.naming.SerialContext.narrowProvider(SerialContext.java:131)
         at com.sun.enterprise.naming.SerialContext.getRemoteProvider(SerialContext.java:220)
         at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:160)
         at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
         at javax.naming.InitialContext.lookup(InitialContext.java:392)
         at testclient.Main.main(Main.java:14)
    Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:347)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:244)
         ... 13 more
    Caused by: java.net.ConnectException: Connection refused
         at sun.nio.ch.Net.connect(Native Method)
         at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:507)
         at com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:105)
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:332)
         ... 14 more
    24 ao&ucirc;t 2008 09:53:05 com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl <init>
    ATTENTION: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: 127.0.1.1; port: 4138"
    org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 201  completed: No
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2690)
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2711)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:261)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:274)
         at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:130)
         at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:192)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:181)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:325)
         at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
         at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69)
         at com.sun.enterprise.naming.SerialContext.narrowProvider(SerialContext.java:131)
         at com.sun.enterprise.naming.SerialContext.getRemoteProvider(SerialContext.java:220)
         at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:160)
         at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
         at javax.naming.InitialContext.lookup(InitialContext.java:392)
         at testclient.Main.main(Main.java:14)
    Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:347)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:244)
         ... 13 more
    Caused by: java.net.ConnectException: Connection refused
         at sun.nio.ch.Net.connect(Native Method)
         at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:507)
         at com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:105)
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:332)
         ... 14 more
    eclan@eclan-laptop:~/NetBeansProjects/TestClient$ THANKS YOU FOR YOUR HELP
    Justin

  • EJB QL "LIKE" PROBLEM

    Hai All.
    I got an error when put this EJB-QL syntax :
    <query>
    <query-method>
    <method-name>findByName</method-name>
    <method-params>
    <method-param>java.lang.String</method-param>
    </method-params>
    </query-method>
    <ejb-ql>SELECT DISTINCT object (a) FROM DummyData a WHERE a.name LIKE ?1</ejb-ql>
    </query>
    Seems like this method cannot take an arguments, because it runs well when I change the <ejb-ql> syntax with harcode query like this :
    <ejb-ql>SELECT DISTINCT object (a) FROM DummyData a WHERE a.name LIKE %FOO%</ejb-ql>
    Is there something wrong with my first syntax?
    or the EJB-QL cannot take an arguments for LIKE operator in EJB 2.0??
    Below is the error output
    Auto-deploying file:/C:/NS/jdev/TAX_WORKSPACE/TAX_PROJECT/classes/ (No previous deployment found)... Encountered "a . birthdate LIKE ?1" at line 1, column 7.
    EJB QL method : public abstract java.util.Collection gov.tax.business.registration.IEbDummyLocalHome.findByName(java.lang.String) throws javax.ejb.FinderException
    com.sun.ejb.ejbql.EjbQLQuery
    com.sun.ejb.ejbql.parser.EjbQLParser.parse(com.sun.ejb.ejbql.SymbolTable, com.sun.enterprise.deployment.PersistenceDescriptor, java.lang.reflect.Method, java.lang.String)
    Thanx in advance

    Hi,
    You can achieve this by overriding EJB-QL in orion-ejb-jar.xml file. Please look at
    http://otn.oracle.com/docs/products/ias/doc_library/903doc_otn/generic.903/a97677/ql.htm#1005714
    So you can have something like
    <finder-method query="$name like $1"> in orion-ejb-jar.xml
    and a dummy (but valid) ejb-ql in ejb-jar.xml, like
    <ejb-ql>SELECT DISTINCT object (a) FROM DummyData a WHERE a.name =?1</ejb-ql>
    Hope this helps,
    Neelesh
    OTN Team @ IDC

  • [EJB:015001]Unable to link class while server start up.

    I am getting the below exception during weblogic server start up.
    In the server under autodeploy folder there exist a class - AccountCacheLoaderMDB. I clue less, what is the cause for this exception. Can anyone help me out in solving this issue please,its urgent
    <Jun 2, 2011 10:23:01 AM EDT> <Error> <Deployer> <BEA-149205> <Failed to initialize the application 'gts' due to error weblogic.application.ModuleException: Exception preparing module: EJBModule(autodeploy)
    [EJB:011023]An error occurred while reading the deployment descriptor. The error was:
    Error processing annotations: ..
    weblogic.application.ModuleException: Exception preparing module: EJBModule(autodeploy)
    [EJB:011023]An error occurred while reading the deployment descriptor. The error was:
    Error processing annotations: .
         at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:454)
         at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:93)
         at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:387)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
         at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:58)
         Truncated. see log file for complete stacktrace
    weblogic.utils.ErrorCollectionException:
    There are 1 nested errors:
    weblogic.j2ee.dd.xml.AnnotationProcessException: [EJB:015001]Unable to link class sepact.sepact-app.com.citi.gts.alto.accountservice.service.AccountCacheLoaderMDB in Jar C:\Oracle\user_projects\domains\base_domain\autodeploy : java.lang.NoClassDefFoundError: sepact/sepact-app/com/citi/gts/alto/accountservice/service/AccountCacheLoaderMDB (wrong name: com/citi/gts/alto/accountservice/service/AccountCacheLoaderMDB)
         at weblogic.j2ee.dd.xml.BaseJ2eeAnnotationProcessor.addProcessingError(BaseJ2eeAnnotationProcessor.java:1272)
         at weblogic.j2ee.dd.xml.BaseJ2eeAnnotationProcessor.addFatalProcessingError(BaseJ2eeAnnotationProcessor.java:1277)
         at weblogic.ejb.container.dd.xml.EjbAnnotationProcessor.processAnnotations(EjbAnnotationProcessor.java:168)
         at weblogic.ejb.container.dd.xml.EjbDescriptorReaderImpl.processStandardAnnotations(EjbDescriptorReaderImpl.java:332)
         at weblogic.ejb.container.dd.xml.EjbDescriptorReaderImpl.createReadOnlyDescriptorFromJarFile(EjbDescriptorReaderImpl.java:192)
         at weblogic.ejb.spi.EjbDescriptorFactory.createReadOnlyDescriptorFromJarFile(EjbDescriptorFactory.java:93)
         at weblogic.ejb.container.deployer.EJBModule.loadEJBDescriptor(EJBModule.java:1210)
         at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:382)
         at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:93)
         at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:387)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
         at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:58)
         at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:42)
         at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:609)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
         at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:185)
         at weblogic.application.internal.SingleModuleDeployment.prepare(SingleModuleDeployment.java:40)
         at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:154)
         at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60)
         at weblogic.deploy.internal.targetserver.AppDeployment.prepare(AppDeployment.java:141)
         at weblogic.management.deploy.internal.DeploymentAdapter$1.doPrepare(DeploymentAdapter.java:39)
         at weblogic.management.deploy.internal.DeploymentAdapter.prepare(DeploymentAdapter.java:187)
         at weblogic.management.deploy.internal.AppTransition$1.transitionApp(AppTransition.java:21)
         at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:233)
         at weblogic.management.deploy.internal.ConfiguredDeployments.prepare(ConfiguredDeployments.java:165)
         at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:122)
         at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:173)
         at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:89)
         at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
         at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
         at weblogic.j2ee.dd.xml.BaseJ2eeAnnotationProcessor.addProcessingError(BaseJ2eeAnnotationProcessor.java:1271)
         at weblogic.j2ee.dd.xml.BaseJ2eeAnnotationProcessor.addFatalProcessingError(BaseJ2eeAnnotationProcessor.java:1277)
         at weblogic.ejb.container.dd.xml.EjbAnnotationProcessor.processAnnotations(EjbAnnotationProcessor.java:168)
         at weblogic.ejb.container.dd.xml.EjbDescriptorReaderImpl.processStandardAnnotations(EjbDescriptorReaderImpl.java:332)
         at weblogic.ejb.container.dd.xml.EjbDescriptorReaderImpl.createReadOnlyDescriptorFromJarFile(EjbDescriptorReaderImpl.java:192)
         Truncated. see log file for complete stacktrace
    >
    ===============================================================
    Here is the message driven bean.
    package com.xxx.gts.alto.accountservice.service;
    import com.xxx.gts.alto.accountservice.adapter.AccountAdapter;
    import com.xxx.gts.alto.accountservice.util.AccBeanUtil;
    import com.xxx.gts.alto.accountservice.util.AccountConstants;
    import com.xxx.gts.alto.accountservice.util.AccountLoader;
    import org.apache.log4j.Logger;
    import org.springframework.beans.factory.BeanFactory;
    import javax.ejb.ActivationConfigProperty;
    import javax.ejb.EJB;
    import javax.ejb.MessageDriven;
    import javax.ejb.TransactionAttribute;
    import javax.ejb.TransactionAttributeType;
    import javax.ejb.TransactionManagement;
    import javax.ejb.TransactionManagementType;
    import javax.jms.Message;
    import javax.jms.MessageListener;
    import javax.jms.TextMessage;
    * MDB for the Account Cache Loader.
    @MessageDriven(mappedName = "AccountCacheLoaderQueue", activationConfig = {@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),@ActivationConfigProperty(propertyName = "destinationName", propertyValue = "AccountCacheLoaderQueue")})
    @TransactionManagement(value = TransactionManagementType.CONTAINER)
    @TransactionAttribute(value = TransactionAttributeType.NOT_SUPPORTED)
    public class AccountCacheLoaderMDB implements MessageListener {
    private static Logger logger = Logger.getLogger(AccountCacheLoaderMDB.class.getName());
    private static final String LOCAL_ADAPATER = AccBeanUtil.getProperty(AccountConstants.ADAPTER_ID);
    private static final String TOKEN_SEPARATOR = ","; // \\s
    @EJB
    private BeanFactory beanFactory;
    public void onMessage(Message message) {
    logger.debug("Entering onMessage of AccountCacheLoaderMDB");
    try {
    if (message instanceof TextMessage) {
    TextMessage tmsg = (TextMessage) message;
    String[] msgArr = tmsg.getText().split(TOKEN_SEPARATOR);
    logger.debug("Trying to get AccountAdapter");
    AccountAdapter acctAdapter = (AccountAdapter) beanFactory.getBean(LOCAL_ADAPATER);
    if (acctAdapter == null) {
    throw new RuntimeException("Account Adapter cannot be determined.");
    for (String msg : msgArr) {
    if (msg.equalsIgnoreCase(AccountConstants.ACC_RELOAD)) {
    logger.debug("Calling AccountLoader.load");
    AccountLoader.load(acctAdapter);
    } else if (msg.equalsIgnoreCase(AccountConstants.BIC_RELOAD)) {
    logger.debug("Calling AccountLoader.loadBicData");
    AccountLoader.loadBicData(acctAdapter);
    } catch (Exception e) {
    logger.error("Error while loading Account.", e);
    throw new RuntimeException(e);
    logger.debug("Exiting onMessage of AccountCacheLoaderMDB");
    can any one throw some light please...its urgent

    Your class seems to be in the wrong folder structure.
    instead of sepact/sepact-app/com/citi/gts/alto/accountservice/service/ it needs to be in com/citi/gts/alto/accountservice/service/ which matches the folder structure.

  • Creating and binding a reference to a remote EJB

    We have encountered a problem trying to run our Web Services WAR on a separate server/domain to our back-end EJBs.
    The problem is that we need to bind the remote EJB objects into the Web Services local JNDI tree so that it can access them. We have successfully done so by using a startup class which does a lookup on the remote objects (or simply the sub-context they reside in). This works well, except for one problem. If the EJB server is unavailable when the Web Services server starts, the lookup fails and the Web Services app fails to start.
    To avoid this I would like to bind a Reference rather than the actual remote object. However I have been unable to determine the correct method for doing so. At this time my code appears as follows:
         <pre>String ejbProvdierURL = "t3://qvasdev:7951"
    String ejburl = ejbProviderURL + "/ejb/qvas/User";
    Reference remoteEjbContext = new Reference(
         "interfaces.UserServiceHome",
         new StringRefAddr("URL", ejburl));
    InitialContext context = new InitialContext();
    context.bind("ejb/User", remoteEjbContext);</pre>
    When we try the above, the bind succeeds, however the Web Service app reports the following on startup:
    <pre><Error> <HTTP> <BEA-101216> <Servlet: "WebServiceServlet" failed to preload on startup in Web application: "web-services".
    javax.servlet.ServletException: ERROR: The EJB component named: ejbcomp0 specified a JNDI name: ejb/qvas/User, but this JNDI name does not refer to a stateless session EJB.
    at weblogic.webservice.server.servlet.WebServiceServlet.initLocal(WebServiceServlet.java:132)
    at weblogic.webservice.server.servlet.WebServiceServlet.init(WebServiceServlet.java:86)
    at javax.servlet.GenericServlet.init(GenericServlet.java:258)
    at weblogic.servlet.internal.ServletStubImpl$ServletInitAction.run(ServletStubImpl.java:993)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
    at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.java:869)
    at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImpl.java:848)
    at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:787)
    at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:3252)
    at weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebAppServletContext.java:3197)
    at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:3174)
    at weblogic.servlet.internal.HttpServer.preloadResources(HttpServer.java:688)
    at weblogic.servlet.internal.WebService.preloadResources(WebService.java:483)
    at weblogic.servlet.internal.ServletInitService.resume(ServletInitService.java:30)
    at weblogic.t3.srvr.SubsystemManager.resume(SubsystemManager.java:131)
    at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:964)
    at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:359)
    at weblogic.Server.main(Server.java:32)
    </pre>
    Examining the JNDI tree reveals the "ejb/User", but with the words "Access Denied" against it.
    What am I missing? I have seen examples which bind references to JDBC or JMS related objects, but not simple EJBs.

    Hello,
    I wrote a Spring-based Web Service & deployed in WLS 8.1 SP4. I am also facing the same problem, which is mentioned above. I am not using any EJBs in my code. My webservice is a simple java service class. I am getting the error attached below,
    <Apr 6, 2006 12:43:41 PM EDT> <Error> <HTTP> <BEA-101216> <Servlet: "WebServic
    ervlet" failed to preload on startup in Web application: "WebMDUI".
    javax.servlet.ServletException: WebServiceServlet did not initialized properly
    eblogic.webservice.server.ConfigException: failed to create invocation handler
    at weblogic.webservice.server.servlet.WebServiceServlet.initLocal(WebS
    viceServlet.java:128)
    at weblogic.webservice.server.servlet.WebServiceServlet.init(WebServic
    ervlet.java:86)
    at javax.servlet.GenericServlet.init(GenericServlet.java:258)
    at weblogic.servlet.internal.ServletStubImpl$ServletInitAction.run(Ser
    etStubImpl.java:1028)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authentica
    dSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.jav
    121)
    at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStub
    pl.java:904)
    at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletSt
    Impl.java:883)
    at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStu
    mpl.java:822)
    at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAp
    ervletContext.java:3333)
    at weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebA
    ServletContext.java:3278)
    at weblogic.servlet.internal.WebAppServletContext.preloadResources(Web
    pServletContext.java:3259)
    at weblogic.servlet.internal.WebAppServletContext.setStarted(WebAppSer
    etContext.java:5949)
    at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:862)
    at weblogic.j2ee.J2EEApplicationContainer.start(J2EEApplicationContain
    .java:2127)
    at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationCont
    ner.java:2168)
    at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTas
    activateContainer(SlaveDeployer.java:2503)
    at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.doCommi
    SlaveDeployer.java:2421)
    at weblogic.management.deploy.slave.SlaveDeployer$Task.commit(SlaveDep
    yer.java:2138)
    at weblogic.management.deploy.slave.SlaveDeployer$Task.checkAutoCommit
    laveDeployer.java:2237)
    at weblogic.management.deploy.slave.SlaveDeployer$Task.prepare(SlaveDe
    oyer.java:2132)
    at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare
    laveDeployer.java:2384)
    at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(S
    veDeployer.java:866)
    at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDe
    oyer.java:594)
    at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveD
    loyer.java:508)
    at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackH
    dler.java:25)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
    Caused by: weblogic.webservice.server.ConfigException: failed to create invoca
    on handler
    at weblogic.webservice.server.WebServiceFactory.initComponents(WebServ
    eFactory.java:433)
    at weblogic.webservice.server.WebServiceFactory.createFromMBean(WebSer
    ceFactory.java:195)
    at weblogic.webservice.server.WebServiceFactory.createFromMBean(WebSer
    ceFactory.java:156)
    at weblogic.webservice.server.WebServiceContext.<init>(WebServiceConte
    .java:91)
    at weblogic.webservice.server.servlet.ServletSecurityHelper$1.run(Serv
    tSecurityHelper.java:124)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authentica
    dSubject.java:363)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.jav
    147)
    at weblogic.webservice.server.servlet.ServletSecurityHelper.createWebS
    viceContext(ServletSecurityHelper.java:118)
    at weblogic.webservice.server.servlet.WebServiceServlet.initLocal(WebS
    viceServlet.java:121)
    ... 27 more
    >
    Can you suggest/guide me, what might be the reason?
    Thanks in advance.
    Thanks,
    Ravi Kadoor

  • EJB in Glassfish V2 from a Servlet in SJSWS

    HI, I'm trying to use a EJB deployed in Glassfish from a servlet in the web server. I followed the steps in EJB_Faq of Glassfish site and they work
    perfectly in Tomcat, but when I try it on Sun Web Server 7.0u1 it fails. On the web server log there is an exception when trying to create InitialContext, but I think
    it is because of a warning that the server shows before the error. It doesn't load the javaee.jar file because is "Offending a class", the Servlet class.
    Anyone has tried this, call an EJB in Glassfish from Sun Web Server? It works in Tomcat but the Web Server doesn't load the javaee.jar file and I think this is the reason that the call fails.

    This is the code for the EJB:
    package jpm.business;
    import java.util.List;
    import javax.ejb.Stateless;
    @Stateless(mappedName="ejb/soloEJB")
    public class JavaPlatformManagerBean implements jpm.business.JavaPlatformManagerRemote, jpm.business.JavaPlatformManagerLocal {
    public String getNombre(){
    return "Minchez";
    public String toString(){
    return "Minchez ";
    And this is the part of the servlet that looks for the EJB:
    try{
    java.util.Properties props = new java.util.Properties();
    props.setProperty("java.naming.factory.initial",
    "com.sun.enterprise.naming.SerialInitContextFactory");
    props.setProperty("java.naming.factory.url.pkgs",
    "com.sun.enterprise.naming");
    props.setProperty("java.naming.factory.state",
    "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
    props.setProperty("org.omg.CORBA.ORBInitialHost", "localhost");
    props.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
    out.print("1");
    InitialContext ic = new InitialContext(props);
    out.print("2");
    JavaPlatformManagerRemote jpmr = (JavaPlatformManagerRemote)ic.lookup("ejb/soloEJB");
    out.print("-" + jpmr.getNombre());
    out.print("3");
    } catch(Exception e){ out.println(e.toString()); }
    (I just deleted some comments, but if there is an error, just complete the declarations)
    The EJB's .jar is deployed on Glassfish and the Servlet's .war is deployed on SJSWS or Tomcat. As the FAQs says on Glassfish forum, you have to add some jars to the web server classpath. Copy this jars to a folder named shared/lib on tomcat installation: javaee.jar, appserv-rt.jar, appserv-ext.jar, appserv-deployment-client.jar and jmxremote_optional.jar the last one I don't know if its necessary but I copied also, they are on Glassfish lib directory.
    If you try in tomcat it works fine, the servlet receives the String form the EJB method. But when you try it in SJSWS the javaee.jar file its not loaded, fails on "validateJar(....)" and I think this is the reason the servlet doesn't find de EJB.
    I'm using:
    Glassfish V2
    SJS Web Server 7.0u1
    Tomcat 5.5.17

  • EJB-QL with Date parameter

    Hi All,
    I have used the follwing EJB-QL with java.sql.Date as one of the parameter.
    <query-method>
    <method-name>findByLeaveEmpTypeDateStatus</method-name>
    <method-params>
    <method-param>java.lang.Integer</method-param>
    <method-param>java.lang.Integer</method-param>
    <method-param>java.sql.Date</method-param>
    <method-param>java.lang.String</method-param>
    </method-params>
    </query-method>
    <ejb-ql>
    <![CDATA[select object(o) from LeaveBean o where o.leaveId = ?1
                and o.empTypeId = ?2 and o.createdDate = ?3 and o.status = ?4]]>
    </ejb-ql>
    The server log throws the following exception.
    Test Name : tests.ejb.entity.ejbql.EjbQLFromCmpEntityDescriptor
    Test Assertion : EJB 2.0 Spec Chapter 10 Container managed persistent
    queries should comply with specification in its sytax and semantic rules
    Test Description : Error: [ select object(o) from LeaveBean o where
    o.leaveId = ?1 and o.empTypeId = ?2 and o.createdDate = ?3 and o.status = ?4 ]
    has parsing error(s)
    Exception occured : [Invalid type for expression (o.createdDate  = ?3)
    EJB QL statement : 'select object(o) from LeaveBean o where o.leaveId = ?1
    and o.empTypeId = ?2 and o.createdDate = ?3 and o.status = ?4'
    EJB QL method    : public abstract LeaveLocal LeaveLocalHome.findByLeaveEmpTypeDateStatus
    (java.lang.Integer,java.lang.Integer,java.sql.Date,java.lang.String)
    throws javax.ejb.FinderException
    All the ejb-ql statements with Date as parameter only are throwing the above exception.
    Instead of java.sql.Date, I have tried with Timestamp and Long, but the same exception throws.
    I am using Oracle as my DB.
    The same application with Date as parameter works fine with Weblogic and JBoss.
    --Muthu.

    We are having the same problem: We have timestamps in the database and the ejbql is this:
    SELECT Object(e) FROM EstimateOrder e WHERE e.idDistributor = ?1 and e.ordDateEntered > ?2 and e.ordDateEntered < ?3
    The verifier gives this error:
    Exception occured : [Invalid type for expression (e.ordDateEntered  > ?2)
    Can timestamps be used as input params in ejbql and the used in comparisons?  We tried the "between" also with the same results.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • JPasswordField and MD5 hashes

    I have two methods to make an MD5 String from an entered password in a JPasswordField. Which one is better for security? Can anyone recommend any changes?
    * Create MD5 of password field
    * @param JPasswordField - location of the password
    * @return String - an MD5 hash of the field text
    private String getMD5(javax.swing.JPasswordField field) {
        java.security.MessageDigest md;
        String passwdString = "";
        char[] passwdChars = field.getPassword();
        int i;
        field.setText("");
        // char[] to string and blank out chars
        for (i = 0; i < passwdChars.length; i++) {
            passwdString += passwdChars;
    passwdChars[i] = 0; // blank after for security
    try {
    md = java.security.MessageDigest.getInstance("MD5");
    } catch (java.security.NoSuchAlgorithmException e) {
    return null;
    byte[] passwdMD5 = md.digest(passwdString.getBytes());
    passwdString = "xxxxxxxxxxxxxxxxxxxxxxxxx"; // security
    return dumpBytes(passwdMD5);
    * Create MD5 of password field
    * @param JPasswordField - location of the password
    * @return String - an MD5 hash of the field text
    private String getMD5a(javax.swing.JPasswordField field) {
    java.security.MessageDigest md;
    String MD5;
    try {
    md = java.security.MessageDigest.getInstance("MD5");
    } catch (java.security.NoSuchAlgorithmException e) {
    return null;
    MD5 = dumpBytes(md.digest(new String(field.getPassword()).getBytes()));
    field.setText("");
    return MD5;
    * Byte[] to String conversion
    * @param byte[]
    * @return String
    private static String dumpBytes(byte[] bytes) {
    int i;
    StringBuffer sb = new StringBuffer();
    for (i=0; i<bytes.length; i++) {
    if (i%32 == 0 && i!=0) {
    sb.append("\n");
    String s = Integer.toHexString(bytes[i]);
    if (s.length() < 2) {
    s = "0"+s;
    if (s.length() > 2) {
    s = s.substring(s.length()-2);
    sb.append(s);
    return sb.toString();

    Thanks for the replies.
    Unfortunately I can't get the charsToBytes function to work. For example, if you run the following code you can see that it doesn't seem to give me the correct md5 (if you to to http://pajhome.org.uk/crypt/md5/ and calculate the MD5 for 'test' you will see that function getMD5a works but not getMD5b):
    public class test {
        public static void main(String args[]) {
            new test();
        public test() {
            char[] chars = {'t','e','s','t'};
            System.out.println("Method a: "+getMD5a(chars));
            System.out.println("Method b: "+getMD5b(chars));
        private String getMD5a(char[] passwd) {
            java.security.MessageDigest md;
            String MD5;
            try {
                md = java.security.MessageDigest.getInstance("MD5");
            } catch (java.security.NoSuchAlgorithmException e) {
                return null;
            MD5 = dumpBytes(md.digest(new String(passwd).getBytes()));
            return MD5;
        private String getMD5b(char[] passwd) {
            java.security.MessageDigest md;
            String MD5;
            try {
                md = java.security.MessageDigest.getInstance("MD5");
            } catch (java.security.NoSuchAlgorithmException e) {
                return null;
            MD5 = dumpBytes(md.digest(charsToBytes(passwd)));
            return MD5;
        public static byte[] charsToBytes(char[] chars) {
            byte[] bytes = new byte[chars.length*2];
            int b,c;
            for (b = 0, c = 0; c < chars.length; c++, b+=2) {
                bytes[b] = (byte)((chars[c] >> 8) & 0xFF);
                bytes[b+1] = (byte)(chars[c] & 0xFF);
            return bytes;
        public static String dumpBytes(byte[] bytes) {
            int i;
            StringBuffer sb = new StringBuffer();
            for (i=0; i<bytes.length; i++) {
                if (i%32 == 0 && i!=0) {
                    sb.append("\n");
                String s = Integer.toHexString(bytes);
    if (s.length() < 2) {
    s = "0"+s;
    if (s.length() > 2) {
    s = s.substring(s.length()-2);
    sb.append(s);
    return sb.toString();

  • EJB QL (deployment error)

    I'm trying to deploy an application containing 2.0 style CMPs to OC4J 9.0.3...
    One of the CMP beans has a EJB-QL finder method. I packaged the application using Ant and tried deploying it to OC4J.
    From ejb-jar.xml:
    <query>
    <query-method>
    <method-name>findByCompany</method-name>
    <method-params>
    <method-param>long</method-param>
    </method-params>
    </query-method>
    <ejb-ql><![CDATA[SELECT OBJECT(a) FROM Address AS a WHERE a.coNum = $1]]></ejb-ql>
    </query>
    Deploy Error:
    Encountered "a . coNum = $1" at line 1, column 7.
    Was expecting one of:
    "NOT" ...
    "IdentificationVar" "." "CmpField" "NOT" ...
    "IdentificationVar" "." "CmpField" "IN" ...
    "IdentificationVar" "." "CmpField" "LIKE" ...
    "IdentificationVar" "." "CmpField" "IS" ...
    "+" ...
    "IdentificationVar" "." "CmpField" "*" ...
    "IdentificationVar" "." "CmpField" "/" ...
    "IdentificationVar" "." "CmpField" "+" ...
    "IdentificationVar" "." "CmpField" "-" ...
    "IdentificationVar" "." "CmpField" "BETWEEN" ...
    "IdentificationVar" "." "SingleValuedCmrField" ...
    "IdentificationVar" "." "CollectionValuedCmrField" ...
    "IdentificationVar" "NOT" ...
    "IdentificationVar" "MEMBER" ...
    "IdentificationVar" "." "CmpField" "=" "+" ...
    "IdentificationVar" "." "CmpField" "=" "-" ...
    "IdentificationVar" "." "CmpField" "=" "IdentificationVar" ...
    "IdentificationVar" "." "CmpField" "=" <CHAR_LITERAL> ...
    "IdentificationVar" "." "CmpField" "=" <STRING_LITERAL> ...
    "IdentificationVar" "." "CmpField" "=" <INPUT_PARAM> ...
    "IdentificationVar" "." "CmpField" "=" <INTEGER_LITERAL> ...
    "IdentificationVar" "." "CmpField" "=" <FP_LITERAL> ...
    "IdentificationVar" "." "CmpField" "=" "TRUE" ...
    "IdentificationVar" "." "CmpField" "=" "FALSE" ...
    "IdentificationVar" "." "CmpField" "=" "CONCAT" ...
    "IdentificationVar" "." "CmpField" "=" "SUBSTRING" ...
    "IdentificationVar" "." "CmpField" "=" "LOCATE" ...
    "IdentificationVar" "." "CmpField" "=" "LENGTH" ...
    "IdentificationVar" "." "CmpField" "=" "ABS" ...
    "IdentificationVar" "." "CmpField" "=" "SQRT" ...
    "IdentificationVar" "." "CmpField" "=" "(" ...
    EJB QL statement : 'SELECT OBJECT(a) FROM Address AS a WHERE a.coNum = $1'
    EJB QL method : public abstract java.util.Collection com.insuresuite.company.ejb.AddressEBHome.findByCompany(long) throws javax.ejb.FinderException
    com.sun.ejb.ejbql.EjbQLQuery com.sun.ejb.ejbql.parser.EjbQLParser.parse(com.sun.ejb.ejbql.SymbolTable, com.sun.enterprise.deployment.PersistenceDescriptor, java.lang.reflect.Method, java.lang.String)
    com.sun.ejb.ejbql.EjbQLQuery com.sun.ejb.ejbql.EjbQLDriver.parse(com.sun.enterprise.deployment.PersistenceDescriptor, java.lang.reflect.Method, java.lang.String)
    void com.sun.ejb.sqlgen.SQLGenerator.generateSQLForEjbQLQueries(com.sun.enterprise.deployment.PersistenceDescriptor, com.sun.ejb.ejbql.EjbQLDriver)
    void com.sun.ejb.sqlgen.SQLGenerator.generateSQL(com.sun.enterprise.deployment.EjbBundleDescriptor, com.sun.enterprise.deployment.ResourceReferenceDescriptor, boolean, com.sun.ejb.sqlgen.DBInfo)
    void com.evermind.server.ejb.deployment.EJBPackage.init(byte[], int, int, boolean)
    void com.evermind.server.ServerComponent.init()
    com.evermind.server.ejb.deployment.EJBPackage com.evermind.server.ejb.EJBPackageDeployment.getPackage()
    java.util.Map com.evermind.server.administration.ServerApplicationInstallation.finish(java.util.Map)
    java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[])
    void com.evermind.server.rmi.RMICallHandler.run(java.lang.Thread)
    void com.evermind.util.ThreadPoolThread.run()
    Any help is greatly appreciated.
    - Ranga

    * I modified the query a bit and was able to deploy the application.
    * This is what I have now:
    <![CDATA[SELECT OBJECT(a) FROM Address AS a WHERE a.coNum IS NULL]]>
    * It somehow doesn't like the $1 notation.
    * Are there any workarounds for this?

Maybe you are looking for

  • Is there a way to change the output type for Email Remittance Program?

    Hello, We are trying to implement Separate Remittance Program.The seeded output type is PDF( I have checked the output type for send separate remittance concurrent program) however the email which we receive looks like a regular email I mean with a n

  • New to Mac, Need direction on how to Learn OSX

    I am a lifelong pc user, purchased a new iMac 24 a few weeks ago, opened it up Sunday for the first time, and it looked great. Problem is, as easy as the commercials and everyone says Mac's are, coming from a PC has proven to humble me. I am clueless

  • The Infromation on the web shifts to my right .

    When I open my Mozilla Firefox my search bars shift to the right of my screen. Also all my infromation is to large to fit my screen the complete rigt side is inable to be seen. I've tried to reinstall it and it continues to do the same thing .

  • Windows 7: After re-installing and removing, FireFox won't work

    Hello, I have recently been having problems getting FireFox to work. It was working perfectly fine yesterday, and now today it's not. I have been getting errors: "The procedure entry point SAMCLI.NetUserGetInfo could not be located in the dynamic lin

  • VF02 flag icon creation?

    Hi Friends,                Can someone provide me the USER EXIT and perhaps the EVENT(s) to add a button to the VF02 screen and respond in the USER-COMMAND module to this Buttons FCode. I mean, i want to add the flagicon(Release/accounting) in my own