J2EE Tutorial - Application Client
Hi,
I've been trying to work through the J2EE Tutorial and I've come to a complete standstill at the EJB section. I have a few problems.
First of all my deployment tool does not have a JNDI Names Tag as shown in the Mapping The Enterprize Beans Section (Chapter 19). How do I do this?
I am getting the following error when I try to run my J2EE Application Client.
Caught an unexpected exception!
java.lang.ClassCastException
at com.sun.corba.ee.impl.javax.rmi.PortableRemoteObject.narrow(PortableR
emoteObject.java:229)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
at ConverterClient.main(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:23
7)
at com.sun.enterprise.appclient.Main.<init>(Main.java:425)
at com.sun.enterprise.appclient.Main.main(Main.java:97)
Caused by: java.lang.ClassCastException
at com.sun.corba.ee.impl.javax.rmi.PortableRemoteObject.narrow(PortableR
emoteObject.java:212)
Finally, can anybody recommend a good tutorial or book as I think the J2EE tutorial is unusually bad.
http://docs.sun.com/source/819-0079/dgacc.html
Finally, can anybody recommend a good tutorial or
book as I think the J2EE tutorial is unusually bad.Search for Mastering EJB by Ed Roman. It should give a better understanding.
Similar Messages
-
J2EE Application Client Components
Anybody knows a good tutorial (online available) for writing J2EE Application Client Components?
Oh, you want an entire tutorial about client
components...
There is a little info in this chapter of the above
http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/WCC.html
Isn't a client component just a browser, or a java
application/applet, or an executable?Yes, a client may be a browser. But I want to write an own executable java application as a client for my j233 application. I found a short chapter in "Enterprise Java Beans" by Richard Monson-Haefel and there, he writes about client components as standalone Java-applications. I read something about explicit declaring them in the application.xml and I wonder why this should be...? So I wondered if there is a special tutorial about writing standalone applications as clients for j2ee web applications...
I think the chapter you posted is only about web components... -
Run client execution problem when running Sun J2EE tutorial example
Hi,
I'm trying to run the Sun J2EE tutorial example, CartApp.
When come to run the client application I got the following error:
The command:
E:\Dev\src\J2EE_J2EE_tutorial\examples\ears>runclient -client CarApp.ear -name CartClient -textauth
The error:
Application threw an exception:java.io.IOException: CarApp.ear does not exist
The deployment complete without error.
I tried to the the APPCPATH to :
set APPCPATH=E:\Dev\src\J2EE_J2EE_tutorial\examples\ears\CartAppClient.jar
set APPCPATH=CartAppClient.jar
On both set, it gave the same error above.
Did someone known the problem I have ?
Thnakshi ,
I think u have given other disply name to your J2EE client ,
Anyway check disply name of J2EE client through deploytool.
u have to use that display name to access the j2ee client .
suppose ur j2ee client displyname is testclient, u can use:
runclient -client ConverterApp.ear -name testclient
hope this will help u,
babu. -
I used Sun Java Studio Enterprise to create a stateful session bean (Cart as in the J2ee Tutorial) and deployed it to Sun Application Server (v7). Then in the same application, I creaed a New EJB Test Application (web based test application) called Cart_TestApp by highlighting the Cart (EJB) node and clicking "Create New EJB Test Application" . Everything is perfect and I could use this Cart_TestApp (once again it is web based test app) to test each function defined in the CartHome, Cart. After that, I created another application client to test this Cart bean. The way I did is that I created another J2EE Application Client called CartTestClient by using Templates-->J2EE--->Application Client. Then in the property sheet of this Application Client, I specified two properties:
1. Application Server----- Server1 (localhost:8080)
2. EJB Reference----
2.1 Reference Name---- ejb/Cart
2.2 Reference EJB Name----Cart
2.3 Type---Session
2.4 Home Interface ----CartHome
2.5 Remote Interface ---Cart
After that, I built this Application Client and executed the Application Client, but Studio prompts the following error message:
You must either set a target application, or provide a client stub jar path in the Sun Java System AS tab on the client property sheet!
In this case, I clicked ellipse for the "Target Application" on the property sheet, which finally only allows me to specify "Cart_TestApp" , note not Cart(EJB), as the Target Application. And I did it. Finally it works just fine for the Application Test.
Now my questions are:
1. How to get the EJB client stub jar in the studio for this Cart (EJB)?
2. Why does the Application Client work just fine after I specified the "Target Application" item in the property sheet as "Cart_TestApp" since "Cart_TestApp" is only a web based test application for the Cart (EJB)? It seems to me that the EJB Application Client has nothing to do with "Cart_TestApp" since both of them are just test clients (one is web based, another standalone java client). Any insights??
Thanks.
YangI have figured it out now and actually Cart_TestApp is just an enterprise application generated by Studio with Cart(EJB) inside. Got confused it with SJSAS v8.
-
How to run J2EE application client remotely
I have the Duke's Bank demo running on a Linux PC "crackpad" (http://thomasfly.com:8000/bank/logon CustomerID=200, Password=j2ee) which I can access LAN-wise as http://crackpad:8000/etc. Accessing the bank as an administrator using the J2EE app. client also works fine (locally) on the Linux PC.
I've also installed & run the Bank demo on a Windows PC, so I have all the req'd ears & jars there as well. However, when I try to run the app client on the Windows PC (accessing the J2EE Reference Implementation server on running crackpad), I getC:\j2eetutorial\bank\jar> runclient -client DukesBankApp.ear -name BankAdmin
Application threw an exception:javax.naming.NamingException: Serial Context failureI set the environment variables per http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Tools10.html#65815 http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Tools10.html :C:\j2eetutorial\bank\jar> echo %VMARGS%
-Dorg.omg.CORBA.ORBInitialHost=crackpad
C:\j2eetutorial\bank\jar> echo %APPCPATH%
DukesBankAppClient.jar
C:\j2eetutorial\bank\jar> dir DukesBankApp*.*
07/10/2002 09:58 PM 420,480 DukesBankApp.ear
07/10/2002 10:25 PM 712,814 DukesBankAppClient.jarHas anybody encountered this problem & solved it, or see anything that I've overlooked?I have the Duke's Bank demo running on a Linux PC "crackpad" (http://thomasfly.com:8000/bank/logon CustomerID=200, Password=j2ee) which I can access LAN-wise as http://crackpad:8000/etc. Accessing the bank as an administrator using the J2EE app. client also works fine (locally) on the Linux PC.
I've also installed & run the Bank demo on a Windows PC, so I have all the req'd ears & jars there as well. However, when I try to run the app client on the Windows PC (accessing the J2EE Reference Implementation server running on crackpad), I getC:\j2eetutorial\bank\jar> runclient -client DukesBankApp.ear -name BankAdmin
Application threw an exception:javax.naming.NamingException: Serial Context failureI set the environment variables per http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Tools10.html#65815 :C:\j2eetutorial\bank\jar> echo %VMARGS%
-Dorg.omg.CORBA.ORBInitialHost=crackpad
C:\j2eetutorial\bank\jar> echo %APPCPATH%
DukesBankAppClient.jar
C:\j2eetutorial\bank\jar> dir DukesBankApp*.*
07/10/2002 09:58 PM 420,480 DukesBankApp.ear
07/10/2002 10:25 PM 712,814 DukesBankAppClient.jarHas anybody encountered this problem & solved it, or see anything that I've overlooked? -
How to create and run J2EE application client for Hello World EJB
Hi
I am new to NWDS EJB deployment.I have created a "Hello World" bean. But how to deploy it and run using a J2EE application client step by step.
Also please help in the steps of the deploy tool.
Thanks in AdvanceHi Ananda
Check this link,
http://help.sap.com/saphelp_nw04/helpdata/en/55/600e64a6793d419b82a3b7d59512a5/content.htm
cheers
Sameer -
I unable to run ejb with application client using oc4j j2ee container
Hi,
I have installe oracle9i (1.0.2.2) oc4j j2ee container.
I unable to run the ejbs . please help me how to run ejbs with application client and which files are shall configure.
See the client application is :
public static void main (String []args)
try {
//Hashtable env = new Hashtable();
//env.put("java.naming.provider.url", "ormi://localhost/Demo");
//env.put("java.naming.factory.initial", "com.evermind.server.ApplicationClientInitialContextFactory");
//env.put(Context.SECURITY_PRINCIPAL, "guest");
//env.put(Context.SECURITY_CREDENTIALS, "welcome");
//Context ic = new InitialContext (env);
System.out.println("\nBegin statelesssession DemoClient.\n");
Context context = new InitialContext();
Object homeObject = context.lookup("java:comp/env/DemoApplication");
DemoHome home= (DemoHome)PortableRemoteObject.narrow(homeObject, DemoHome.class);
System.out.println("Creating Demo\n");
Demo demo = home.create();
System.out.println("The result of demoSelect() is.. " +demo.sayHello());
}catch ( Exception e )
System.out.println("::::::Error:::::: ");
e.printStackTrace();
System.out.println("End DemoClient....\n");
When I am running client application I got this type of Exception
java.lang.SecurityException : No such domain/application: sampledemo
at com.evermind.server.rmi.RMIConnection.connect(RMIConnection.java : 2040)
at com.evermind.server.rmi.RMIConnection.connect(RMIConnection.java : 1884)
at com.evermind.server.rmi.RMIConnection.lookup(RMIConnection.java : 1491)
at com.evermind.server.rmi.RMIServer.lookup(RMIServer.java : 323)
at com.evermind.server.rmi.RMIContext.lookup(RMIConext.java : 106)
at com.evermind.server.administration.LazyResourceFinder.lookup(LazyResourceFinder.java : 59)
at com.evermind.server.administration.LazyResourceFinder.getEJBHome(LazyResourceFinder.java : 26)
at com.evermind.server.Application.createContext(Application.java: 653)
at com.evermind.server.ApplicationClientInitialContext.getInitialContext(ApplicationClientInitialContextFactory.java :179 )
at javax.naming.spi.NamingManager.getInitialContext(NamingManger.java : 246)
at javax.naming.InitialContext.getDefaultInitialCtx(InitialContext.java : 246)
at javax.naming.InitialContext.init(InitialContext.java : 222)
at javax.naming.InitialContext.<init>(InitialContext.java : 178)
at DemoClient.main(DemoClient.java : 23)
.ear file is copied into applications directory.
I have configured server.xml file like this
<application name="sampledemo" path="../applications/demos.ear" />
demos.ear file Contains following files
application.xml
demobean.jar
Manifest.mf
demobean.jar file contains following files
application-client.xml
Demo.class
DemoBean.class
DemoHome.class
ejb-jar.xml
jndi.properties
Mainifest.mf
Please give me your valuable suggestions. Which are shall i configure .
Thanks & Regards,
BadriHi Badri,
ApplicationClientInitialContextFactory is for clients which got deployed inside OC4J container..
For looking up EJB from a stand alone java client please use RMIInitialContextFactory..So please change ur code....
Also please check ur server.xml
Since you have specified your ejb domain as "sampledemo"
you have to use that domian only for look up..But it seems that you are looking up for "Demo" domain instead of "sampledemo" domain...So change your code to reflect that..
Code snippet for the same is :
Hashtable env = new Hashtable();
env.put("java.naming.provider.url", "ormi://localhost/sampledemo");
env.put("java.naming.factory.initial", "om.evermind.server.rmi.RMIInitialContextFactory");
env.put(Context.SECURITY_PRINCIPAL, "guest");
env.put(Context.SECURITY_CREDENTIALS, "welcome");
Context ic = new InitialContext (env);
Hope this helps
--Venky -
J2EE Application Client Container
Hi everyone,
I've three questions about J2EE Application Client Container.
1) What do I have to install into the client computer so that my J2EE client application can run?
2) Can I install my client application and also the client container through Java Web Start?
3) Can I develop a (remote) client application that needs only J2SE but uses the Enterprise Java Beans?
Thanks for the helpHi everyone,
I've three questions about J2EE Application Client
Container.
1) What do I have to install into the client computer
so that my J2EE client application can run?This is vendor specific. So you have to read your application server docmentation.
If you are using Sun Java System Application Server (which is now open sourced at glassfish.dev.java.net), then here is a useful document for you:
http://docs.sun.com/app/docs/doc/819-2642/6n4tspp7b?a=view
>
2) Can I install my client application and also the
client container through Java Web Start?
This is not yet required by Java EE platform, not in J2EE 1.4 and is not going to be rquired in Java EE 5 as well. So you have to ask your appserver vendor to see if they support Java Web Start for appclient container. Sun Java System Application Server 9.0 which is being developed in open source project glassfish (http://glassfish.dev.java.net) supports Java Web Start. You can check out.
3) Can I develop a (remote) client application that
needs only J2SE but uses the Enterprise Java Beans?No, you typically need additional libraries. Typically vendors provides a tool that makes a nice package that you can take to a remote host and run the appclient container there. e.g. if you are using Sun Java System Application Server, here is what you need to do:
http://docs.sun.com/app/docs/doc/819-2642/6n4tspp7j?a=view#beale
-- Sahoo
>
Thanks for the help -
J2EE Tutorial With Remote Client
Where can I find a J2EE tutorial that demonstrates a remote client accessing an EJB? The Sun tutorial are all localized examples. Does a remote client have to run on a J2EE server?
Thanks,
-RayRemote Clients do not have to run in a J2EE server. All you need is the j2ee.jar and your app server's required runtime jar file(s) e.g oracle9iAS(oc4j.jar) and the .properties files.
Let me know if you need any more information. -
Converter sample from J2EE Tutorial problem
Hello all,
I have built the ConvertApp using the J2EE as shown in the J2EE (which I highly recommend by the way --on-line or book version), but am getting the following error:
(from Verifier log file):
FAILED TESTS :
Test Name : tests.web.elements.WebEjbReferencesElement
Test Assertion : Web archive references to other beans homes test
Test Description : Error: Class [ ConverterHome ] not found in WEB-INF/classes or WEB-INF/lib.
For [ /ConverterWAR ]
Error: class [ ConverterHome ] cannot be found within this jar [ ConverterWAR ].
Error: Class [ Converter ] not found in WEB-INF/classes or WEB-INF/lib.
For [ /ConverterWAR ]
Error: class [ Converter ] cannot be found within this jar [ ConverterWAR ].
======
I'm running Windows 2K (I did see a similar problem someone was having under '98) and I know this tutorial works under W2K. I also have confirmed all my environmental variables are correct.
I am noticing that under the \j2eetutorial\examples\src\ejb\converter directory that I have a number of temp files (intermediate?). Specifically, if I use the Deploytool and select the ConverterApp in the tree view, I see three filenames that appear in the Contents window under the META-INF section:
app-client-ic.jar
ejb-jar-ic.jar
war-ic.war
Well, the temp files look like this (for example):
app-client-temp21282.jar
ejb_temp21276.jar
web_temp21293.war
I don't know if this means anything or not, as I seem to be getting the .ear, .war and .jar files when I deploy the ConverterApp without a problem.
If I try to run the Client from the \j2eetutorial\examples\src\ejb\converter directory using the runclient command, I get the following:
Application threw an exception:java.lang.NoClassDefFoundError: ConverterHome
The tutorial has a specific reference to this (p.43 in book) indicating a problem in the ConverterApp.jar file. I've undeployed, deleted ear, war, jar and temp files, and recompiled with ant (twice), thinking I must have skipped a step somewhere, but to no avail.
Both these problems look suspiciously like environment or path issues, but I cannot see anything obviously wrong. I confirmed that I do have a ConverterHome.class file in the C:\j2eetutorial\examples\build\ejb\converter directory too.
Has anyone seen this before who can share how to fix the issue?
Thanks for the help!
JonI have the same problem when trying to run 'Converter' example on Sun Deployment tool.
When I tried to use verifier for the ConverterApp I got the following message
"Error: Class [ ConverterHome ] not found in WEB-INF/classes or WEB-INF/lib.
For [ /ConverterWAR ]
Error: class [ ConverterHome ] cannot be found within this jar [ ConverterWAR ].
Error: Class [ Converter ] not found in WEB-INF/classes or WEB-INF/lib.
For [ /ConverterWAR ]
Error: class [ Converter ] cannot be found within this jar [ ConverterWAR ]."
When I tried to run the client app using the runclient command I got the
following message
"C:\j2eeDeployPractice\src\ejb\converter\runclient -client converter.ear -name converterClient -testauth
No application client desriptors defined for: converterClient"
Note: I was able to run the web client successfully when
using this URL: "http://localhost:8000/converter/index.jsp"
Any idea how to fix those error message is grealy appreciated.
KH -
Forte for Java J2EE Tutorial -- RMI RemoteException
In testing the J2EE tutorial (Restaurant_TestApp) I keep encountering the following error when invoking the findAll method. I get the same error when invoking Data.Restaurant create.
The error is:
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: java.rmi.RemoteException java.rmi.RemoteException
Any help or pointers from someone who has successfully built and tested the tutorial would be hugely appreciated!
Many thanks,
Luke
The full error from the J2EE log is:
javax.ejb.EJBException
at com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:1560)
at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:1472)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:1289)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:403)
at Data.RestaurantEJB_PM_RemoteHomeImpl.findAll(RestaurantEJB_PM_RemoteHomeImpl.java:99)
at Data._RestaurantHome_Stub.findAll(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method)
at com.sun.forte4j.j2ee.ejbtest.webtest.InvocableMethod$MethodIM.invoke(InvocableMethod.java:232)
at com.sun.forte4j.j2ee.ejbtest.webtest.EjbInvoker.getInvocationResults(EjbInvoker.java:97)
at com.sun.forte4j.j2ee.ejbtest.webtest.DispatchHelper.getForward(DispatchHelper.java:190)
at org.apache.jsp.dispatch$jsp._jspService(dispatch$jsp.java:127)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:202)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.access$0(ApplicationFilterChain.java:197)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:172)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:368)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
at java.lang.Thread.run(Thread.java:484)
java.rmi.RemoteException
at com.sun.enterprise.iiop.POAProtocolMgr.mapException(POAProtocolMgr.java:389)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:431)
at Data.RestaurantEJB_PM_RemoteHomeImpl.findAll(RestaurantEJB_PM_RemoteHomeImpl.java:99)
at Data._RestaurantHome_Stub.findAll(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method)
at com.sun.forte4j.j2ee.ejbtest.webtest.InvocableMethod$MethodIM.invoke(InvocableMethod.java:232)
at com.sun.forte4j.j2ee.ejbtest.webtest.EjbInvoker.getInvocationResults(EjbInvoker.java:97)
at com.sun.forte4j.j2ee.ejbtest.webtest.DispatchHelper.getForward(DispatchHelper.java:190)
at org.apache.jsp.dispatch$jsp._jspService(dispatch$jsp.java:127)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:202)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.access$0(ApplicationFilterChain.java:197)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:172)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:368)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
at java.lang.Thread.run(Thread.java:484)RMI is not that hard.. its just hard to explain :)
I have not done the tutorial.. so bare with me..
the errors your seeing can mean many things.. but above all else it means that you've got a problem either connecting or communicating to the rmi_server you created or the rmiRegistry
My suggestion is this...
First try a simpler application.
How about a simple server that returns a string
and sets a string.
then a client app that can read the server string and envoke a change to it...
This will show the basics involved.
let me know your toughts..
j. -
EJB 3.0 Application Client threw Remote nested exception
Hi All,
I came across the following EJBException message when trying to retrieve an Employee record (entity bean in EJB 3.0) after having successfully added it into EMPLOYEE table using stateless session bean:
*10/03/2009 8:53:14 PM com.sun.enterprise.appclient.MainWithModuleSupport <init>*
WARNING: ACC003: Application threw an exception.
javax.ejb.EJBException: nested exception is: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.RemoteException: null; nested exception is:
java.lang.NullPointerException
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.RemoteException: null; nested exception is:
java.lang.NullPointerException
at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.mapSystemException(Util.java:243)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:205)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:152)
at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(BCELStubBase.java:225)
at ejb.__EmployeeRemote_Remote_DynamicStub.findEmployee(ejb/__EmployeeRemote_Remote_DynamicStub.java)
at ejb._EmployeeRemote_Wrapper.findEmployee(ejb/_EmployeeRemote_Wrapper.java)
at client.EmployeeApplicationClient.printEmployee(EmployeeApplicationClient.java:608)
at client.EmployeeApplicationClient.main(EmployeeApplicationClient.java:55)
Below is the code snippets of EmployeeApplicationClient.java:
public class EmployeeApplicationClient {
@EJB
private static EmployeeRemote employeebean1;
@EJB
private static EmployeeRemote employeebean2;
public EmployeeApplicationClient() {}
public static void main(String[] args)
EmployeeApplicationClient employee_application_client = new EmployeeApplicationClient();
employee_application_client.addEmployee(1, John, Smith);
employee_application_client.printEmployee(1);
public void addEmployee(int id, String firstname, String surname)
try {
Employee employee1 = new Employee();
employee1.setID(id);
employee1.setfirstname(firstname);
employee1.setsurname(surname);
employeebean1.createEmployee(employee1);
catch {.....}
public void printEmployee(int employee_id)
Employee employee2 = employeebean2.findEmployee(employee_id);
System.out.println("employee Id: " + employeebean2.getId());
System.out.println("employee firstname: " + employeebean2.getfirstname());
System.out.println("employee surname: " + employeebean2.getsurname());
}Using employeebean1/employeebean2 in printEmployee() did not make any difference.
The error message appears to indicate that I have incorrectly structured these methods.
The deployment of EmployeeBean was successful and employee1 is in EMPLOYEE table via SQL query.
I am using JDK1.6.07, Glassfish v2 with MySQL 5.0 and Netbeans 6.1 on Windows XP platform.
Any assistance would be greatly appreciated.
Thanks,
JackHi Ataraxisme,
Thank you for responding to this post.
This is a J2EE Application Client that was created and deployed along as an Netbeans EAR (both Application Client and EJB) project which uses resource injection as opposed to JNDI lookup.
I am trying to get employeeApplicationClient.java to work the same way as the following travelAgentApplicationClient.java example which has successfully retrieved its record record immediately after adding using resource injection:
public class TravelAgentClient {
@EJB
private static TravelAgentRemote travelagent;
public TravelAgentClient() {
public static void main(String[] args) {
TravelAgentClient client = new TravelAgentClient();
client.doTravelAgent();
public void doTravelAgent() {
try {
Cabin cabin_1 = new Cabin();
cabin_1.setId(1);
cabin_1.setName("Master Suite");
cabin_1.setDeckLevel(1);
cabin_1.setShipId(1);
cabin_1.setBedCount(3);
travelagent.createCabin(cabin_1);
Cabin cabin_2 = travelagent.findCabin(1);
System.out.println(cabin_2.getName());
System.out.println(cabin_2.getDeckLevel());
System.out.println(cabin_2.getShipId());
System.out.println(cabin_2.getBedCount());
......Thanks,
Jack -
Getting the InitialContext in an application client
I have an application client deployed in my application. When I run the client like this:
java -jar reconcile-client/reconcile-client.jar
It is failing with this exception when trying to look up anything through the InitialContext object:
Exception in thread "main" 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:640)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:280)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at aoc.arkansas.ReconcileClient.main(ReconcileClient.java:26)Is there another way I should be running the client? According to this link I shouldn't have to supply any information to the constructor of the InitialContext object. http://download.oracle.com/docs/cd/B32110_01/web.1013/b28221/servjndi011.htmYou missed the part where it says you have to use "oracle.j2ee.naming.ApplicationClientInitialContextFactory" and that you should see "Configuring an Oracle Initial Context Factory" (http://download.oracle.com/docs/cd/B32110_01/web.1013/b28221/servjndi011.htm#CIACBCHB). Follow that link and you'll find you have to pass in a map with the "java.naming.factory.initial" property set to that factory, and with the "java.naming.provider.url" property set up to point to the OC4J server.
-
J2EE Tutorial: Exception when building with ant
I am trying to build the converter example on page 48 of the J2EE tutorial using ant. Ant seems to choke on the following line from the build.xml:
<property environment="myenv" />
The output of the "ant converter" command is:
Buildfile: build.xml
init:
BUILD FAILED
/usr/j2sdkee1.3/j2eetutorial/examples/src/build.xml:18: /usr/j2sdkee1.3/j2eetutorial/examples/src/build.xml:18: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
--- Nested Exception ---
/usr/j2sdkee1.3/j2eetutorial/examples/src/build.xml:18: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
--- Nested Exception ---
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1525)
at org.apache.tools.ant.taskdefs.Property.loadEnvironment(Property.java:248)
at org.apache.tools.ant.taskdefs.Property.execute(Property.java:172)
at org.apache.tools.ant.Target.execute(Target.java:153)
at org.apache.tools.ant.Project.runTarget(Project.java:898)
at org.apache.tools.ant.Project.executeTarget(Project.java:536)
at org.apache.tools.ant.Project.executeTargets(Project.java:510)
at org.apache.tools.ant.Main.runBuild(Main.java:421)
at org.apache.tools.ant.Main.main(Main.java:149)
Total time: 1 second
My best guess is that the "myenv" line in the build.xml requires some additional attribute. I'm using ant version 1.3. My OS is Solaris (noted for possible environment-related issues).
Thanks in advance!
Eric SmithOn Windows XP Pro, the line
<property environment="myenv" />
in the init target of build.xml for the j2ee tutorial examples triggers a windows error message:
16 bit MS-DOS Subsystem
=======================
C:\WINDOWS\system32\ntvdm.exe
Error while setting up environment for the application. Choose 'Close' to terminate the application.
<<Close>> <<Ignore>>
So it looks as if ant is trying and failing to access the winnt system environment here.
According to Ant Developers Handbook (Sams, October 2002, chapter 4, p. 151), the ant environment property "specifies a prefix, giving access to OS-specific environment variables. This is not supported on all platforms." Until this problem is fixed, it appears that on XP systems anyway, any ant settings in build.xml files that rely on direct access to the system environment will fail. Here is some debug output from the j2ee tutorial examples init target which demonstrates this:
C:\apps\j2sdkee1.3.1\j2eetutorial\examples>ant init
Buildfile: build.xml
init:
[echo] starting init target
[echo] reached marker 1
[echo] reached marker 2
[echo] value of J2EE_HOME is ${myenv.J2EE_HOME}
[echo] finished init target
BUILD SUCCESSFUL
where the task:
<property environment="myenv" />
(which generates the OS error popup noted above) occurs between marker 1 and marker 2. Clearly the value of J2EE_HOME is NOT being successfully read from the system environment here. -
Where i find trail version of j2ee engine for client machine.
Hi,
I am new bee in sap netweaver . Now i have ecc 5.0 at my office. I need to make WebDyn pro application at my client side. For testing purpose i need to create java environment for running my dynpro applications. So please can any one tell me where i find trail version of j2ee engine for client machine.
Please explain it and provide me paths where i download environment.
Regards,
Gurprit Bhatia"(also, my profile says that I'm running OS X 10.4.6, but I'm not really sure, that's just what one of the disks has written on it that came with my used and very cheap machine "
Click on the blue Apple icon at the top left of your screen and choose About this Mac. That will tell you what your OS version is and what amount of RAM you have. The "More Info" button in the pop-up screen will give you the Apple System Profiler application and that will give you whole bunches of information on the drive space used etc.
David
Maybe you are looking for
-
Ipod nano not recognized by pc and will not turn on
ipod nano not recognized by pc and will not turn on
-
Hi all, We have had Lync on premise for a long time, and have recently added Office 365 Business Premium Plan because we wanted Cloud exchange and SharePoint. I have found that on our on prem Lync, when we enable federation for "Lync Online" it cause
-
Why are my images saving grey when they should be white?
Hi all, I need to create a header for my blog, which I've done and uploaded it here; testertown.blogspot.com (apologies for the name, it's just to design the template before uploading) In the Photoshop window it comes up brilliant white background, b
-
HT1386 Will itunes sync save video downloaded through app?
I have the Khan Archiver app on my ipod touch with many Khan Academy videos that I downloaded thrrough the app. Will syncing my itouch mean save those videos to my computer?
-
Steps to make a workplan for a BW implementation
Hi: I would like to know which are the steps to put into a workplan in order to plan a BW implementation with a BW consultant,since the BW server installing. Points for helpfull answer. Thanks in advanced.