On running a stand alone client there is no output
Hello,
I am using j2sdk1.4 and j2sdkee RI 1.3. I have tried to develop the EJB code which is provided in Head First EJB in the first chapter. Everything happened accordingly till deployment. When I tried to run the client I received an exception.
For your reference I am posting the classes and the output below:
This is the Remote Interface:
package headfirst;
import javax.ejb.*;
import java.rmi.RemoteException;
public interface Advice extends EJBObject
public String getAdvice()throws RemoteException;
This is the session bean:
package headfirst;
import javax.ejb.*;
public class AdviceBean implements SessionBean
private String[] adviceStrings = {"One word: inappropriate",
"You might want to rethink that haircut",
"You boss will respect you if you tell him what you really think of him",
"Visualize yourself with better clothes",
"Of course you dont have to go to work today",
"Do you really think you should be leaving the house like that",
"Read a book once a year, whether you need it or not."};
public void ejbActivate(){
public void ejbPassivate(){
public void ejbRemove(){
System.out.println("ejb remove");
public void setSessionContext(SessionContext ctx){
System.out.println("session context");
public String getAdvice(){
System.out.println("In get advice");
int random = (int)(Math.random() * adviceStrings.length);
System.out.println("In getAdvice method.....in the AdviceBean ");
return adviceStrings[random];
public void ejbCreate(){
System.out.println("ejb create");
This is the home interface:
package headfirst;
import javax.ejb.*;
import java.rmi.RemoteException;
public interface AdviceHome extends EJBHome
public Advice create()throws CreateException, RemoteException;
and this is the client code:
import javax.naming.*;
import java.rmi.*;
import javax.rmi.*;
import javax.ejb.*;
import headfirst.*;
public class AdviceClient
public static void main(String[] args)
new AdviceClient().go();
public void go(){
try{
Context ic = new InitialContext();
System.out.println("******************************");
Object o = ic.lookup("Advisor");
System.out.println("object is " + o);
AdviceHome home = (AdviceHome)PortableRemoteObject.narrow(o, AdviceHome.class);
Advice advisor = home.create();
System.out.println(advisor.getAdvice());
}catch(Exception e){
e.getMessage();
//e.printStackTrace();
This is the output which I receive when run the client:
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/corba/se/inte
rnal/util/JDKBridge
at com.sun.corba.ee.internal.core.IOR$LocalCodeBaseSingletonHolder.<clin
it>(IOR.java:90)
at com.sun.corba.ee.internal.core.IOR.<init>(IOR.java:238)
at com.sun.corba.ee.internal.iiop.messages.LocateReplyMessage_1_2.read(L
ocateReplyMessage_1_2.java:137)
at com.sun.corba.ee.internal.iiop.IIOPInputStream.unmarshalHeader(IIOPIn
putStream.java:126)
at com.sun.corba.ee.internal.iiop.IIOPConnection.getResponse(IIOPConnect
ion.java:671)
at com.sun.corba.ee.internal.iiop.IIOPConnection.send(IIOPConnection.jav
a:778)
at com.sun.corba.ee.internal.corba.InitialNamingClient.locateObject(Init
ialNamingClient.java:786)
at com.sun.corba.ee.internal.corba.InitialNamingClient.getIORUsingHostIn
fo(InitialNamingClient.java:597)
at com.sun.corba.ee.internal.corba.InitialNamingClient.resolveCorbaloc(I
nitialNamingClient.java:573)
at com.sun.corba.ee.internal.corba.InitialNamingClient.resolveUsingORBIn
itRef(InitialNamingClient.java:544)
at com.sun.corba.ee.internal.corba.InitialNamingClient.cachedInitialRefe
rences(InitialNamingClient.java:1080)
at com.sun.corba.ee.internal.corba.InitialNamingClient.resolve_initial_r
eferences(InitialNamingClient.java:981)
at com.sun.corba.ee.internal.corba.ORB.resolve_initial_references(ORB.ja
va:2425)
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.jav
a:52)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:120
at javax.naming.InitialContext.lookup(Unknown Source)
at AdviceClient.go(AdviceClient.java:19)
at AdviceClient.main(AdviceClient.java:11)
I have mentioned Advisor as the JNDI name for the Bean "AdviceBean" in the RI tool.
Please help me as how to fix this error:
Thanks for pointing me in the right direction. I'm still having lots of trouble with this though. I modified the CartApp to take in the lookup URL as an arguement. I found different documentation online about this but I can't seem to make total sense of it. I am REALLY confused about what exaclty my lookup URL should be and if the command I'm using to run the application is correct. I am also wondering if I am supposed to configure anything on server so that the corba thing will work.
Here is my latest try and the error that I'm getting. I really appreciate any help.
C:\client>java -Dorg.omg.CORBA.ORBInitialHost=localhost -Dorg.omg.CORBA.ORBIniti
alPort=3700 -classpath .;./CartAppClient.jar;./j2ee.jar;./appserv-rt.jar; CartCl
ient corbaname:iiop:localhost:3700#SimpleCart
CartClient running...
initial.lookup String: corbaname:iiop:localhost:3700#SimpleCart
Caught an unexpected exception!
javax.naming.NameNotFoundException [Root exception is org.omg.CosNaming.NamingCo
ntextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]
at com.sun.jndi.cosnaming.ExceptionMapper.mapException(ExceptionMapper.j
ava:44)
at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:453)
at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:492)
at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.j
ava:185)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at CartClient.main(CartClient.java:66)
Caused by: org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNamin
g/NamingContext/NotFound:1.0
at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHe
lper.java:72)
at org.omg.CosNaming._NamingContextStub.resolve(_NamingContextStub.java:
251)
at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:440)
... 4 more
Similar Messages
-
How to access my application on a SunOne 8.0.0_01 from a stand-alone client
Hello,
perhaps someone of you knows how can solve my problem accessing my J2EE-Application with EJBs, etc. from a stand-alone client.
In the classpath of my client the appserv-rt.jar and j2ee.jar are accessible. In the sourcecode I tried to access the server with:
Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
env.put(Context.PROVIDER_URL, "iiop://myserver:3700");
Context initialContext = new InitialContext(env);
Object objRef = initialContext.lookup("MySessionBean");With these setting I get this exception:
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.RemoteException
at com.sun.corba.se.internal.iiop.ShutdownUtilDelegate.mapSystemException(ShutdownUtilDelegate.java:64)
at javax.rmi.CORBA.Util.mapSystemException(Util.java:65)
at de.fhhn.ectsmodulclient.interfaces._ECTSModulSession_Stub.getStudiengaenge(Unknown Source)
at de.hshn.ectsmodulclient.web.StandAloneClient.showStudiengaenge(StandAloneClient.java:68)
at de.hshn.ectsmodulclient.web.StandAloneClient.main(StandAloneClient.java:90)
Caused by: java.rmi.RemoteException
at com.sun.enterprise.iiop.POAProtocolMgr.mapException(POAProtocolMgr.java:213)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:797)
at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:137)
at $Proxy36.getStudiengaenge(Unknown Source)Can anybody tell me what the problem is and probably how I can make it work?
Are there some "hidden" configuration-parameters on the serverside that I have to set/change?
Thank you for your help!
Greetings
Gregor EwaldDid your stand-alone client on the remote machine encounter the same error as your tomcat attempt? Try looking in the tomcat log for a more detailed stack trace.
I'm able to do this from tomcat 5.0 on a remote machine with JDK 1.5 and the latest version of the J2EE 1.4 SDK release (AS 8.2) for an appserver running on linux or solaris. You might want to try with those versions as well.
--ken -
Problems in accessing EJB from stand-alone client
Hi,
I am trying to access a EJB deployed in RI from a stand-alone client. When I run it, I got this exception:
Exception in thread "main" java.rmi.AccessException: CORBA NO_PERMISSION 9998 Ma
ybe; nested exception is:
org.omg.CORBA.NO_PERMISSION: minor code: 9998 completed: Maybe
org.omg.CORBA.NO_PERMISSION: minor code: 9998 completed: Maybe
at java.lang.Class.newInstance0(Native Method)
at java.lang.Class.newInstance(Unknown Source)
at com.sun.corba.ee.internal.iiop.messages.ReplyMessage_1_2.getSystemExc
eption(ReplyMessage_1_2.java:93)
at com.sun.corba.ee.internal.iiop.ClientResponseImpl.getSystemException(
ClientResponseImpl.java:108)
at com.sun.corba.ee.internal.POA.GenericPOAClientSC.invoke(GenericPOACli
entSC.java:136)
at org.omg.CORBA.portable.ObjectImpl._invoke(Unknown Source)
at TheBeanRemoteStub.test(Unknown Source)
at Client.main(Client.java:19)
The following is the code of the client:
System.setProperty(Context.SECURITY_PRINCIPAL, "achong");
System.setProperty(Context.SECURITY_CREDENTIALS, "achong");
Context context = new InitialContext(System.getProperties());
Object object = PortableRemoteObject.narrow(context.lookup("MyBean"), TheBeanHome.class);
TheBeanHome home = (TheBeanHome) object;
I have set "support client choice" while deploying the bean, and set which roles can access which methods. Any idea? Is my code is incorrect?I have the same problem like you.
If you solve it, please give me a hint.
Thank you very much!
[email protected] -
Security exception while trying to access EJB from stand alone client
Hi!, I am trying a sample EJB application to R&D some security related issues. I want to access EJB through a web application as well as a stand-alone client. I have set approriate <method-permission> in EJB deployment descriptor. I am using users.properties/roles.properties file for authentication mechanism. I am using JBoss 3.2.
- On the web application side I am using BASIC authentication and the servlet is able to access the EJB OK, as long as I am using a login/password that has access to the EJB.
- Now I am trying to access the EJB using a stand alone Java class. These are the things I have tried till now:
=>Created a InitialContext with appropriate principal, credentials and tried getting a reference to EJB home interface. That resulted in security exception.
=>Logged into a LoginContext by using appropriate JBossSX classes and then tried getting a EJB home interface. Again security exception.
Now I am not sure what to do. I read at some places about client side container but not sure what that is. Does anyone has any ideas to try? Is there any other way I can make a swing application and a web application authenticate to EJB container?
Also can anyone point me to any documentation that gives some idea about how the security credentials gets propagated from web application/standalone client to EJB container?It would be better if you can post your code...and DD that way we can help you better
-
Stand alone client for remote EJB corba error
Regarding problem below, I've checked System env variables
that weblogic server is using for CORBA classes:
javax.rmi.CORBA.UtilClass=weblogic.iiop.UtilDelegateImpl
org.omg.CORBA.ORBSingletonClass=weblogic.corba.orb.ORB
org.omg.CORBA.ORBClass weblogic.corba.orb.ORB
javax.rmi.CORBA.PortableRemoteObjectClass=weblogic.iiop.PortableRemoteObjectDelegateImpl
But these are server classes and not found in wlclient.jar and wljmsclient.jar. What classes should be used for client? What needs to be set in order to get successful remote RMI/EJB call to weblogic server?
Original post:
I have a stand alone spring client for simple stateless session EJB deployed on weblogic 9.2. I'm using spring (jdk 1.5) to call this remote EJB and the only way I can succeed is to have full weblogic.jar in my bootstrap classpath. Otherwise I get corba error:
CORBA BAD_PARAM 0 No; nested exception is:
org.omg.CORBA.BAD_PARAM: vmcid: 0x0 minor code: 0 completed: No
Interestingly, within same client I have JMS call to weblogic JMS and that fails if weblogic.jar is in boot classpath. Getting rid of weblogic.jar from boot classpath works if I have wlclient.jar and wljmsclient.jar in regular classpath (as per weblogic docs). I would think that for stand alone client all I would need is to weblogic client jars, why should I need to have full weblogic.jar?
I can't get those work together with same classpath. I wonder if anybody has some pointers and/or advice. I was looking to set system parameters for corba for weblogic client that maybe could help:
org.omg.CORBA.ORBClass
org.omg.CORBA.ORBSingletonClass
javax.rmi.CORBA.UtilClass
javax.rmi.CORBA.StubClass
javax.rmi.CORBA.PortableRemoteObjectClass
But I can't find definitive answer.
Regards,
-pp
Edited by mr.papini at 06/28/2007 9:05 AMI'm stuck exactly with the same issue while trying to port my application from weblogic to jboss.
I tried to specify different ORB implementations (JacORB, OpenORB) for jvm option org.omg.CORBA.ORBClass, but JBoss couldn't get them instantiated. Native Sun implementation which is used in JBoss by default and can be instantiated, apparently is not fully compatible with weblogic security module.
So did you manage to find out the solution?
Edited by DigitalDude at 04/09/2008 11:47 PM -
When running a "stand-alone" APP..how do I send midi from Logic?
Hi all,
When running a "stand-alone" APP..how do I send midi from Logic?.....Please no IAC stuff it doesn't work.......thanx
SvKusing IAC here no problems. works very well.
you can host your au's in another app such as soundflower or au lab, but you are still going to need to get it to hear midi. you can use physical midi ports with something like a MTP midi interface, and getting the midi by routing the out of one port to the in of another (midi loop) but you have to be careful logic doesn't listen to the same midi signal or everything will jam up (midi feedback). -
Stand-Alone Client to Access JMS Resource without ACC
I'am having trouble to run the JMS SimpleProducer example from the JMS tutorial as a Stand-Alone application.
Although its works as suggested when run inside an ACC. (The tutorial I refer to: http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JMS5.html#wp79822 )
The JMS provider I use is Sun Java System Application Server Platform Edition 8.2 (build b06-fcs).
Its documentation states that one could run a client outside the ACC and still access JMS:
http://docs.sun.com/source/819-0217-10/dgacc.html#wp1022252
Following those instructions throws an exeption when invoking
Context jndiContext = new InitialContext();
jndiContext.lookup("jms/ConnectionFactory");Of course I did add the three required libraries (appserv-rt.jar, j2ee.jar, imqjmsra.jar) and added the VM arguments to point the client's orb to the JSAS. Also, the JMS administed object exist, admin console shows them and example in ACC worked fine.
The last step of the tutorial says: "� As long as the client environment is set appropriately and the JVM is compatible, you merely need to run the main class." Is there anything I miss? Btw. I run the example on Mac OS X 10.4.6 and Java 1.5.0_06.
Why does the exception refer to org/netbeans/modules/schema2beans/BaseBeanThat is the exception thrown:
Destination name is jms/Queue
04.04.2006 16:25:12 com.sun.corba.ee.spi.logging.LogWrapperBase doLog
INFO: "IOP00710299: (INTERNAL) Successfully created IIOP listener on the specified host/port: all interfaces/49648"
Exception in thread "main" java.lang.NoClassDefFoundError: org/netbeans/modules/schema2beans/BaseBean
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at com.sun.enterprise.connectors.ConnectorAdminServicesFactory.getService(ConnectorAdminServicesFactory.java:35)
at com.sun.enterprise.connectors.ConnectorRuntime.createServices(ConnectorRuntime.java:109)
at com.sun.enterprise.connectors.ConnectorRuntime.getRuntime(ConnectorRuntime.java:71)
at com.sun.enterprise.naming.factory.ConnectorObjectFactory.getObjectInstance(ConnectorObjectFactory.java:55)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:293)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at SimpleProducer.main(SimpleProducer.java:66)
Java Result: 1Adding a fourth jar from the JSAS to the standalone application resolves the problem: appserv-admin.jar - available at install_dir/lib/appserv-admin.jar
Does the tutorial miss this or is there anything I missunderstood? -
Server side script not running on stand-alone XE
Hello,
In my application I created a Server side script (AJAX) which presents a select-list based on other fields on the page. The very same application runs on a 10g+APEX3.0.1 database AND on a standard XE+APEX2.1 database, which are both accessed via a HTTP-server. The application with the script runs fine on this platform (XP).
I have two other XP-machines on which I also installed XE+APEX2.1. Both are stand-alone versions NOT accessed via a HTTP-server. I installed exactly the same application which runs on the platform with HTTP server on both of the machines. While testing the correct functioning, I noticed that everything works ok, EXCEPT the server side script which gives me a better select list. Instead of this I get the old-fashioned version of the select-list which is not able to use the value elsewhere on the page.
I found a similar problem on the XE forum (Re: Server side scripts features ) but it doesn't answer my question how to get the script working on a standalone version of XE (= without access via a HTTP-server).
Can anybody please help me?
Thanks & regards,
Jan.
Message was edited by: Jan
J. HulsingCarl,
Thanks for your suggestion to install FireFox and the Firebug tool (which I wasn't aware of).
After having looked at the problem for hours, I found what I think is the problem: the htmldb_html_elements.js script.
As already mentioned, the properly functioning XE on my local PC is accessed via a HTTP-server, as well as the 10gR2+APEX3.0.1 version also running on that PC.
On the laptop, not running HTTP-server, I get the message: <br>
<FONT COLOR="RED">$x is not defined <BR>
<FONT COLOR="BLUE"> f_21_select_kpn<FONT COLOR="RED">(<FONT COLOR="BLUE">input<FONT COLOR="BLACK">#P21_GBREKNR 405<FONT COLOR="RED">, "P21_KOSTENPOST") <BR>
<FONT COLOR="BLUE">onblur<FONT COLOR="RED">(<FONT COLOR="BLACK">blur <FONT COLOR="RED">)
</FONT><BR>
That is in the 'Console' of Firebug.
When changing to Script I do see a remarkable difference.
On the PC there the following text is found in the first lines of htmldb_html_elements.js:
/*htmld_elements will contain the lower level html access js*/<br>
var gDebug = true;<br>
var gkeyPressTime;<br>
var gLastTab=false;<br>
var gRegex=false;<br>
var ie=(document.all)?true:false;<br>
if(ie){document.expando=true;}<br>
var gDebugWindow = false;<br>
/*<br>
$x functions have to do with either single elements or array of elements<br>
$v functions have to have to do with manipulating values or interaction based off a value<br>
$xml function have to do with manipulating xml values<br>
$a functions are based on ajax<br>
$d functions are specific dhtml constructs<br>
*/<br>
/* begin $x functions */<br>
function $x(pNd){<br>
try{<br>
var node;<br>
...<br><br>
On the laptop however the first few lines are:<br><br>
/*htmld_elements will contain the lower level html access js*/<br>
<br>
var gDebug = true;<br>
var gkeyPressTime;<br>
var gLastTab=false;<br>
var gRegex=false;<br>
if(document.all){document.expando = true;}<br>
// Elements //<br>
<br>
function html_GetElement(pNd){<br>
try{<br>
var node;<br>
switch(typeof (pNd)){<br>
...<br><br>
I think that the difference is in these two scripts.
But why are the scripts different: it is the same XE that is installed on the laptop and the PC.<br>The answer I found in the images/javascript directory of APEX3.0.1 which is located in the APACHE directory-tree (you have to copy the images to APACHE when you use the HTTP-server). And indeed: the htmldb_html_elements.js has exactly the same text as what I see in Firebug on the PC. So XE on the PC is using the javascripts in the image-directory of APACHE on the PC and not the XE-version of the scripts, embedded in XE.
<br><br>
So the answer seems to be: copy the APEX3.0.1 versions of the script over to the PC and try to get them into the database. Or...???
<br>
Can it be loaded into the database? Will XE accept it?
<BR><br>
Would be nice to have answers if the conclusion I found is the right one and if it can be fixed by loading the js into XE.
<br>
Best regards and thanks for your help so far.
<br>
Jan. -
Web Services - Issue with running OC4J stand alone server from JDeveloper
I created a stand alone OC4J App. server instance in JDeveloper. I deployed my Webservice (WebServices.deploy) to that OC4J server.
Now I want to test my web service. I opened a browser window and I specfied the URL as
http://localhost:<RMI Port#>/<Project1>-context-root/<Webservice name>.
Default RMI Port#23791.
http://localhost:23791/<Project1>-context-root/<Webservice name>.
and I am getting the following error message
ã vInvalid protocol verification, illegal ORMI request or request performed with an incompatible version of this protocolvInvalid protocol verification, illegal ORMI request or request performed with an incompatible version of this protocol.
Could you please let me know, what's going on.
Thanks!OK, so there's two threads in this email.
1. When using a Web browser client and an OC4J standalone instance, the default address of the OC4J website is http://host:8888/.
The port you keep referring to is the ORMI port. That is a different protocol that is used with EJBs, and our remote deployment mechanism. As you have observed, JDeveloper uses it to deploy to the OC4J instance.
2. The root problem you are seeing is related to the message you posted on the console.
OC4J 10g (10.1.3) Default Web Site. Application: bc4j does not exist. Error creating Web application: webapp
Because this web app is misconfigured, its not starting so you can't access it.
In the j2ee/home/config/default-web-site.xml file, there is a reference to an application called BC4J -- which is not available on the server as a deployed application.
So you need to correct that situation -- BC4J is not normally present in a vanilla OC4J standalone distribution.
You can try editing the j2ee/home/config/default-web-site.xml file and remove the <web-app> entry that mentions BC4J and then try starting OC4J.
If you don't have a lot of time invested in configuring the instance, you could also try extracting oc4j_extended.zip again and starting with a fresh one.
cheers
-steve- -
Stand-alone client - lookup problem
I have a stand-alone Java client application (ContactClient) that I want to use to access an EJB called Contact. I am using J2EE, deploying with deploytool. The EJB has a JNDI name of "MyContact", and the Client reference is "ejb/TheContact". The relevant code in the app is:
try
java.util.Properties props = new java.util.Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.cosnaming.CNCtxFactory");
props.put(Context.PROVIDER_URL, "iiop://localhost:1050");
Context initial = new InitialContext(props);
Object objref = initial.lookup("ejb/TheContact");
ContactHome home =
(ContactHome)PortableRemoteObject.narrow(objref,
ContactHome.class);
contact = home.create();
catch (Exception ex)
System.err.println("Exception: " + ex.getMessage());
ex.printStackTrace();
The following exception is thrown by initial.lookup("ejb/TheContact");
javax.naming.NameNotFoundException. Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
I have tried changing the name to "TheContact", and to "java:comp/env/TheContact" with no success. If I change it to the JNDI name "MyContact", the lookup works, but the following call, PortableRemoteObject.narrow(), throws a java.lang.ClassCastException.
What am I doing wrong?
JohnHi, Thanks for your fast reply, but it still doesn't work.
With your Code I get a classCastException in this line:
"SessionHome home = (SessionHome)ctx.lookup("SessionBeanInstance");"
Here is the code from the whole thing, as it works with the appclient script:
SessionHome: //RemoteHomeInterface
package ejb;
import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.EJBHome;
public interface SessionHome extends EJBHome {
Session create() throws RemoteException, CreateException;
Session //Session RemoteInterface
package ejb;
import javax.ejb.EJBObject;
import java.rmi.RemoteException;
public interface Session extends EJBObject {
public String getString() throws RemoteException;
SessionBeanInstance //The SessionBean
package ejb;
import javax.ejb.SessionBean;
import javax.ejb.CreateException;
import javax.ejb.SessionContext;
public class SessionBeanInstance implements SessionBean{
public SessionContext context;
public String getString(){ return "works"; }
public SessionBeanInstance() { }
public void ejbCreate() throws CreateException { System.out.println("Bean created"); }
public void ejbActivate() { }
public void ejbPassivate() { }
public void ejbRemove() { }
public void setSessionContext(SessionContext ctx) { context = ctx; }
clientMain //The client class
package client;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.naming.NamingEnumeration;
import javax.rmi.PortableRemoteObject;
import ejb.*;
import java.util.Hashtable;
public class clientMain {
private SessionHome home;
private Session mySession;
private Context ctx;
private Object objref;
public clientMain() {
try{
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
env.put(Context.PROVIDER_URL, "iiop://127.0.0.1:3700");
try{
Context ctx = new InitialContext(env);
SessionHome home = (SessionHome)ctx.lookup("SessionBeanInstance");
Session remote = (Session)home.create();
String test = remote.getString();
System.out.println(test);
catch(Exception e){ e.printStackTrace(); }
catch (Exception ex) {
System.err.println("Caught an exception.");
ex.printStackTrace();
The error occurs only if is start with the "java -jar" script. Here is the error:
lang.ClassCastException: com.sun.corba.se.impl.corba.CORBAObjectImpl
at client.clientMain.<init>(clientMain.java:27)
at client.Client.main(Client.java:10)
I don't know what to do, to get it work... -
EJB 3.0 stand alone client programe throws Naming Exception
Hi My application wont work , please take look my small stateless session using EJB 3.0
Business Inteface
==================================
package ejb30;
import javax.ejb.Remote;
@Remote
public interface Sless {
public String hello();
=====================
Bean Class
================
package ejb30;
import javax.ejb.Stateless;
@Stateless
public class SlessBean implements Sless {
public String hello() {
return "hello, world!\n";
================
Comiled the above 2 files and put into "s1.jar" file then deployed into SJS Application Server.
Deployed Sucuess fully
Created Client programs like below file
Client
========
package ejb30;
import javax.naming.InitialContext;
public class client
public static void main(String[] args)
try
InitialContext ctx = new InitialContext();
Sless sless = (Sless) ctx.lookup(Sless.class.getName());
System.out.println(sless.hello());
catch(Exception ex)
ex.printStackTrace();
===============
when i am going the programe from console it throws the followin exception
===============
C:\Sun\AppServer\jdk\bin>java ejb30.client
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
at javax.naming.InitialContext.getDefaultInitCtx InitialContext.java:247
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:284)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at ejb30.client.main(client.java:13)
=============
please help me on this if any knows.........
Waiting for you great response
urs balasubramanyamappserv-rt.jar already contains a jndi.properties file, and users don't need to worry about anything about jndi.properties file. For your sample app, it should work when you have appserv-rt.jar and javaee.jar in classpath.
If you still have failures, pls post your complete command you used to run client. -
Error acccess secure sight from a stand alone client using mutual Auth
Dear Forum,
Please help me in fixing the error.
Here is what I am doing
I created my system cert using key tool and placed it in cacerts. Sent the CSR to the CA. Got the *.ser from CA. Imported the *.ser into cacerts truststore.
Now created a standalone (not on the webserver) HTTP program to run on command line. I get the following error while issuing a greeting/login.
Please help!
==================================================
29392 [main] DEBUG org.apache.commons.httpclient.HttpClient - Operating system name: Windows XP
29392 [main] DEBUG org.apache.commons.httpclient.HttpClient - Operating system architecture: x86
29392 [main] DEBUG org.apache.commons.httpclient.HttpClient - Operating system version: 5.1
29973 [main] DEBUG org.apache.commons.httpclient.HttpClient - SUN 1.42: SUN (DSA key/parameter generation; DSA signing; SHA-1, MD5 digests; SecureRandom; X.509 certificates; JKS keystore; PKIX CertPathValidator; PKIX CertPathBuilder; LDAP, Collection CertStores)
29973 [main] DEBUG org.apache.commons.httpclient.HttpClient - SunJSSE 1.42: Sun JSSE provider(implements RSA Signatures, PKCS12, SunX509 key/trust factories, SSLv3, TLSv1)
29973 [main] DEBUG org.apache.commons.httpclient.HttpClient - SunRsaSign 1.42: SUN's provider for RSA signatures
29973 [main] DEBUG org.apache.commons.httpclient.HttpClient - SunJCE 1.42: SunJCE Provider (implements DES, Triple DES, AES, Blowfish, PBE, Diffie-Hellman, HMAC-MD5, HMAC-SHA1)
29973 [main] DEBUG org.apache.commons.httpclient.HttpClient - SunJGSS 1.0: Sun (Kerberos v5)
55189 [main] INFO com.verisign.epp.interfaces.EPPHttpSession - EPPHttpSession: Initializing EPPSSLImpl and HttpsURLConnection
58063 [main] INFO com.verisign.epp.transport.client.EPPSSLImpl - EPPSSLImpl starting initialization
332067 [main] INFO com.verisign.epp.transport.client.EPPSSLImpl - EPPSSLImpl successfully initialized
381268 [main] DEBUG com.verisign.epp.interfaces.EPPHttpSession - login() enter
382420 [main] DEBUG org.apache.commons.httpclient.methods.GetMethod - enter GetMethod(String)
384903 [main] INFO com.verisign.epp.interfaces.EPPHttpSession - Connecting to server https://epp-ote.verisign-grs.com:700/nsgateway/epp/controller using HTTP GET
411542 [main] DEBUG org.apache.commons.httpclient.HttpClient - enter HttpClient.executeMethod(HttpMethod)
412643 [main] DEBUG org.apache.commons.httpclient.HttpClient - enter HttpClient.executeMethod(HostConfiguration,HttpMethod,HttpState)
412673 [main] DEBUG org.apache.commons.httpclient.HttpConnection - enter HttpConnection.open()
412823 [main] DEBUG org.apache.commons.httpclient.HttpConnection - HttpConnection.setSoTimeout(0)
412823 [main] DEBUG org.apache.commons.httpclient.HttpMethodBase - enter HttpMethodBase.execute(HttpState, HttpConnection)
412833 [main] DEBUG org.apache.commons.httpclient.HttpMethodBase - Execute loop try 1
412833 [main] DEBUG org.apache.commons.httpclient.HttpMethodBase - enter HttpMethodBase.processRequest(HttpState, HttpConnection)
412833 [main] DEBUG org.apache.commons.httpclient.HttpMethodBase - Attempt number 1 to process request
412833 [main] DEBUG org.apache.commons.httpclient.HttpMethodBase - enter HttpMethodBase.writeRequest(HttpState, HttpConnection)
412833 [main] DEBUG org.apache.commons.httpclient.HttpMethodBase - enter HttpMethodBase.writeRequestLine(HttpState, HttpConnection)
412833 [main] DEBUG org.apache.commons.httpclient.HttpMethodBase - enter HttpMethodBase.generateRequestLine(HttpConnection, String, String, String, String)
412843 [main] DEBUG httpclient.wire.header - >> "GET /nsgateway/epp/controller HTTP/1.1[\r][\n]"
412843 [main] DEBUG org.apache.commons.httpclient.HttpConnection - enter HttpConnection.print(String)
412843 [main] DEBUG org.apache.commons.httpclient.HttpConnection - enter HttpConnection.write(byte[])
412843 [main] DEBUG org.apache.commons.httpclient.HttpConnection - enter HttpConnection.write(byte[], int, int)
412843 [main] DEBUG org.apache.commons.httpclient.HttpMethodBase - enter HttpMethodBase.writeRequestHeaders(HttpState,HttpConnection)
412843 [main] DEBUG org.apache.commons.httpclient.HttpMethodBase - enter HttpMethodBase.addRequestHeaders(HttpState, HttpConnection)
412853 [main] DEBUG org.apache.commons.httpclient.HttpMethodBase - enter HttpMethodBase.addUserAgentRequestHeaders(HttpState, HttpConnection)
412853 [main] DEBUG org.apache.commons.httpclient.HttpMethodBase - enter HttpMethodBase.addHostRequestHeader(HttpState, HttpConnection)
412853 [main] DEBUG org.apache.commons.httpclient.HttpMethodBase - Adding Host request header
412853 [main] DEBUG org.apache.commons.httpclient.HttpMethodBase - enter HttpMethodBase.addCookieRequestHeader(HttpState, HttpConnection)
412873 [main] DEBUG org.apache.commons.httpclient.HttpState - enter HttpState.getCookies()
412873 [main] DEBUG org.apache.commons.httpclient.cookie.CookieSpec - enter CookieSpecBase.match(String, int, String, boolean, Cookie[])
412873 [main] DEBUG org.apache.commons.httpclient.HttpMethodBase - enter HttpMethodBase.addAuthorizationRequestHeader(HttpState, HttpConnection)
412873 [main] DEBUG org.apache.commons.httpclient.HttpMethodBase - enter HttpMethodBase.addProxyAuthorizationRequestHeader(HttpState, HttpConnection)
412883 [main] DEBUG org.apache.commons.httpclient.HttpMethodBase - enter HttpMethodBase.addProxyConnectionHeader(HttpState, HttpConnection)
412883 [main] DEBUG org.apache.commons.httpclient.HttpMethodBase - enter HttpMethodBase.addContentLengthRequestHeader(HttpState, HttpConnection)
412883 [main] DEBUG httpclient.wire.header - >> "Connection: Keep-Alive[\r][\n]"
412883 [main] DEBUG org.apache.commons.httpclient.HttpConnection - enter HttpConnection.print(String)
412883 [main] DEBUG org.apache.commons.httpclient.HttpConnection - enter HttpConnection.write(byte[])
412883 [main] DEBUG org.apache.commons.httpclient.HttpConnection - enter HttpConnection.write(byte[], int, int)
412883 [main] DEBUG httpclient.wire.header - >> "User-Agent: Jakarta Commons-HttpClient/2.0.2[\r][\n]"
412883 [main] DEBUG org.apache.commons.httpclient.HttpConnection - enter HttpConnection.print(String)
412883 [main] DEBUG org.apache.commons.httpclient.HttpConnection - enter HttpConnection.write(byte[])
412883 [main] DEBUG org.apache.commons.httpclient.HttpConnection - enter HttpConnection.write(byte[], int, int)
412883 [main] DEBUG httpclient.wire.header - >> "Host: epp-ote.verisign-grs.com:700[\r][\n]"
412883 [main] DEBUG org.apache.commons.httpclient.HttpConnection - enter HttpConnection.print(String)
412883 [main] DEBUG org.apache.commons.httpclient.HttpConnection - enter HttpConnection.write(byte[])
412883 [main] DEBUG org.apache.commons.httpclient.HttpConnection - enter HttpConnection.write(byte[], int, int)
412883 [main] DEBUG org.apache.commons.httpclient.HttpConnection - enter HttpConnection.writeLine()
412883 [main] DEBUG org.apache.commons.httpclient.HttpConnection - enter HttpConnection.write(byte[])
412883 [main] DEBUG org.apache.commons.httpclient.HttpConnection - enter HttpConnection.write(byte[], int, int)
412883 [main] DEBUG org.apache.commons.httpclient.HttpConnection - enter HttpConnection.flushRequestOutputStream()
413244 [main] DEBUG org.apache.commons.httpclient.HttpConnection - enter HttpConnection.close()
413244 [main] DEBUG org.apache.commons.httpclient.HttpConnection - enter HttpConnection.closeSockedAndStreams()
413244 [main] DEBUG org.apache.commons.httpclient.HttpConnection - enter HttpConnection.close()
413244 [main] DEBUG org.apache.commons.httpclient.HttpConnection - enter HttpConnection.closeSockedAndStreams()
413244 [main] DEBUG org.apache.commons.httpclient.HttpConnection - enter HttpConnection.close()
413244 [main] DEBUG org.apache.commons.httpclient.HttpConnection - enter HttpConnection.closeSockedAndStreams()
413244 [main] DEBUG org.apache.commons.httpclient.HttpConnection - enter HttpConnection.releaseConnection()
[b][b]613923 [main] ERROR com.verisign.epp.interfaces.EPPHttpSession - Couldn't execute HTTP GET to server https://epp-ote.verisign-grs.com:700/nsgateway/epp/controller
java.net.SocketException: Software caused connection abort: socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at com.sun.net.ssl.internal.ssl.OutputRecord.a(DashoA12275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
at com.sun.net.ssl.internal.ssl.SunJSSE_ax.a(DashoA12275)
at com.sun.net.ssl.internal.ssl.SunJSSE_az.j(DashoA12275)
at com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA12275)
at com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA12275)
at com.sun.net.ssl.internal.ssl.SunJSSE_ax.a(DashoA12275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.j(DashoA12275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
at com.sun.net.ssl.internal.ssl.AppOutputStream.write(DashoA12275)
at org.apache.commons.httpclient.HttpConnection$WrappedOutputStream.write(HttpConnection.java:1360)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:66)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124)
at org.apache.commons.httpclient.HttpConnection.flushRequestOutputStream(HttpConnection.java:790)
at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2271)
at org.apache.commons.httpclient.HttpMethodBase.processRequest(HttpMethodBase.java:2651)
at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1087)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:643)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:497)
at com.verisign.epp.interfaces.EPPHttpSession.login(EPPHttpSession.java:545)
at com.verisign.epp.interfaces.EPPSession.initSession(EPPSession.java:805)
at EPPHttpClient.initSession(EPPHttpClient.java:156)
at EPPHttpClient.testSession(EPPHttpClient.java:116)
at EPPHttpClient.main(EPPHttpClient.java:291)Thanks for pointing me in the right direction. I'm still having lots of trouble with this though. I modified the CartApp to take in the lookup URL as an arguement. I found different documentation online about this but I can't seem to make total sense of it. I am REALLY confused about what exaclty my lookup URL should be and if the command I'm using to run the application is correct. I am also wondering if I am supposed to configure anything on server so that the corba thing will work.
Here is my latest try and the error that I'm getting. I really appreciate any help.
C:\client>java -Dorg.omg.CORBA.ORBInitialHost=localhost -Dorg.omg.CORBA.ORBIniti
alPort=3700 -classpath .;./CartAppClient.jar;./j2ee.jar;./appserv-rt.jar; CartCl
ient corbaname:iiop:localhost:3700#SimpleCart
CartClient running...
initial.lookup String: corbaname:iiop:localhost:3700#SimpleCart
Caught an unexpected exception!
javax.naming.NameNotFoundException [Root exception is org.omg.CosNaming.NamingCo
ntextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]
at com.sun.jndi.cosnaming.ExceptionMapper.mapException(ExceptionMapper.j
ava:44)
at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:453)
at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:492)
at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.j
ava:185)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at CartClient.main(CartClient.java:66)
Caused by: org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNamin
g/NamingContext/NotFound:1.0
at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHe
lper.java:72)
at org.omg.CosNaming._NamingContextStub.resolve(_NamingContextStub.java:
251)
at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:440)
... 4 more -
JMS stand-alone client consuming a queue in GlassFish cluster
I want to connect to a JMS queue running in clustered glassfish enterprise 2.1 and consume a message. I have a simple client app. that works with my one-machine cluster (pointing it either to first or second node, ports 3330 or 3331), but doesn't work with a company cluster (two machines, two nodes).
Hashtable properties = new Hashtable();
properties.put(Context.PROVIDER_URL, "iiop://" + hostname + ":" + port);
properties.put("org.omg.CORBA.ORBInitialHost", hostname);
properties.put("org.omg.CORBA.ORBInitialPort", "" + port);
properties.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.appserv.naming.S1ASCtxFactory");
try {
ctx = new InitialContext(properties);
} catch (NamingException ex) {
ex.printStackTrace();
}The program fails on line ctx = new InitialContext(properties);
The strange thing is, whatever I use as hostname or port, it always ends like this:
27.5.2009 18:03:17 com.sun.appserv.naming.RoundRobinPolicy setClusterInstanceInfo
WARNING: NAM1005 : No Endpoints selected. Please specify using system property com.sun.appserv.iiop.endpoints.
27.5.2009 18:03:17 com.sun.appserv.naming.RoundRobinPolicy getEndpointForProviderURL
WARNING: NAM1001: No Endpoints selected in com.sun.appserv.iiop.endpoints property. Using JNDI Provider URL iiop://10.0.0.30:33700 instead
27.5.2009 18:03:18 com.sun.appserv.naming.RoundRobinPolicy setClusterInstanceInfo
INFO: endpoint.weight after checking isWeight = 10
27.5.2009 18:03:18 com.sun.appserv.naming.RoundRobinPolicy setClusterInstanceInfo
INFO: sumOfAllWeights = 10
27.5.2009 18:03:19 com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl <init>
WARNING: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: localhost; port: 3700"
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.corba.ee.impl.folb.ClientGroupManager.getInitialClusterInstanceInfo(ClientGroupManager.java:596)
at com.sun.corba.ee.impl.folb.ClientGroupManager$GIS.getClusterInstanceInfo(ClientGroupManager.java:620)
at com.sun.corba.ee.impl.folb.ClientGroupManager.getClusterInstanceInfo(ClientGroupManager.java:666)
at com.sun.appserv.naming.GroupInfoServiceObserverImpl.membershipChange(GroupInfoServiceObserverImpl.java:73)
at com.sun.appserv.naming.S1ASCtxFactory.getInitialContext(S1ASCtxFactory.java:290)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at client.JmsQueueConsumer.<init>(JmsQueueConsumer.java:41)
at client.JmsQueueConsumer.main(JmsQueueConsumer.java:57)
Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused: connect
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:347)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:244)
... 18 more
Caused by: java.net.ConnectException: Connection refused: connect
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)
... 19 moreI've tried to turn off all firewalls between me and the cluster but it still doesn't work. ANy ideas what can be wrong? I guess clusters are always different...
(I will try to do more investigation, especially packet capturing, later)Double check the ORB configuration in the servers...
+"The default naming service port in the app server is 3700. If the naming service is running on a different port, you'll need to set it via the -Dorg.omg.CORBA.ORBInitialPort property when starting the client JVM. You can double-check the actual naming service port for a given server instance by looking in the server instace's domain.xml for "orb-listener-1". Alternatively, check the Applications..Configuration..ORB..IIOP Listeners section of the admin GUI for orb-listener-1."+
[https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#StandaloneRemoteEJB|https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#StandaloneRemoteEJB] (step-5)
Edited by: Conchas on Aug 3, 2009 12:12 PM -
Accessing JMS from stand-alone client
I'm currently attempting to access EJBs, JMS topics and JMS queues from a swing client running on a different machine to the application server (in this case, Sun App Server 9).
I have added the following jars to the classpath: appserv-rt.jar, javaee.jar and imqjmsra.jar, as well as generated EJB stubs. I have specified the two -D options on the command line:
-Dorg.omg.CORBA.ORBInitialHost=<server>
-Dorg.omg.CORBA.ORBInitialPort=3700
I have tried adding my own jndi.properties with:
java.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
java.naming.provider.url=iiop://<server>:3700
I have also tried without including a jndi.properties file and using the one supplied by the appserv-rt.jar (this causes more errors than adding my own).
I am able to lookup an EJB using the global JNDI name and successfully invoke methods on the EJB. If I use the java:comp/env context then I receive the same error as I do with the JMS issues which I'm about to describe.
When I attempt to access the JMS factories, topics and queues using both the java:comp/env and the global JNDI name I receive the following error:
javax.naming.NameNotFoundException [Root exception is org.omg.CosNaming.NamingCo
ntextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]
at com.sun.jndi.cosnaming.ExceptionMapper.mapException(ExceptionMapper.j
ava:44)
at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:453)
at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:492)
at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:470)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
The global JNDI name for the topic factory (for example) is jms/TopicConnectionFactory - I have tried both lookups:
InitialContext context = new InitialContext();
context.lookup("jms/TopicConnectionFactory") //lookup 1
context.lookup("java:comp/env/jms/TopicConnectionFactory") //lookup 2The factory is clearly visible in JNDI under the jms/TopicConnectionFactory when I browse the JNDI from the Sun Admin Console.
I run the application on a separate machine via the standard java.exe -jar myclient.jar (the jar's manifest has the main class and the classpath described above set)
Does anybody see anything that I could be missing to get JMS lookups to work from a thick client. As mentioned I can lookup EJBs with no problems so I am definitely connecting to the app server correctly - I figure I'm missing another jar or something like that.
I have also tried adding application-client.xml and sun-application-client.xml descriptors to myclient.jar/META-INF but that doesn't seem to work either, and when I do I don't think the descriptors are being read because I am unable to lookup the EJB with the java:comp/env JNDI reference - I still need to use the global JNDI name. I would like to use the java:comp/env but I'm not certain how I get the application client jar to load these descriptors, or does something in the appserv-rt.jar do that when it is first accessed (a little unsure of this bit).
My main concern though, even with global JNDI lookups is that the JMS lookups fail and the EJB lookups succeed.
Any help would be greatly appreciated.
I tried again with using the jndi.properties file in the appserv-rt.jar rather than setting anything on the InitialContext. After getting past all of the NoClassDefFound errors by adding more of the app server jars onto the client classpath I managed to get something working, however with the information that was spat out on the client console while performing the lookup I'm pretty certain this isn't exactly what I want - it does work however. My concern is that the messages that are being displayed makes me think I have created my own factory locally (or something weird like that). The messages I received were:
Looking up: jms/TopicConnectionFactory
23/06/2006 16:40:45 com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: SJSMQ JMS Resource Adapter starting...
================================================================================
Sun Java(tm) System Message Queue 4.0
Sun Microsystems, Inc.
Version: 4.0 (Build 27-a)
Compile: Thu Mar 2 22:14:05 PST 2006
Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved.
SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
This product includes code licensed from RSA Data Security.
================================================================================
23/06/2006 16:40:46 com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: SJSMQ JMS ResourceAdaapter configuration=
raUID =null
brokerType =REMOTE
brokerInstanceName =imqbroker
brokerBindAddress =null
brokerPort =7676
brokerHomeDir =/u2/sas9/imq/bin/..
brokerVarDir =/u2/sas9/domains/domain1/imq
brokerJavaDir =/usr/java
brokerArgs =null
brokerStartTimeout =60000
adminUsername =admin
adminPassFile =/var/tmp/asmq40969.tmp
useJNDIRmiServiceURL =true
rmiRegistryPort =8686
startRmiRegistry =false
useSSLJMXConnector =true
brokerEnableHA =false
clusterId =null
brokerId =null
jmxServiceURL =null
dbType =null
dbProps ={}
dsProps ={}
ConnectionURL =mq://<server>:7676/
UserName =guest
ReconnectEnabled =true
ReconnectInterval =5000
ReconnectAttempts =3
AddressListBehavior =RANDOM
AddressListIterations =3
InAppClientContainer =true
InClusteredContainer =false
GroupName =null
23/06/2006 16:40:46 com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: start:SJSMQ JMSRA Connection Factory Config={imqOverrideJM
SPriority=false, imqConsumerFlowLimit=1000, imqOverrideJMSExpiration=false, imqA
ddressListIterations=3, imqLoadMaxToServerSession=true, imqConnectionType=TCP, i
mqPingInterval=30, imqSetJMSXUserID=false, imqConfiguredClientID=, imqSSLProvide
rClassname=com.sun.net.ssl.internal.ssl.Provider, imqJMSDeliveryMode=PERSISTENT,
imqConnectionFlowLimit=1000, imqConnectionURL=http://localhost/imq/tunnel, imqB
rokerServiceName=, imqJMSPriority=4, imqBrokerHostName=localhost, imqJMSExpirati
on=0, imqAckOnProduce=, imqEnableSharedClientID=false, imqAckTimeout=0, imqAckOn
Acknowledge=, imqConsumerFlowThreshold=50, imqDefaultPassword=guest, imqQueueBro
wserMaxMessagesPerRetrieve=1000, imqDefaultUsername=guest, imqReconnectEnabled=f
alse, imqConnectionFlowCount=100, imqAddressListBehavior=RANDOM, imqReconnectAtt
empts=3, imqSetJMSXAppID=false, imqConnectionHandler=com.sun.messaging.jmq.jmscl
ient.protocol.tcp.TCPStreamHandler, imqSetJMSXRcvTimestamp=false, imqBrokerServi
cePort=0, imqDisableSetClientID=false, imqSetJMSXConsumerTXID=false, imqOverride
JMSDeliveryMode=false, imqBrokerHostPort=7676, imqQueueBrowserRetrieveTimeout=60
000, imqSetJMSXProducerTXID=false, imqSSLIsHostTrusted=false, imqConnectionFlowL
imitEnabled=false, imqReconnectInterval=5000, imqAddressList=mq://<server>:7676/, i
mqOverrideJMSHeadersToTemporaryDestinations=false}
23/06/2006 16:40:46 com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: SJSMQ JMSRA Started
23/06/2006 16:40:46 com.sun.messaging.jms.ra.ManagedConnectionFactory setPasswor
d
INFO: MQJMSRA_MF1101: setPassword:NOT setting default value
23/06/2006 16:40:46 com.sun.messaging.jms.ra.ManagedConnectionFactory setAddress
List
INFO: MQJMSRA_MF1101: setAddressList:NOT setting default value=localhost
23/06/2006 16:40:46 com.sun.messaging.jms.ra.ManagedConnectionFactory setUserNam
e
INFO: MQJMSRA_MF1101: setUserName:NOT setting default value=guest
23/06/2006 16:40:46 com.sun.messaging.jms.ra.ManagedConnection <init>
INFO: MQJMSRA_MC1101: constructor:Created mcId=1:xacId=4902744336909087232:Using
xacf config={imqOverrideJMSPriority=false, imqConsumerFlowLimit=1000, imqOverri
deJMSExpiration=false, imqAddressListIterations=3, imqLoadMaxToServerSession=tru
e, imqConnectionType=TCP, imqPingInterval=30, imqSetJMSXUserID=false, imqConfigu
redClientID=, imqSSLProviderClassname=com.sun.net.ssl.internal.ssl.Provider, imq
JMSDeliveryMode=PERSISTENT, imqConnectionFlowLimit=1000, imqConnectionURL=http:/
/localhost/imq/tunnel, imqBrokerServiceName=, imqJMSPriority=4, imqBrokerHostNam
e=localhost, imqJMSExpiration=0, imqAckOnProduce=, imqEnableSharedClientID=false
, imqAckTimeout=0, imqAckOnAcknowledge=, imqConsumerFlowThreshold=50, imqDefault
Password=guest, imqQueueBrowserMaxMessagesPerRetrieve=1000, imqDefaultUsername=g
uest, imqReconnectEnabled=true, imqConnectionFlowCount=100, imqAddressListBehavi
or=RANDOM, imqReconnectAttempts=3, imqSetJMSXAppID=false, imqConnectionHandler=c
om.sun.messaging.jmq.jmsclient.protocol.tcp.TCPStreamHandler, imqSetJMSXRcvTimes
tamp=false, imqBrokerServicePort=0, imqDisableSetClientID=false, imqSetJMSXConsu
merTXID=false, imqOverrideJMSDeliveryMode=false, imqBrokerHostPort=7676, imqQueu
eBrowserRetrieveTimeout=60000, imqSetJMSXProducerTXID=false, imqSSLIsHostTrusted
=false, imqConnectionFlowLimitEnabled=false, imqReconnectInterval=5000, imqAddre
ssList=mq://<server>:7676/, imqOverrideJMSHeadersToTemporaryDestinations=false}
23/06/2006 16:40:46 com.sun.messaging.jms.ra.ManagedConnection <init>
INFO: MQJMSRA_MC1101: constructor:Created mcId=2:xacId=4902744336909100288:Using
xacf config={imqOverrideJMSPriority=false, imqConsumerFlowLimit=1000, imqOverri
deJMSExpiration=false, imqAddressListIterations=3, imqLoadMaxToServerSession=tru
e, imqConnectionType=TCP, imqPingInterval=30, imqSetJMSXUserID=false, imqConfigu
redClientID=, imqSSLProviderClassname=com.sun.net.ssl.internal.ssl.Provider, imq
JMSDeliveryMode=PERSISTENT, imqConnectionFlowLimit=1000, imqConnectionURL=http:/
/localhost/imq/tunnel, imqBrokerServiceName=, imqJMSPriority=4, imqBrokerHostNam
e=localhost, imqJMSExpiration=0, imqAckOnProduce=, imqEnableSharedClientID=false
, imqAckTimeout=0, imqAckOnAcknowledge=, imqConsumerFlowThreshold=50, imqDefault
Password=guest, imqQueueBrowserMaxMessagesPerRetrieve=1000, imqDefaultUsername=g
uest, imqReconnectEnabled=true, imqConnectionFlowCount=100, imqAddressListBehavi
or=RANDOM, imqReconnectAttempts=3, imqSetJMSXAppID=false, imqConnectionHandler=c
om.sun.messaging.jmq.jmsclient.protocol.tcp.TCPStreamHandler, imqSetJMSXRcvTimes
tamp=false, imqBrokerServicePort=0, imqDisableSetClientID=false, imqSetJMSXConsu
merTXID=false, imqOverrideJMSDeliveryMode=false, imqBrokerHostPort=7676, imqQueu
eBrowserRetrieveTimeout=60000, imqSetJMSXProducerTXID=false, imqSSLIsHostTrusted
=false, imqConnectionFlowLimitEnabled=false, imqReconnectInterval=5000, imqAddre
ssList=mq://<server>:7676/, imqOverrideJMSHeadersToTemporaryDestinations=false}
23/06/2006 16:40:46 com.sun.messaging.jms.ra.ManagedConnection <init>
INFO: MQJMSRA_MC1101: constructor:Created mcId=3:xacId=4902744336909108480:Using
xacf config={imqOverrideJMSPriority=false, imqConsumerFlowLimit=1000, imqOverri
deJMSExpiration=false, imqAddressListIterations=3, imqLoadMaxToServerSession=tru
e, imqConnectionType=TCP, imqPingInterval=30, imqSetJMSXUserID=false, imqConfigu
redClientID=, imqSSLProviderClassname=com.sun.net.ssl.internal.ssl.Provider, imq
JMSDeliveryMode=PERSISTENT, imqConnectionFlowLimit=1000, imqConnectionURL=http:/
/localhost/imq/tunnel, imqBrokerServiceName=, imqJMSPriority=4, imqBrokerHostNam
e=localhost, imqJMSExpiration=0, imqAckOnProduce=, imqEnableSharedClientID=false
, imqAckTimeout=0, imqAckOnAcknowledge=, imqConsumerFlowThreshold=50, imqDefault
Password=guest, imqQueueBrowserMaxMessagesPerRetrieve=1000, imqDefaultUsername=g
uest, imqReconnectEnabled=true, imqConnectionFlowCount=100, imqAddressListBehavi
or=RANDOM, imqReconnectAttempts=3, imqSetJMSXAppID=false, imqConnectionHandler=c
om.sun.messaging.jmq.jmsclient.protocol.tcp.TCPStreamHandler, imqSetJMSXRcvTimes
tamp=false, imqBrokerServicePort=0, imqDisableSetClientID=false, imqSetJMSXConsu
merTXID=false, imqOverrideJMSDeliveryMode=false, imqBrokerHostPort=7676, imqQueu
eBrowserRetrieveTimeout=60000, imqSetJMSXProducerTXID=false, imqSSLIsHostTrusted
=false, imqConnectionFlowLimitEnabled=false, imqReconnectInterval=5000, imqAddre
ssList=mq://<server>:7676/, imqOverrideJMSHeadersToTemporaryDestinations=false}
23/06/2006 16:40:46 com.sun.messaging.jms.ra.ManagedConnection <init>
INFO: MQJMSRA_MC1101: constructor:Created mcId=4:xacId=4902744336909117696:Using
xacf config={imqOverrideJMSPriority=false, imqConsumerFlowLimit=1000, imqOverri
deJMSExpiration=false, imqAddressListIterations=3, imqLoadMaxToServerSession=tru
e, imqConnectionType=TCP, imqPingInterval=30, imqSetJMSXUserID=false, imqConfigu
redClientID=, imqSSLProviderClassname=com.sun.net.ssl.internal.ssl.Provider, imq
JMSDeliveryMode=PERSISTENT, imqConnectionFlowLimit=1000, imqConnectionURL=http:/
/localhost/imq/tunnel, imqBrokerServiceName=, imqJMSPriority=4, imqBrokerHostNam
e=localhost, imqJMSExpiration=0, imqAckOnProduce=, imqEnableSharedClientID=false
, imqAckTimeout=0, imqAckOnAcknowledge=, imqConsumerFlowThreshold=50, imqDefault
Password=guest, imqQueueBrowserMaxMessagesPerRetrieve=1000, imqDefaultUsername=g
uest, imqReconnectEnabled=true, imqConnectionFlowCount=100, imqAddressListBehavi
or=RANDOM, imqReconnectAttempts=3, imqSetJMSXAppID=false, imqConnectionHandler=c
om.sun.messaging.jmq.jmsclient.protocol.tcp.TCPStreamHandler, imqSetJMSXRcvTimes
tamp=false, imqBrokerServicePort=0, imqDisableSetClientID=false, imqSetJMSXConsu
merTXID=false, imqOverrideJMSDeliveryMode=false, imqBrokerHostPort=7676, imqQueu
eBrowserRetrieveTimeout=60000, imqSetJMSXProducerTXID=false, imqSSLIsHostTrusted
=false, imqConnectionFlowLimitEnabled=false, imqReconnectInterval=5000, imqAddre
ssList=mq://<server>:7676/, imqOverrideJMSHeadersToTemporaryDestinations=false}
23/06/2006 16:40:46 com.sun.messaging.jms.ra.ManagedConnection <init>
INFO: MQJMSRA_MC1101: constructor:Created mcId=5:xacId=4902744336909126400:Using
xacf config={imqOverrideJMSPriority=false, imqConsumerFlowLimit=1000, imqOverri
deJMSExpiration=false, imqAddressListIterations=3, imqLoadMaxToServerSession=tru
e, imqConnectionType=TCP, imqPingInterval=30, imqSetJMSXUserID=false, imqConfigu
redClientID=, imqSSLProviderClassname=com.sun.net.ssl.internal.ssl.Provider, imq
JMSDeliveryMode=PERSISTENT, imqConnectionFlowLimit=1000, imqConnectionURL=http:/
/localhost/imq/tunnel, imqBrokerServiceName=, imqJMSPriority=4, imqBrokerHostNam
e=localhost, imqJMSExpiration=0, imqAckOnProduce=, imqEnableSharedClientID=false
, imqAckTimeout=0, imqAckOnAcknowledge=, imqConsumerFlowThreshold=50, imqDefault
Password=guest, imqQueueBrowserMaxMessagesPerRetrieve=1000, imqDefaultUsername=g
uest, imqReconnectEnabled=true, imqConnectionFlowCount=100, imqAddressListBehavi
or=RANDOM, imqReconnectAttempts=3, imqSetJMSXAppID=false, imqConnectionHandler=c
om.sun.messaging.jmq.jmsclient.protocol.tcp.TCPStreamHandler, imqSetJMSXRcvTimes
tamp=false, imqBrokerServicePort=0, imqDisableSetClientID=false, imqSetJMSXConsu
merTXID=false, imqOverrideJMSDeliveryMode=false, imqBrokerHostPort=7676, imqQueu
eBrowserRetrieveTimeout=60000, imqSetJMSXProducerTXID=false, imqSSLIsHostTrusted
=false, imqConnectionFlowLimitEnabled=false, imqReconnectInterval=5000, imqAddre
ssList=mq://<server>:7676/, imqOverrideJMSHeadersToTemporaryDestinations=false}
23/06/2006 16:40:46 com.sun.messaging.jms.ra.ManagedConnection <init>
INFO: MQJMSRA_MC1101: constructor:Created mcId=6:xacId=4902744336909134336:Using
xacf config={imqOverrideJMSPriority=false, imqConsumerFlowLimit=1000, imqOverri
deJMSExpiration=false, imqAddressListIterations=3, imqLoadMaxToServerSession=tru
e, imqConnectionType=TCP, imqPingInterval=30, imqSetJMSXUserID=false, imqConfigu
redClientID=, imqSSLProviderClassname=com.sun.net.ssl.internal.ssl.Provider, imq
JMSDeliveryMode=PERSISTENT, imqConnectionFlowLimit=1000, imqConnectionURL=http:/
/localhost/imq/tunnel, imqBrokerServiceName=, imqJMSPriority=4, imqBrokerHostNam
e=localhost, imqJMSExpiration=0, imqAckOnProduce=, imqEnableSharedClientID=false
, imqAckTimeout=0, imqAckOnAcknowledge=, imqConsumerFlowThreshold=50, imqDefault
Password=guest, imqQueueBrowserMaxMessagesPerRetrieve=1000, imqDefaultUsername=g
uest, imqReconnectEnabled=true, imqConnectionFlowCount=100, imqAddressListBehavi
or=RANDOM, imqReconnectAttempts=3, imqSetJMSXAppID=false, imqConnectionHandler=c
om.sun.messaging.jmq.jmsclient.protocol.tcp.TCPStreamHandler, imqSetJMSXRcvTimes
tamp=false, imqBrokerServicePort=0, imqDisableSetClientID=false, imqSetJMSXConsu
merTXID=false, imqOverrideJMSDeliveryMode=false, imqBrokerHostPort=7676, imqQueu
eBrowserRetrieveTimeout=60000, imqSetJMSXProducerTXID=false, imqSSLIsHostTrusted
=false, imqConnectionFlowLimitEnabled=false, imqReconnectInterval=5000, imqAddre
ssList=mq://<server>:7676/, imqOverrideJMSHeadersToTemporaryDestinations=false}
23/06/2006 16:40:47 com.sun.messaging.jms.ra.ManagedConnection <init>
INFO: MQJMSRA_MC1101: constructor:Created mcId=7:xacId=4902744336909143040:Using
xacf config={imqOverrideJMSPriority=false, imqConsumerFlowLimit=1000, imqOverri
deJMSExpiration=false, imqAddressListIterations=3, imqLoadMaxToServerSession=tru
e, imqConnectionType=TCP, imqPingInterval=30, imqSetJMSXUserID=false, imqConfigu
redClientID=, imqSSLProviderClassname=com.sun.net.ssl.internal.ssl.Provider, imq
JMSDeliveryMode=PERSISTENT, imqConnectionFlowLimit=1000, imqConnectionURL=http:/
/localhost/imq/tunnel, imqBrokerServiceName=, imqJMSPriority=4, imqBrokerHostNam
e=localhost, imqJMSExpiration=0, imqAckOnProduce=, imqEnableSharedClientID=false
, imqAckTimeout=0, imqAckOnAcknowledge=, imqConsumerFlowThreshold=50, imqDefault
Password=guest, imqQueueBrowserMaxMessagesPerRetrieve=1000, imqDefaultUsername=g
uest, imqReconnectEnabled=true, imqConnectionFlowCount=100, imqAddressListBehavi
or=RANDOM, imqReconnectAttempts=3, imqSetJMSXAppID=false, imqConnectionHandler=c
om.sun.messaging.jmq.jmsclient.protocol.tcp.TCPStreamHandler, imqSetJMSXRcvTimes
tamp=false, imqBrokerServicePort=0, imqDisableSetClientID=false, imqSetJMSXConsu
merTXID=false, imqOverrideJMSDeliveryMode=false, imqBrokerHostPort=7676, imqQueu
eBrowserRetrieveTimeout=60000, imqSetJMSXProducerTXID=false, imqSSLIsHostTrusted
=false, imqConnectionFlowLimitEnabled=false, imqReconnectInterval=5000, imqAddre
ssList=mq://<server>:7676/, imqOverrideJMSHeadersToTemporaryDestinations=false}
23/06/2006 16:40:47 com.sun.messaging.jms.ra.ManagedConnection <init>
INFO: MQJMSRA_MC1101: constructor:Created mcId=8:xacId=4902744336909151488:Using
xacf config={imqOverrideJMSPriority=false, imqConsumerFlowLimit=1000, imqOverri
deJMSExpiration=false, imqAddressListIterations=3, imqLoadMaxToServerSession=tru
e, imqConnectionType=TCP, imqPingInterval=30, imqSetJMSXUserID=false, imqConfigu
redClientID=, imqSSLProviderClassname=com.sun.net.ssl.internal.ssl.Provider, imq
JMSDeliveryMode=PERSISTENT, imqConnectionFlowLimit=1000, imqConnectionURL=http:/
/localhost/imq/tunnel, imqBrokerServiceName=, imqJMSPriority=4, imqBrokerHostNam
e=localhost, imqJMSExpiration=0, imqAckOnProduce=, imqEnableSharedClientID=false
, imqAckTimeout=0, imqAckOnAcknowledge=, imqConsumerFlowThreshold=50, imqDefault
Password=guest, imqQueueBrowserMaxMessagesPerRetrieve=1000, imqDefaultUsername=g
uest, imqReconnectEnabled=true, imqConnectionFlowCount=100, imqAddressListBehavi
or=RANDOM, imqReconnectAttempts=3, imqSetJMSXAppID=false, imqConnectionHandler=c
om.sun.messaging.jmq.jmsclient.protocol.tcp.TCPStreamHandler, imqSetJMSXRcvTimes
tamp=false, imqBrokerServicePort=0, imqDisableSetClientID=false, imqSetJMSXConsu
merTXID=false, imqOverrideJMSDeliveryMode=false, imqBrokerHostPort=7676, imqQueu
eBrowserRetrieveTimeout=60000, imqSetJMSXProducerTXID=false, imqSSLIsHostTrusted
=false, imqConnectionFlowLimitEnabled=false, imqReconnectInterval=5000, imqAddre
ssList=mq://<server>:7676/, imqOverrideJMSHeadersToTemporaryDestinations=false}
Looking up: jms/topic/MyTopic
Does anybody know what these messages mean and also whether or not this is what I should be seeing on the client side?Greetings!!
Dear danrak,
Probably u must ahve found a solution to this issue.
I am facing a similar problem.
I can lookup EJBs but not JMS factoriers.
can u please guide me in this respect!
this is my output
Jan 5, 2007 6:09:38 PM com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: SJSMQ JMS Resource Adapter starting...
================================================================================
Sun Java(tm) System Message Queue 4.0
Sun Microsystems, Inc.
Version: 4.0 (Build 27-a)
Compile: Thu 03/02/2006
Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved.
SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
This product includes code licensed from RSA Data Security.
================================================================================
Jan 5, 2007 6:09:39 PM com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: SJSMQ JMS ResourceAdaapter configuration=
raUID =null
brokerType =REMOTE
brokerInstanceName =imqbroker
brokerBindAddress =null
brokerPort =7676
brokerHomeDir =C:\Sun\AppServer\imq\bin\..
brokerVarDir =C:/Sun/AppServer/domains/domain1\imq
brokerJavaDir =C:/Sun/AppServer/jdk
brokerArgs =null
brokerStartTimeout =60000
adminUsername =admin
adminPassFile =C:\Documents and Settings\Administrator\Local Settings\Temp\asmq36440.tmp
useJNDIRmiServiceURL =true
rmiRegistryPort =1099
startRmiRegistry =true
useSSLJMXConnector =true
brokerEnableHA =false
clusterId =null
brokerId =null
jmxServiceURL =null
dbType =null
dbProps ={}
dsProps ={}
ConnectionURL =mq://FarhanJan:7676/
UserName =guest
ReconnectEnabled =true
ReconnectInterval =5000
ReconnectAttempts =3
AddressListBehavior =PRIORITY
AddressListIterations =3
InAppClientContainer =true
InClusteredContainer =false
GroupName =null
Jan 5, 2007 6:09:39 PM com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: start:SJSMQ JMSRA Connection Factory Config={imqOverrideJMSPriority=false, imqConsumerFlowLimit=1000, imqOverrideJMSExpiration=false, imqAddressListIterations=3, imqLoadMaxToServerSession=true, imqConnectionType=TCP, imqPingInterval=30, imqSetJMSXUserID=false, imqConfiguredClientID=, imqSSLProviderClassname=com.sun.net.ssl.internal.ssl.Provider, imqJMSDeliveryMode=PERSISTENT, imqConnectionFlowLimit=1000, imqConnectionURL=http://localhost/imq/tunnel, imqBrokerServiceName=, imqJMSPriority=4, imqBrokerHostName=localhost, imqJMSExpiration=0, imqAckOnProduce=, imqEnableSharedClientID=false, imqAckTimeout=0, imqAckOnAcknowledge=, imqConsumerFlowThreshold=50, imqDefaultPassword=guest, imqQueueBrowserMaxMessagesPerRetrieve=1000, imqDefaultUsername=guest, imqReconnectEnabled=false, imqConnectionFlowCount=100, imqAddressListBehavior=PRIORITY, imqReconnectAttempts=3, imqSetJMSXAppID=false, imqConnectionHandler=com.sun.messaging.jmq.jmsclient.protocol.tcp.TCPStreamHandler, imqSetJMSXRcvTimestamp=false, imqBrokerServicePort=0, imqDisableSetClientID=false, imqSetJMSXConsumerTXID=false, imqOverrideJMSDeliveryMode=false, imqBrokerHostPort=7676, imqQueueBrowserRetrieveTimeout=60000, imqSetJMSXProducerTXID=false, imqSSLIsHostTrusted=false, imqConnectionFlowLimitEnabled=false, imqReconnectInterval=5000, imqAddressList=mq://FarhanJan:7676/, imqOverrideJMSHeadersToTemporaryDestinations=false}
Jan 5, 2007 6:09:39 PM com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: SJSMQ JMSRA Started
Jan 5, 2007 6:09:43 PM com.sun.messaging.jms.ra.ManagedConnectionFactory setPassword
INFO: MQJMSRA_MF1101: setPassword:NOT setting default value
Jan 5, 2007 6:09:43 PM com.sun.messaging.jms.ra.ManagedConnectionFactory setAddressList
INFO: MQJMSRA_MF1101: setAddressList:NOT setting default value=localhost
Jan 5, 2007 6:09:43 PM com.sun.messaging.jms.ra.ManagedConnectionFactory setUserName
INFO: MQJMSRA_MF1101: setUserName:NOT setting default value=guest
Jan 5, 2007 6:09:45 PM com.sun.enterprise.connectors.ConnectorConnectionPoolAdminServiceImpl obtainManagedConnectionFactory
SEVERE: mcf_add_toregistry_failed
Jan 5, 2007 6:09:45 PM com.sun.enterprise.naming.SerialContext lookup
SEVERE: NAM0004: Exception during name lookup : {0}
com.sun.enterprise.connectors.ConnectorRuntimeException: Failed to register MCF in registry
Your Help will be highly appreciated. -
Having Problem With "static" When Running a Stand Alone Java Class
I have a Java class that recursively builds a 'tree' . This Java class works as I expected without problem. I am able to write out this 'tree" to the console "line by line" with proper indentation.
The problem occurs when I try to iterate through this 'tree' in the public static void main(String[] arg) method -- Each line in the tree is an Array. And I have to declare this Array (called titleArray in my code) non-static; otherwise, I end up with picking up the very last line of my hard-coded data.
Besides, I also have to declare the List (called recursiveTextArray in my code) non-static; otherwise, I end up with picking up the first Array that I ever build and run into endless iterations till the heap size is exhausted. Note that each element of that List is an Array object.
Then, this non-static Array and this non-static List cannot be accessed in the public static void main(String[] arg) method.
What should I do?
Here is my code that works without problem (the one I do not access the 'titleArray' in the main(String[] arg) method):
import java.util.Iterator;
import java.util.List;
import java.util.ArrayList;
import java.util.Date;
import java.awt.Color;
import com.aspose.words.*;
public class OplanPhase
public static void main( String[] args)
OplanPhase root = new OplanPhase( "", "Oplan 50XX - Phase I" );
OplanPhase objective1 = new OplanPhase( "OO-3.1", "Destroy enemy conventional ground forces" );
OplanPhase objective2 = new OplanPhase( "OO-3.2", "Destroy enemy conventional air forces" );
OplanPhase objective3 = new OplanPhase( "OO-3.3", "Destroy enemy conventional naval forces" );
OplanPhase objective4 = new OplanPhase( "OO-3.4", "Influence opposition groups within enemy areas to support friendly forces" );
OplanPhase effect1 = new OplanPhase( "TgtObj-3.1", "Locate, identify, and destroy key enemy C2 nodes" );
OplanPhase effect2 = new OplanPhase( "TgtObj-3.2", "Locate, identify, and destroy key enemy C2 nodes" );
OplanPhase effect3 = new OplanPhase( "CFSOCC-3.2", "influence enemy opposition groups to support friendly forces campaign objectives" );
OplanPhase effect4 = new OplanPhase( "JFMECC-3.3", "Destroy SLOC interdiction vessels" );
OplanPhase effect5 = new OplanPhase( "CFSOCC-3.4", "Influence enemy opposition groups to support friendly forces campaign objectives" );
OplanPhase moe1 = new OplanPhase( "MOE-TO-3.1", "Conduct surveillance to locate and identify key enemy C2 nodes" );
OplanPhase moe2 = new OplanPhase( "MOE-JFSOC-3.1", "Degree of cooperative effort with area opposition groups" );
OplanPhase moe3 = new OplanPhase( "MOE-JFSOC-3.2", "Number of combined missions successfully completed with opposition groups" );
OplanPhase moe4 = new OplanPhase( "MOE-JFSOC-3.3", "Number of combined missions successfully completed with opposition groups" );
OplanPhase task1 = new OplanPhase( "TASK-TO-3.1", "Destroy key enemy C2 nodes" );
OplanPhase task2 = new OplanPhase( "TASK-TO-3.2", "Conduct surveillance to locate and identify key enemy C2 nodes" );
OplanPhase task3 = new OplanPhase( "TASK-TO-3.3", "Destroy key enemy C2 nodes" );
OplanPhase task4 = new OplanPhase( "TASK-JFSOC-3.1", "Degree of cooperative effort with area opposition groups" );
root.addSubLevel( objective1 );
root.addSubLevel( objective2 );
root.addSubLevel( objective3 );
root.addSubLevel( objective4 );
objective1.addSubLevel( effect1 );
objective2.addSubLevel( effect2 );
objective2.addSubLevel( effect3 );
objective3.addSubLevel( effect4 );
objective4.addSubLevel( effect5 );
effect1.addSubLevel( moe1 );
effect1.addSubLevel( task1 );
effect2.addSubLevel( task2 );
effect2.addSubLevel( task3 );
effect3.addSubLevel( moe2 );
effect3.addSubLevel( moe3 );
effect5.addSubLevel( task4 );
effect5.addSubLevel( moe4 );
root.outputAllWithIndentation( 0 );
private String[] titleArray = { "", "", "" };
private int indentation = 0;
private List<OplanPhase> subLevels = new ArrayList<OplanPhase>();
private List recursiveTextArray = new ArrayList();
public OplanPhase( String foo, String bar )
titleArray[1] = foo;
titleArray[2] = bar;
public void addSubLevel( OplanPhase op )
subLevels.add( op );
public void outputAllWithIndentation( int level )
indentation = level;
titleArray[0] = indentString( indentation );
System.out.println( titleArray[0] + "[" + titleArray[1] + "] " + titleArray[2] );
recursiveTextArray.add( titleArray );
for ( int i = 0; i < subLevels.size(); i++ )
( ( OplanPhase )subLevels.get( i ) ).outputAllWithIndentation( level + 1 );
private static String indentString( int count )
String blank = "";
for ( int i = 0; i < count; i++ )
blank = blank.concat( " " );
return blank;
}And the code below gives me the static and non-static problem:
import java.util.Iterator;
import java.util.List;
import java.util.ArrayList;
import java.util.Date;
import java.awt.Color;
import com.aspose.words.*;
public class OplanPhase
public static void main( String[] args)
OplanPhase root = new OplanPhase( "", "Oplan 50XX - Phase I" );
OplanPhase objective1 = new OplanPhase( "OO-3.1", "Destroy enemy conventional ground forces" );
OplanPhase objective2 = new OplanPhase( "OO-3.2", "Destroy enemy conventional air forces" );
OplanPhase objective3 = new OplanPhase( "OO-3.3", "Destroy enemy conventional naval forces" );
OplanPhase objective4 = new OplanPhase( "OO-3.4", "Influence opposition groups within enemy areas to support friendly forces" );
OplanPhase effect1 = new OplanPhase( "TgtObj-3.1", "Locate, identify, and destroy key enemy C2 nodes" );
OplanPhase effect2 = new OplanPhase( "TgtObj-3.2", "Locate, identify, and destroy key enemy C2 nodes" );
OplanPhase effect3 = new OplanPhase( "CFSOCC-3.2", "influence enemy opposition groups to support friendly forces campaign objectives" );
OplanPhase effect4 = new OplanPhase( "JFMECC-3.3", "Destroy SLOC interdiction vessels" );
OplanPhase effect5 = new OplanPhase( "CFSOCC-3.4", "Influence enemy opposition groups to support friendly forces campaign objectives" );
OplanPhase moe1 = new OplanPhase( "MOE-TO-3.1", "Conduct surveillance to locate and identify key enemy C2 nodes" );
OplanPhase moe2 = new OplanPhase( "MOE-JFSOC-3.1", "Degree of cooperative effort with area opposition groups" );
OplanPhase moe3 = new OplanPhase( "MOE-JFSOC-3.2", "Number of combined missions successfully completed with opposition groups" );
OplanPhase moe4 = new OplanPhase( "MOE-JFSOC-3.3", "Number of combined missions successfully completed with opposition groups" );
OplanPhase task1 = new OplanPhase( "TASK-TO-3.1", "Destroy key enemy C2 nodes" );
OplanPhase task2 = new OplanPhase( "TASK-TO-3.2", "Conduct surveillance to locate and identify key enemy C2 nodes" );
OplanPhase task3 = new OplanPhase( "TASK-TO-3.3", "Destroy key enemy C2 nodes" );
OplanPhase task4 = new OplanPhase( "TASK-JFSOC-3.1", "Degree of cooperative effort with area opposition groups" );
root.addSubLevel( objective1 );
root.addSubLevel( objective2 );
root.addSubLevel( objective3 );
root.addSubLevel( objective4 );
objective1.addSubLevel( effect1 );
objective2.addSubLevel( effect2 );
objective2.addSubLevel( effect3 );
objective3.addSubLevel( effect4 );
objective4.addSubLevel( effect5 );
effect1.addSubLevel( moe1 );
effect1.addSubLevel( task1 );
effect2.addSubLevel( task2 );
effect2.addSubLevel( task3 );
effect3.addSubLevel( moe2 );
effect3.addSubLevel( moe3 );
effect5.addSubLevel( task4 );
effect5.addSubLevel( moe4 );
root.outputAllWithIndentation( 0 );
try
Iterator it = recursiveTextArray.iterator(); //compilation error
while ( it.hasNext() )
for ( int i=0; i<titleArray.length; i++ ) //compilation error
if ( i == 0 )
System.out.println( titleArray[0] ); //compilation error
} else if ( i == 1 )
System.out.println( "[" + titleArray[1] + "] " ); //compilation error
} else if ( i == 2 )
System.out.println( titleArray[2] ); //compilation error
} catch (Exception e)
// TODO Auto-generated catch block
e.printStackTrace();
private String[] titleArray = { "", "", "" };
private int indentation = 0;
private List<OplanPhase> subLevels = new ArrayList<OplanPhase>();
private List recursiveTextArray = new ArrayList();
public OplanPhase( String foo, String bar )
titleArray[1] = foo;
titleArray[2] = bar;
public void addSubLevel( OplanPhase op )
subLevels.add( op );
public void outputAllWithIndentation( int level )
indentation = level;
titleArray[0] = indentString( indentation );
System.out.println( titleArray[0] + "[" + titleArray[1] + "] " + titleArray[2] );
recursiveTextArray.add( titleArray );
for ( int i = 0; i < subLevels.size(); i++ )
( ( OplanPhase )subLevels.get( i ) ).outputAllWithIndentation( level + 1 );
private static String indentString( int count )
String blank = "";
for ( int i = 0; i < count; i++ )
blank = blank.concat( " " );
return blank;
}What should I do?If you feel you need to cross-post, you should have the courtesy to provide a
link to the other post/s.
http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=1&t=016129
Maybe you are looking for
-
Systems error 2147287035 when trying to load an upgrade to Lightroom 4.3
What a muddle. I have formulated my question elsewhere, How do I reference it for answers to be given?
-
Can you report on aggregares? If so whats the scenario?
Can you report on aggregares? If so whats the scenario?
-
Ridiculous (old) bug in _TextEdit - cannot copy-edit-paste email!
Anyone else noticed this? When I copy text from my webmail or an internet page and try to edit it with Textedit, it is not possible to email it again without extra "?" signs appearing in the end of every line. They are not visible in the TextEdit win
-
Create metric alert in OEM 12c for windows services
Hi, I was wondering if there is a way to create metric alert for services on a windows host, so that when any service is in stopped state, we will get an alert. We can check the status of services from OEM that are running in a windows server. Host -
-
Adobe application manager wont install
hi Ive deleted adobe application manager and now it wont reinstall help please