ClassCastException at narrow (Servlet/EJB)
Hi
I am new to this EJB concept.
I try to use an EJB in a servlet but I have a ClassCastException thrown by the narrow method.
I've already looked through the forums , but I haven't seen a solution for me.
I use JBOSS-3.0.8 and TOMCAT-4.0.1.
I include the client jar file generated by the deploytool in my client classpath.
Here is the part of the servlet calling the EJB:
Properties props= new Properties();
props.put(Context.PROVIDER_URL, "jnp://localhost:1099");
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
try {
Context jndiContext = new InitialContext(props);
System.out.println("Lookup");
Object object = jndiContext.lookup("ejb/eltUtil");
System.out.println("Object =>" + object.getClass()+"<=");
System.out.println("Object =>" + object.toString()+"<=");
System.out.println("PortableRemoteObject");
UtilHome lUtilHome = (UtilHome)PortableRemoteObject.narrow(object,UtilHome.class);
Here is the result in the jsp page:
java.lang.ClassCastException
at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:296)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
at fr.gouv.defense.cimd.authentification.servlet.ServletListeUtil.doGet(ServletListeUtil.java:87)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
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.doFilter(ApplicationFilterChain.java:193)
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.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
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:2344)
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.valves.AccessLogValve.invoke(AccessLogValve.java:462)
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:163)
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:1011)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106)
at java.lang.Thread.run(Thread.java:484)
And the log message in Tomcat:
Lookup
Object =>class org.jnp.interfaces.MarshalledValuePair<=
Object =>org.jnp.interfaces.MarshalledValuePair@53cdaa<=
PortableRemoteObject
When I run the code in a Client interface in Eclipse, that works and the log is :
Lookup
Objet =>class $Proxy0
Objet =>ejb/eltUtilHome
PortableRemoteObject
I don't know what to do.
Does anybody got the answer?
Thanks.
even if isAssignableFrom returns false, still it can work.....
here is how
Object notificationServiceObject = initialContext.lookup(NotificationServiceHome.JNDI_NAME);
//Key Step
Object notificationServiceRawObject = ((org.jnp.interfaces.MarshalledValuePair)
notificationServiceObject).get();
NotificationServiceHome notificationServiceHome =
(NotificationServiceHome)javax.rmi.PortableRemoteObject.narrow
(notificationServiceRawObject,NotificationServiceHome.class);
NotificationService notificationService = notificationServiceHome.create();
Similar Messages
-
ClassCastException while narrow an EJV using RMI-IIOP
Hi,
I'm trying to deploy an EJB on weblogic 6.1 SP4 on an AIX system, and a client
(JSP) running on weblogic 6.1 SP4 on a SUN system. And, the dialog between EJB
and servlet has to use RMI-IIOP (due to exploitation constraints).
I receive this exception when getting the reference of the EJB's home :
java.lang.ClassCastException: Cannot narrow remote object to ejbMweb.TstEjbMwebHome
at weblogic.iiop.PortableRemoteObjectDelegateImpl.narrow(PortableRemoteObjectDelegateImpl.java:124)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:132)
at cliEjbMweb.cliTstMweb.narrow(cliTstMweb.java:133)
at cliEjbMweb.cliTstMweb.getHome(cliTstMweb.java:31)
at cliEjbMweb.cliTstMweb.testBean1(cliTstMweb.java:53)
at jsp_servlet.__index._jspService(__index.java:91)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:262)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:321)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:198)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2637)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2359)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
The same test using t3 is running OK (there is no problem of classpath).
Can you hel me ?
Thank you !
Marc"Marc" <[email protected]> writes:
It can't download the stub, you need to set an appropriate security
manager for the RMIClassLoader to work, or make sure the stubs are on
the client.
andy
Hi,
I'm trying to deploy an EJB on weblogic 6.1 SP4 on an AIX system, and a client
(JSP) running on weblogic 6.1 SP4 on a SUN system. And, the dialog between EJB
and servlet has to use RMI-IIOP (due to exploitation constraints).
I receive this exception when getting the reference of the EJB's home :
java.lang.ClassCastException: Cannot narrow remote object to ejbMweb.TstEjbMwebHome
at weblogic.iiop.PortableRemoteObjectDelegateImpl.narrow(PortableRemoteObjectDelegateImpl.java:124)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:132)
at cliEjbMweb.cliTstMweb.narrow(cliTstMweb.java:133)
at cliEjbMweb.cliTstMweb.getHome(cliTstMweb.java:31)
at cliEjbMweb.cliTstMweb.testBean1(cliTstMweb.java:53)
at jsp_servlet.__index._jspService(__index.java:91)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:262)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:321)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:198)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2637)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2359)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
The same test using t3 is running OK (there is no problem of classpath).
Can you hel me ?
Thank you !
Marc -
ClassCastException While Narrowing
Hi,
I have my application deployed as EAR file, with a WAR and two JAR for the statelesss session beans. On Server start up I call a servlet (in the WAR), which invokes the EJB deployed in one of the JAR file. At that instance it is giving the following Error:
Exception :Cannot narrow remote object to au.com.three.hutchison.hss.ejb.staticinfo.StaticInfoHome
java.lang.ClassCastException: Cannot narrow remote object to au.com.three.hutchison.hss.ejb.staticinfo.StaticInfoHome
at weblogic.iiop.PortableRemoteObjectDelegateImpl.narrow(PortableRemoteObjectDelegateImpl.java:242)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
at au.com.three.hutchison.hss.service.HSSServiceFactory.narrow(Unknown Source)
at au.com.three.hutchison.hss.service.HSSServiceFactory.lookupHome(Unknown Source)
at au.com.three.hutchison.hss.service.HSSServiceFactory.getRemote(Unknown Source)
at au.com.three.hutchison.init.InitConfigInfoServlet.init(Unknown Source)
at weblogic.servlet.internal.ServletStubImpl$ServletInitAction.run(ServletStubImpl.java:1070)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.java:893)
at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImpl.java:842)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:782)
at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:3236)
The same code used to work fine before, but I had some class loader issues to resolve which i set the 'prefer-web-inf-classes' to true in the weblogic.xml of the WAR. However after that I started getting the ClassCastException problem..
Any Help Would be Hghly Appreciated
Thanks
Nitinhere's the weblogic-application.xml that i have used to specify different classloaders
<!DOCTYPE weblogic-application PUBLIC '-//BEA Systems, Inc.//DTD WebLogic Application 8.1.0//EN' 'http://www.bea.com/servers/wls810/dtd/weblogic-application_2_0.dtd'>
<weblogic-application>
<classloader-structure>
<module-ref>
<module-uri>hssWebApp.war</module-uri>
</module-ref>
<module-ref>
<module-uri>StaticInfoBean/StaticInfoBean.jar</module-uri>
</module-ref>
<module-ref>
<module-uri>HSSGWSBean/HSSGWSBean.jar</module-uri>
</module-ref>
</classloader-structure>
</weblogic-application> -
Hi,
I am trying to deploy ejb3.0 on weblogic 10 server. I am able to find the JNDI name of the stateless session bean correctly, but getting an exception while narrowing it down. My ejb3.0 client is a standalone java client. I am trying to access the stateless session ejb3.0 bean.Please help me. i have been trying it for many days.
thanks in advance,
Sanjeev
[sanpraka@localhost certEjb]$ java -cp ./:/usr/weblogic/bea/wlserver_10.0/server/lib/weblogic.jar:/usr/weblogic/bea/wlserver_10.0/server/lib/wlclient.jar com.titan.clients.Client
Object is weblogic.rmi.internal.BasicRemoteRef - hostID: '5337880647112897730S:127.0.0.1:[7001,7001,-1,-1,-1,-1,-1]:wl_server:examplesServer', oid: '302', channel: 'null'
java.lang.ClassCastException: Cannot narrow remote object weblogic.rmi.internal.BasicRemoteRef - hostID: '5337880647112897730S:127.0.0.1:[7001,7001,-1,-1,-1,-1,-1]:wl_server:examplesServer', oid: '302', channel: 'null' to com.titan.travelagent.TravelAgentRemote
at weblogic.corba.server.naming.ReferenceHelperImpl.narrow(ReferenceHelperImpl.java:206)
at weblogic.rmi.extensions.PortableRemoteObject.narrow(PortableRemoteObject.java:88)
at weblogic.iiop.PortableRemoteObjectDelegateImpl.narrow(PortableRemoteObjectDelegateImpl.java:32)
at javax.rmi.PortableRemoteObject.narrow(Unknown Source)
at com.titan.clients.Client.main(Client.java:24)
[sanpraka@localhost certEjb]$We have a similar problem. We have a web application (on server A) that invokes an EJB on a remote server (server B). This works fine, until we deploy another web application to server A at which point the existing web application starts to throw java.lang.ClassCastException when narrowing the remote EJB interface. The exception starts to be thrown at the moment the latter web application is deployed - start is not required.
The latter web application contains (actually in APP-INF/lib) the old version of the EJB remote interface, that somehow gets to be loaded into the classpath of the existing web application. The solution is to delete the old version of the EJB remote interface from APP-INF/lib of the latter web application (we didn't need it anyway), but it would be interesting to know in which circumstances classes can get mixed between enterprise applications.
I failed to reproduce the error in simple scenario, so this does not happen always. -
ClassCastException: com.evermind.server.ejb.EJBInputStream
Hello,
I am trying to use latest ocj4 (extened) to deploy the ejb.
I am getting following error
java.lang.ClassCastException:
com.evermind.server.ejb.EJBInputStream
Here is the part of code which calls a ejb method
Context ic = new InitialContext();
genObjectHome home = (genObjectHome)ic.lookup("genObjectEJB");
genObjectRemote ejb = (genObjectRemote)
PortableRemoteObject.narrow(home.create(),
genObjectRemote.class);
dataList = (genQueryDataObject) ejb.getGen();//*** Error occures
here
ejb.remove();
Application works ok on Weblogic.
Please provide any help or pointers to correct the problem.
Thanks a lot in advance.
Dhananjay ( [email protected])Hi Dhananjay,
I assume the code you have supplied is client code, correct? If
so, then what type of client is it -- web client or application
client? In any case, you will need to set some properties to be
used by the "InitialContext" object you are creating. Depending
on the type of client you are using, you would either set these
properties in the client code, or in one of the configuration
files. Configuration files are the things that are most different
between application servers, so the reason why your code works in
WebLogic and not OC4J is most probably due to the fact that you
need to modify your configuration settings. Have you looked at
the sample code on the Technet site? Have you looked through
Oracle's documentation for OC4J? Are you using JDeveloper?
I'm afraid that's all I can offer based on the information you
have supplied. Hope it helps.
Happy New Year,
Avi. -
Servlets/JDBC vs. servlets/EJB performance comparison/benchmark
I have a PHB who believes that EJB has no ___performance___ benefit
against straightforward servlets/JSP/JDBC. Personally, I believe that
using EJB is more scalable instead of using servlets/JDBC with
connection pooling.
However, I am at a lost on how to prove it. There is all the theory, but
I would appreciate it if anyone has benchmarks or comparison of
servlets/JSP/JDBC and servlets/JSP/EJB performance, assuming that they
were tasked to do the same thing ( e.g. performance the same SQL
statement, on the same set of tables, etc. ).
Or some guide on how to setup such a benchmark and prove it internally.
In other words, the PHB needs numbers, showing performance and
scalability. In particular, I would like this to be in WLS 6.0.
Any help appreciated.First off, whether you use servlets + JDBC or servlets + EJB, you'll
most likely spend much of your time in the database.
I would strongly suggest that you avoid the servlets + JDBC
architecture. If you want to do straight JDBC code, then it's
preferable to use a stateless session EJB between the presentation layer
and the persistence layer.
So, you should definitely consider an architecture where you have:
servlets/jsp --> stateless session ejb --> JDBC code
Your servlet / jsp layer handles presentation.
The stateless session EJB layer abstracts the persistence layer and
handles transaction demarcation.
Modularity is important here. There's no reason that your presentation
layer should be concerned with your persistence logic. Your application
might be re-used or later enhanced with an Entity EJB, or JCA Connector,
or a JMS queue providing the persistence layer.
Also, you will usually have web or graphic designers who are modifying
the web pages. Generally, they should not be exposed to transactions
and jdbc code.
We optimize the RMI calls so they are just local method calls. The
stateless session ejb instances are pooled. You won't see much if any
performance overhead.
-- Rob
jms wrote:
>
I have a PHB who believes that EJB has no ___performance___ benefit
against straightforward servlets/JSP/JDBC. Personally, I believe that
using EJB is more scalable instead of using servlets/JDBC with
connection pooling.
However, I am at a lost on how to prove it. There is all the theory, but
I would appreciate it if anyone has benchmarks or comparison of
servlets/JSP/JDBC and servlets/JSP/EJB performance, assuming that they
were tasked to do the same thing ( e.g. performance the same SQL
statement, on the same set of tables, etc. ).
Or some guide on how to setup such a benchmark and prove it internally.
In other words, the PHB needs numbers, showing performance and
scalability. In particular, I would like this to be in WLS 6.0.
Any help appreciated.--
Coming Soon: Building J2EE Applications & BEA WebLogic Server
by Michael Girdley, Rob Woollen, and Sandra Emerson
http://learnweblogic.com -
Best practice for Servlet EJB integration
I'm wondering what the best practice is for Servlet EJB integration in terms of
caching the home and remote objects. My understanding is that the Home object
is threadsafe and could therefore be cached as an attribute of the Servlet. This
would remove the need for a JNDI lookup for each request. Similarly caching the
ProxyObject would yield further savings. However, I have noticed that most examples
don't use either of these practices. Why not?
Thanks in advance,
Geordie
This has been answered repeatedly. WL allows you to cache JNDI context
objects, ejb homes and remotes without any problems. (EJB remote interfaces
must only be used by one thread at a time, but that requirement is provided
by the EJB spec itself.)
Peace,
Cameron Purdy
Tangosol, Inc.
http://www.tangosol.com
+1.617.623.5782
WebLogic Consulting Available
"Geordie" <[email protected]> wrote in message
news:3af9579f$[email protected]..
>
> I'm wondering what the best practice is for Servlet EJB integration in
terms of
> caching the home and remote objects. My understanding is that the Home
object
> is threadsafe and could therefore be cached as an attribute of the
Servlet. This
> would remove the need for a JNDI lookup for each request. Similarly
caching the
> ProxyObject would yield further savings. However, I have noticed that
most examples
> don't use either of these practices. Why not?
>
> Thanks in advance,
> Geordie
-
ClassCastException:class weblogic.servlet.internal.ROIDLookupImp
I am seeing this error in the application server logs. It does not indicate to
any application. I will greatly appreciate any help with this.
<RuntimeException thrown by rmi server(class weblogic.servlet.internal.ROIDLookupImpl)
weblogic.servlet.internal.ROIDLookupImpl@b9585e>
java.lang.ClassCastException
at weblogic.servlet.internal.ROIDLookupImpl.lookupROID(ROIDLookupImpl.java,
Compiled Code)
at weblogic.servlet.internal.ROIDLookup_WLSkel.invoke(ROIDLookup_WLSkel.java,
Compiled Code)
at weblogic.rmi.internal.BasicServerAdapter.invoke(BasicServerAdapter.java,
Compiled Code)
at weblogic.rmi.internal.BasicServerAdapter.invoke(BasicServerAdapter.java,
Compiled Code)
at weblogic.rmi.internal.BasicRequestHandler.handleRequest(BasicRequestHandler.java,
Compiled Code)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java,
Compiled Code)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java, Compiled
Code)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled Code)
Udit
If you are having a cluster, make sure all the servers are on the same set
of service packs.
-Sabha
"Udit Singh" <[email protected]> wrote in message
news:[email protected]...
>
> I am seeing this error in the application server logs. It does not
indicate to
> any application. I will greatly appreciate any help with this.
>
>
> <RuntimeException thrown by rmi server(class
weblogic.servlet.internal.ROIDLookupImpl)
> weblogic.servlet.internal.ROIDLookupImpl@b9585e>
>
> java.lang.ClassCastException
> at
weblogic.servlet.internal.ROIDLookupImpl.lookupROID(ROIDLookupImpl.java,
> Compiled Code)
> at
weblogic.servlet.internal.ROIDLookup_WLSkel.invoke(ROIDLookup_WLSkel.java,
> Compiled Code)
> at
weblogic.rmi.internal.BasicServerAdapter.invoke(BasicServerAdapter.java,
> Compiled Code)
> at
weblogic.rmi.internal.BasicServerAdapter.invoke(BasicServerAdapter.java,
> Compiled Code)
> at
weblogic.rmi.internal.BasicRequestHandler.handleRequest(BasicRequestHandler.
java,
> Compiled Code)
> at
weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java,
> Compiled Code)
> at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java,
Compiled
> Code)
> at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
Code)
>
> Udit
-
Hi,
What is that you are trying to accomplish ? Is it deployment or
trying to develop applications ? Are you getting any errors ? If so,
please post them to help you. I think the documentation is the best place
for you to begin with.
Regards & Happy New Year
Raj
Arif Khan wrote:
New To Iplanet app server.Can some one help me getting started by
delpoying and calling one of each of these:JSP,Servlet,EJB.Tried with
iplanet docs..didnt quite get it. thanx
Try our New Web Based Forum at http://softwareforum.sun.com
Includes Access to our Product Knowledge Base! -
Best way to see changes done to jsps/servlets/ejb/xmls in EAR
I am using iPlanet app server with iPlanet web server. Everytime i make any change jsp/servlet/ejb i have to redeploy whole ear application again. This takes a long time. Even when i use the "iasdeploy redployapp " command to deploy, it takes same amount of time as it takes for the orignal deployment.
So Is there any way to decrease the amount of the time it needs for me to re-deploy the applications when slight changes are made to application. I would really be thankful to anybody who can help me.Hi,
I am facing this problem with a simple EAR file also. It does not contain any EJBs.
It has just JSPs, XML, and JAVA Classes.
The file size is about 481Kb.
Earlier this used to get deployed using the "iasdeploy" command within 1 minute.
Now it is taking more than 5 minutes to deploy the EAR file.
I am using the following command :
iasdeploy deployapp -verbose XYZ.ear
The same holds true for the "iasdeploy removeapp -verbose XYZ.ear" also.
Please help.
Thanks,
Samar -
Problem configuring TassieDB database to work with JBoss Servlets + EJB app
Hi everybody
I have been unable to get Budi Kurniawan's Tassie Onine Bookstore example (
http://benmira.free.fr/en/j2ee/sessionEJB.htm#ch29lev1sec4) application to read anything from the database TassieDB . I am not sure what is wrong. I downloaded the database from the CD. Then since this was an older version of Access, I had to let my Access convert it to the newer form.
I then configured the Database the way I thought I should in order for it to work. I created a Data Source Name called TassieDB, by following the procedure to create a System DSN on Windows. I selected the Microsoft Access Driver and associated my Database which I named TassieDB1, which I deposited under C:\budibookstore which also contains the package com.brainysoftware.tassie.servlet.ejb
When I access the SearchServlet page and type in "Computer" in the search box nothing turns up. I wonder what is going on?
The following errors are spewed out by Apache in this process:
May 18, 2005 8:27:24 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Starting service Tomcat-Standalone
Apache Tomcat/4.1.31
May 18, 2005 8:27:28 PM org.apache.struts.util.PropertyMessageResources
INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=tru
e
May 18, 2005 8:27:28 PM org.apache.struts.util.PropertyMessageResources
INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNul
l=true
May 18, 2005 8:27:29 PM org.apache.struts.util.PropertyMessageResources
INFO: Initializing, config='org.apache.webapp.admin.ApplicationResources', retur
nNull=true
May 18, 2005 8:27:33 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
May 18, 2005 8:27:33 PM org.apache.jk.common.ChannelSocket init
INFO: JK2: ajp13 listening on /0.0.0.0:8009
May 18, 2005 8:27:33 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=10/150 config=C:\tomcatj\conf\jk2.properties
javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interf
aces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: o
rg.jnp.interfaces.NamingContextFactory]
javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interf
aces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: o
rg.jnp.interfaces.NamingContextFactory]
All help is gratefully acknowledged and accepted. Thanks in advanceHi
Did you notyfy the Exception ?
class not found Exception "org.jnp.interfaces.NamingContextFactory"
add these packages to your class path.
Vinoth -
Hi,
I have Oracle 9i installed. It comes bundled with Apache web server minus documentation. Can I deploy Servlets/ EJBs. on this. Where can i get hold of documentation.
ArunAre you using the SunONE portal server in your architecture? If your question is related to the Application server, you would find a greater chance of obtaining a solution through the web/app server forum.
-
Servlet, ejb, wls 510, ClassCastException
Hello,
I have an Entity Bean deployed in WLS 5.1.0.
I wrote a standalone application that obtains the initial context, does a
lookup, get back
a home interface, then the business interface (using narrow...), and calls
business methods...
Everything works fine...
BUT....
The SAME code within a servlet (doGET) does NOT work and throws a
ClassCastException.
Is there any issues using EJBs from Servlets?
Thank you a lot.
--Thierry
PS: Here is the code.
import javax.servlet.http.*;
import javax.servlet.*;
import javax.naming.*;
import javax.ejb.*;
import javax.rmi.*;
import org.zol.webstore.ejbs.person.*;
import java.util.*;
public final class TestServlet extends HttpServlet {
* Method init, called when the servlet is initialized
public void init(ServletConfig sc) throws ServletException {
System.err.println("@@@@@@@@@@@@ init "+sc);
* doPost
* @param req
* @param res
protected void doGet(HttpServletRequest req, HttpServletResponse res)
throws java.io.IOException {
ServletOutputStream sos = null;
System.err.println("@@@@@@@@@@@@ doGet ");
try{
sos = res.getOutputStream();
sos.println("<HTML><BODY>");
sos.println("Test "+new Date()+" <BR>");
InitialContext initialContext = getInitialContext();
System.err.println("@@@@@@@@@@@@ Got ic "+initialContext);
Object pO = initialContext.lookup("person.PersonEntityHome");
sos.println("<BR>pO: "+pO);
System.err.println("@@@@@@@@@@@@ Got Object PO ");
System.err.println("@@@@@@@@@@@@ Checking if we can narrow
PersonEntityHome");
Object toNarrow = PortableRemoteObject.narrow(pO,
PersonEntityHome.class);
System.err.println("@@@@@@@@@@@@ YES!!!");
PersonEntityHome pehome = (PersonEntityHome) toNarrow; // FAILS
sos.println("<BR>pehome: "+pehome);
System.err.println("@@@@@@@@@@@@ Got PE HOME ");
sos.println("</BODY></HTML>");
} catch (Exception eee) {
sos.println(eee.getMessage());
eee.printStackTrace();
public InitialContext getInitialContext() {
InitialContext ic = null;
try {
Hashtable h = new Hashtable();
h.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
h.put(Context.PROVIDER_URL, "t3://localhost:7001");
ic = new InitialContext(h);
} catch (Exception e) {
e.printStackTrace();
return ic;
Doesn't that mean that you can't hot deploy the EJB now?
-rrc
Thierry Janaudy wrote:
> Put the classes in the WEBLOGICCLASSPATH...
> And now it does work....
>
> Thank you Thierry,
>
> Your Welcome.
>
> Thierry
>
> Thierry Janaudy <[email protected]> wrote in message
> news:[email protected]...
> > Hello,
> >
> > I have an Entity Bean deployed in WLS 5.1.0.
> > I wrote a standalone application that obtains the initial context, does a
> > lookup, get back
> > a home interface, then the business interface (using narrow...), and calls
> > business methods...
> > Everything works fine...
> >
> > BUT....
> >
> > The SAME code within a servlet (doGET) does NOT work and throws a
> > ClassCastException.
> > Is there any issues using EJBs from Servlets?
> >
> > Thank you a lot.
> > --Thierry
> >
> > PS: Here is the code.
> > --------------------------------------------------------------------------
> --
> > ----------------
> >
> > import javax.servlet.http.*;
> > import javax.servlet.*;
> > import javax.naming.*;
> > import javax.ejb.*;
> > import javax.rmi.*;
> > import org.zol.webstore.ejbs.person.*;
> > import java.util.*;
> >
> > public final class TestServlet extends HttpServlet {
> >
> > /**
> > * Method init, called when the servlet is initialized
> > */
> > public void init(ServletConfig sc) throws ServletException {
> > System.err.println("@@@@@@@@@@@@ init "+sc);
> > }
> >
> > /**
> > * doPost
> > * @param req
> > * @param res
> > */
> > protected void doGet(HttpServletRequest req, HttpServletResponse res)
> > throws java.io.IOException {
> > ServletOutputStream sos = null;
> >
> > System.err.println("@@@@@@@@@@@@ doGet ");
> >
> > try{
> > sos = res.getOutputStream();
> >
> > sos.println("<HTML><BODY>");
> > sos.println("Test "+new Date()+" <BR>");
> >
> > InitialContext initialContext = getInitialContext();
> >
> > System.err.println("@@@@@@@@@@@@ Got ic "+initialContext);
> >
> > Object pO = initialContext.lookup("person.PersonEntityHome");
> > sos.println("<BR>pO: "+pO);
> >
> > System.err.println("@@@@@@@@@@@@ Got Object PO ");
> >
> > System.err.println("@@@@@@@@@@@@ Checking if we can narrow
> > PersonEntityHome");
> > Object toNarrow = PortableRemoteObject.narrow(pO,
> > PersonEntityHome.class);
> >
> > System.err.println("@@@@@@@@@@@@ YES!!!");
> >
> > PersonEntityHome pehome = (PersonEntityHome) toNarrow; // FAILS
> >
> > sos.println("<BR>pehome: "+pehome);
> >
> > System.err.println("@@@@@@@@@@@@ Got PE HOME ");
> >
> > sos.println("</BODY></HTML>");
> > } catch (Exception eee) {
> > sos.println(eee.getMessage());
> > eee.printStackTrace();
> > }
> > }
> >
> >
> > public InitialContext getInitialContext() {
> > InitialContext ic = null;
> >
> > try {
> > Hashtable h = new Hashtable();
> > h.put(Context.INITIAL_CONTEXT_FACTORY,
> > "weblogic.jndi.WLInitialContextFactory");
> > h.put(Context.PROVIDER_URL, "t3://localhost:7001");
> > ic = new InitialContext(h);
> > } catch (Exception e) {
> > e.printStackTrace();
> > }
> >
> > return ic;
> > }
> > }
> >
> >
Russell Castagnaro
Chief Mentor
SyncTank Solutions
http://www.synctank.com
Earth is the cradle of mankind; one does not remain in the cradle forever
-Tsiolkovsky
-
ClassCastException exception while running EJB Client
Folks,
I am getting following exception while running the EJB Client.. I am
using WLS 5.1
Exception in thread "main" java.lang.ClassCastException
at
javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:319)
at FirstStatelessEJBClient.Client.lookupHome(Client.java:149)
at FirstStatelessEJBClient.Client.<init>(Client.java:44)
at FirstStatelessEJBClient.Client.main(Client.java:82)
Can anybody throw a light on this.
Thanks
AshishHi Eduardo,
Below is my classpath. The stubs are in first_statlessSession.jar file.
CLASSPATH=C:\weblogic\myserver\first_statelessSession.jar;
C:\jdk1.2.2\lib\tools.jar;C:\weblogic\license;C:\weblogic\classes;C:\weblogi
c\lib\weblogicaux.jar;
C:\weblogic\myserver\clientclasses;C:\weblogic\myserver\serverclasses
Also, I am just compiling and deploying the
C:\weblogic\examples\ejb\basic\statelessSession myself and testing it. I
am
using the build.cmd files to compile and deploy the above EJB. If I use the
jars provided by weblogic it works fine with same above classpath.
I don't know what to do next. I have invested the whole day to solve this
problem and couldn't.
Please let me know if I am doing anything wrong.
Appreciate your help.
Thanks,
Ashish
Eduardo Ceballos wrote:
Try putting the stubs into the client class path.
"Ashish N. Shah" wrote:
Folks,
I am getting following exception while running the EJB Client.. I am
using WLS 5.1
Exception in thread "main" java.lang.ClassCastException
at
javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:319)
at FirstStatelessEJBClient.Client.lookupHome(Client.java:149)
at FirstStatelessEJBClient.Client.<init>(Client.java:44)
at FirstStatelessEJBClient.Client.main(Client.java:82)
Can anybody throw a light on this.
Thanks
Ashish -
Servlet / EJB Communication
Hello,
I have a very simple stateless session bean that I've developed for testing. A Client.java class gets the initial context, gets the home interface of the bean, creates the bean, and removes the bean, all without any problems. However, when I instantiate the same client class in a servlet that I've registered in the weblogic.properties file, I get a ClassCastException when the Client casts the Home interface stub into the home interface class. ??? Any idea why I can't successfully use an EJB from within the servlet?
Thanks in advance,
Sam
java.lang.ClassCastException: path.TestSessionBeanBeanHomeImpl_ServiceStub
Sam,
This is a common problem starting out developing in WebLogic with servlets
and EJBs. In the J2EE reference implementation and other servers, the WAR
and JAR both have to contain the home/remote interfaces, since the EJB in
the JAR needs them and the Servlets in the WAR need them. In WebLogic, to
support a call-by-reference optimization (and because of some problems in
the class loader design employed by WebLogic previous to v6), you must NOT
put them (home/remote) into the WAR file.
If you do not deploy as WAR and JAR, then just replace WAR with
"servletclasses" and replace JAR with "serverclasses" in the paragraph
above.
Peace,
Cameron Purdy
Tangosol, Inc.
http://www.tangosol.com
+1.617.623.5782
WebLogic Consulting Available
"Sam Eubanks" <[email protected]> wrote in message
news:[email protected]...
>
> Hello,
>
> I have a very simple stateless session bean that I've developed for
testing. A Client.java class gets the initial context, gets the home
interface of the bean, creates the bean, and removes the bean, all without
any problems. However, when I instantiate the same client class in a
servlet that I've registered in the weblogic.properties file, I get a
ClassCastException when the Client casts the Home interface stub into the
home interface class. ??? Any idea why I can't successfully use an EJB from
within the servlet?
>
> Thanks in advance,
> Sam
>
> java.lang.ClassCastException: path.TestSessionBeanBeanHomeImpl_ServiceStub
Maybe you are looking for
-
Error while updating the forecast value in M.Master through RMDATIND
Hi All Good Day In my custom Program I am using the three structures bgr00,bmm00,bmmh1 & bmmh3 and through rmdatind(Direct input method) program, i am trying to update the forecast value in material master data and i am getting error message as Spe
-
Vendor field on SRM Purchase Order
Hi. Please can someone elaborate and explain why my preferred supplier that I have entered onto my Cart does not copy through to the Vendor field on SRM Purchase Order please? At this moment, the Preferred Vendor field is incorrectly populated wherea
-
Go back from OS X 10.4.11 to 10.4.8
For some software compatibility related issue I have to go back from OS X 10.4.11 to 10.4.8 or even 10.4.6 How can I do this without having the Insllation DVD? Unfortunately I v lost the installation DVD that came with my laptop. Thanx Shiama
-
IPhone 5 I want to send photos as attachments NOT as embedded images
Until recently, when I sent a photo from my phone (using the share icon) via email, it would come through as an attachment, This was great, because then I could do what I wanted with the attachment. Now, since a day or so ago, all the photos I send
-
Can't set up Curve8530 email- denying my password
I just got my BlackBerry Curve 8530 a few days ago. Im a student at NC State and I am trying to hook my phone up to their email. Because our server is imap.gmail.com I enter my own settings. I enter my email address, password, the server as imap.gma