Access romote EJB using EJBTransport
I'm trying to access an ejb deployed in WLS 8.1 SP6 from ALSB 2.5 using the EJBTransport following the instructions conteined in http://e-docs.bea.com/alsb/docs25/userguide/ejbtransport.html#wp1074283
But... when I tried to register an ejb client jar resourse I got these conflicts:
java.lang.IncompatibleClassChangeError:class services.ClientesSrv_r155q8_HomeImpl_816_WLStub has interface weblogic.rmi.extensions.server.Stub as super class
java.lang.NoClassDefFoundError:weblogic/ejb20/interfaces/BaseEJBObjectIntf
The ejb client jar was generated using weblogic.appc. Any help would be really appreciated.
Thanks in advance, Paulo.
You need to remove the stub classes from the client jar. Those classes are meant for a standalone java client or another 8.1 server.
Gregory Haardt
ALSB Prg. Manager
[email protected]
Similar Messages
-
UNABLE TO ACCESS SECURED EJB USING IIOP FROM JSP
Following codes does not work with IIOP when called from jsp returns an
com.sap.engine.services.iiop.CORBA.CORBAObject:com.sap.engine.services.iiop.server.portable.Delegate_1_1@8312b1 step2 RemoteException occurred in server thread; nested exception is: java.rmi.RemoteException: com.sap.engine.services.ejb.exceptions.BaseRemoteException: User Guest does not have access to method create(). at
Following codes does not work with IIOP when called from a fat client returns an
org.omg.CORBA.UNKNOWN: vmcid: 0x0 minor code: 0 completed: Maybe
at com.sun.corba.se.internal.core.UEInfoServiceContext.<init>(UEInfoServ
iceContext.java:33)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
orAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at com.sun.corba.se.internal.core.ServiceContextData.makeServiceContext(
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.cosnaming.CNCtxFactory");
p.put(Context.PROVIDER_URL, "iiop://hostname:50007");
p.put(Context.SECURITY_PRINCIPAL, "User");
p.put(Context.SECURITY_CREDENTIALS, "pass");
I have add java option to add IIOP filer
-Dorg.omg.PortableInterceptor.ORBInitializerClass.com.sap.engine.services.iiop.csiv2.interceptors.SecurityInitializer
Solution Required: Could you please detail me what steps in need to perform in order for me to access secure ejb using iiop protocol.
FYI -- How ever ejb security works with P4 protocol, If required i can send you the test case ear.
Thanks
Vijay
Following are the server side logs
java.rmi.RemoteException: com.sap.engine.services.ejb.exceptions.BaseRemoteException: User Guest does not have access to method create().
at test.TestEJBHomeImpl0.create(TestEJBHomeImpl0.java:91)
at test._TestEJBHome_Stub.create(_TestEJBHome_Stub.java:214)
at jsp_testIIOP1199698887113._jspService(jsp_testIIOP1199698887113.java:33)
at com.sap.engine.services.servlets_jsp.server.jsp.JspBase.service(JspBase.java:112)
at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:544)
at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:186)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
Caused by: com.sap.engine.services.security.exceptions.BaseSecurityException: Caller not authorized.
at com.sap.engine.services.security.resource.ResourceHandleImpl.checkPermission(ResourceHandleImpl.java:608)
at com.sap.engine.services.security.resource.ResourceHandleImpl.checkPermission(ResourceHandleImpl.java:505)
at com.sap.engine.services.security.resource.ResourceContextImpl.checkPermission(ResourceContextImpl.java:45)
at test.TestEJBHomeImpl0.create(TestEJBHomeImpl0.java:89)
... 20 more
; nested exception is:
java.lang.SecurityException: com.sap.engine.services.security.exceptions.BaseSecurityException: Caller not authorized.
at com.sap.engine.services.security.resource.ResourceHandleImpl.checkPermission(ResourceHandleImpl.java:608)
at com.sap.engine.services.security.resource.ResourceHandleImpl.checkPermission(ResourceHandleImpl.java:505)
at com.sap.engine.services.security.resource.ResourceContextImpl.checkPermission(ResourceContextImpl.java:45)
at test.TestEJBHomeImpl0.create(TestEJBHomeImpl0.java:89)
at test._TestEJBHome_Stub.create(_TestEJBHome_Stub.java:214)
at jsp_testIIOP1199698887113._jspService(jsp_testIIOP1199698887113.java:33)
at com.sap.engine.services.servlets_jsp.server.jsp.JspBase.service(JspBase.java:112)
at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:544)
at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:186)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)That's the code that you need to execute but you should
probably encapsulate that code in Custom Action.
Orion has a EJB Tag Library that is free to distribute that
does all that stuff you just set some attributes.
Go to their site and look at their Tag Libraries.
Also look for other Tag Libraries Freely Available for EJB Access. -
How to access the ejb using WSIF
I have deployed my Bean Managed Persistance Entity Bean in Weblogic 8.1 App Server. Trying to access the ejb from Synchronous BPEL process using WSIF. I am getting following error
- WSIF0011I: Preferred port 'EJBPort' was not available
org.apache.wsif.WSIFException: Unable to find an available port
at org.apache.wsif.base.WSIFServiceImpl.getPort(Unknown Source)
at org.apache.wsif.base.WSIFServiceImpl.getPort(Unknown Source)
at com.test.wsif.RunInventory.main(RunInventory.java:55)
How to resolve the above said problem??
Here is my Inventory.wsdl file
<?xml version="1.0" ?>
<definitions targetNamespace="http://wsifservice.Inventory/"
xmlns:tns="http://wsifservice.Inventory/"
xmlns:typens="http://wsiftypes.addressbook.service.ejb/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:format="http://schemas.xmlsoap.org/wsdl/formatbinding/"
xmlns:ejb="http://schemas.xmlsoap.org/wsdl/ejb/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<!-- type defs -->
<types>
<xsd:schema
targetNamespace="http://wsiftypes.addressbook.service.ejb/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<xsd:complexType name="vecdetails">
<xsd:sequence>
<xsd:element name="make" type="xsd:string"/>
<xsd:element name="bodystyle" type="xsd:string"/>
<xsd:element name="model" type="xsd:string"/>
<xsd:element name="quantity" type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</types>
<!-- message declns -->
<message name="getInventoryRequestMessage">
<part name="vecdetails" type="typens:request"/>
</message>
<message name="getInventoryResponseMessage">
<part name="response" type="typens:response"/>
</message>
<!-- port type declns -->
<portType name="Inventory">
<operation name="getInventory">
<input name="getInventoryRequest" message="tns:getInventoryRequestMessage"/>
<output name="getInventoryResponse" message="tns:getInventoryResponseMessage"/>
</operation>
</portType>
<!-- binding declns -->
<binding name="EJBBinding" type="tns:Inventory">
<ejb:binding/>
<format:typeMapping encoding="Java" style="Java">
<format:typeMap typeName="xsd:string" formatType="java.lang.String" />
</format:typeMapping>
<operation name="getInventory">
<ejb:operation
methodName="getInventory"
parameterOrder="make bodystyle model quantity"
interface="remote" returnPart="response" />
<input name="getInventoryRequest"/>
<output name="getInventoryResponse"/>
</operation>
</binding>
<!-- service decln -->
<service name="InventoryService">
<port name="EJBPort" binding="tns:EJBBinding">
<!-- Put vendor-specific deployment information here -->
<ejb:address className="com.poc.inventoryejb.InventoryHome"
jndiName="Inventory"
initialContextFactory="weblogic.jndi.WLInitialContextFactory"
jndiProviderURL="t3://localhost:7001"/>
</port>
</service>
</definitions>Try to restart BPEL Server. When I tested WSIF Bindings I had to restart server after every changes in WSIF WSDL.
Alexey. -
Hello everyone,
I developed a Web Service prototype accessing remote EJB using the EJB
control with special syntax in the jndi-name attribute: @jws:ejb
home-jndi-name="t3://10.10.245.70:7131/AccountDelegatorEJB"
Everything works fine, but I get an error when I restrict access to my web
service with a declarative security model by implementing steps provided in
help doc:
- Define the web resource you wish to protect
- Define which security role is required to access the web resource
- Define which users are granted the required security role
- Configure WebLogic Server security for my web service(Compatibility
Security/Users)
I launch the service by entering the address in a web browser. When prompted
to accept the digital certificate, click Yes, when prompted for network
authentication information, enter username and password, navigate to the
Test Form tab of Test View, invoke the method by clicking the button and I
get the following exception:
<error>
<faultcode>JWSError</faultcode>
<faultstring>Error during JNDI lookup from
jndi:t3://10.10.245.70:7131/AccountDelegatorEJB[Lookup failed for
name:t3://10.10.245.70:7131/AccountDelegatorEJB]</faultstring>
<detail>
<jwErrorDetail> weblogic.jws.control.ControlException: Error during JNDI
lookup from jndi:t3://10.10.245.70:7131/AccountDelegatorEJB[Lookup failed
for name:t3://10.10.245.70:7131/AccountDelegatorEJB] at
weblogic.knex.control.EJBControlImpl.acquireResources(EJBControlImpl.java:27
8) at
weblogic.knex.context.JwsInternalContext.acquireResources(JwsInternalContext
.java:220) at
weblogic.knex.control.ControlHandler.invoke(ControlHandler.java:260) at
ibas.AccountControl.getTransactionHistory(AccountControl.ctrl) at
ibas.GetSecure.retrieveVisaHistoryTxn(GetSecure.jws:64) </jwErrorDetail>
</detail>
</error>
I have a simple Hello method as well in my WebService (which is also
restricted) and it works fine, but remote EJB access doesn't. I tested my
prototype on Weblogic 7.2 and 8.1 platforms - same result.
Is that a bug or I am missing some additional configuration in order to get
that working. Has anyone seen similar behavior? Is there a known resolution?
Or a suggested way to work around the problem?
Thank you.
AndreAndre,
It would be best if this issue is handled as an Eval Support case. Please
BEA Customer Support at http://support.beasys.com along with the required
files, and request that an Eval support case be created for this issue.
Thanks
Raj Alagumalai
WebLogic Workshop Support
"Andre Shergin" <[email protected]> wrote in message
news:[email protected]...
Anurag,
I removed "t3", still get an error but a different one (Unable to create
InitialContext:null):
<error>
<faultcode>JWSError</faultcode>
<faultstring>Error during JNDI lookup from
jndi://secuser1:[email protected]:7131/AccountDelegatorEJB[Unable to
create InitialContext:null]</faultstring>
<detail>
<jwErrorDetail> weblogic.jws.control.ControlException: Error during JNDI
lookup from
jndi://secuser1:[email protected]:7131/AccountDelegatorEJB[Unable to
create InitialContext:null] at
weblogic.knex.control.EJBControlImpl.acquireResources(EJBControlImpl.java:27
8) at
weblogic.knex.context.JwsInternalContext.acquireResources(JwsInternalContext
.java:220) at
weblogic.knex.control.ControlHandler.invoke(ControlHandler.java:260) at
ibas.AccountControl.getTransactionHistory(AccountControl.ctrl) at
ibas.GetVisaHistoryTransactions.getVisaHistoryTxn(GetVisaHistoryTransactions
.jws:67) </jwErrorDetail>
</detail>
</error>
Note: inter-domain communication is configured properly. The Web Service to
remote EJB works fine without a declarative security.
Any other ideas?
Thank you for your help.
Andre
"Anurag" <[email protected]> wrote in message
news:[email protected]...
Andre,
It seems you are using the URL
jndi:t3://secuser1:[email protected]:7131/AccountDelegatorEJB
whereas you should not be specifying the "t3:" protocol.
The URL should be like
jndi://secuser1:[email protected]:7131/AccountDelegatorEJB
Please do let me know if you see any issues with this.
Note that this will only allow you to access remote EJBs in the same WLS
domain. For accessing EJBs on another domain, you need to configure
inter-domain communication by
following a few simple steps as mentioned at
http://e-docs.bea.com/wls/docs81/ConsoleHelp/jta.html#1106135. This link has
been provided in the EJB Control Workshop documentation.
Regards,
Anurag
"Andre Shergin" <[email protected]> wrote in message
news:[email protected]...
Raj,
I tried that before, it didn't help. I got similar error message:
<error>
<faultcode>JWSError</faultcode>
<faultstring>Error during JNDI lookup from
jndi:t3://secuser1:[email protected]:7131/AccountDelegatorEJB[Lookup
failed for
name:t3://secuser1:[email protected]:7131/AccountDelegatorEJB]</faultstr
ing>
<detail>
<jwErrorDetail> weblogic.jws.control.ControlException: Error during JNDI
lookup from
jndi:t3://secuser1:[email protected]:7131/AccountDelegatorEJB[Lookup
failed for
name:t3://secuser1:[email protected]:7131/AccountDelegatorEJB] at
weblogic.knex.control.EJBControlImpl.acquireResources(EJBControlImpl.java:27
8) at
weblogic.knex.context.JwsInternalContext.acquireResources(JwsInternalContext
.java:220) at
weblogic.knex.control.ControlHandler.invoke(ControlHandler.java:260) at
ibas.AccountControl.getTransactionHistory(AccountControl.ctrl) at
ibas.GetSecure.retrieveVisaHistoryTxn(GetSecure.jws:64) </jwErrorDetail>
</detail>
</error>
Anything else should I try?
P.S. AccountDelegatorEJB, the remote EJB my Web Service calls is NOTaccess
restricted.
I hope there is a solution.
Thanks,
Andre
"Raj Alagumalai" <[email protected]> wrote in message
news:[email protected]...
Andre,
Can you try using the following url with username and password
jndi://username:password@host:7001/my.resource.jndi.object ?
once you add webapp level security, the authenticated is the user who
invokes the EJB.
http://e-docs.bea.com/workshop/docs81/doc/en/workshop/guide/controls/ejb/con
CreatingANewEJBControl.html?skipReload=true
has more info on using remote EJB's.
Hope this helps.
Thanks
Raj Alagumalai
WebLogic Workshop Support
"Alla Resnik" <[email protected]> wrote in message
news:[email protected]...
Hello everyone,
I developed a Web Service prototype accessing remote EJB using the EJB
control with special syntax in the jndi-name attribute: @jws:ejb
home-jndi-name="t3://10.10.245.70:7131/AccountDelegatorEJB"
Everything works fine, but I get an error when I restrict access to my
web
service with a declarative security model by implementing steps
provided
in
help doc:
- Define the web resource you wish to protect
- Define which security role is required to access the web resource
- Define which users are granted the required security role
- Configure WebLogic Server security for my web service(Compatibility
Security/Users)
I launch the service by entering the address in a web browser. Whenprompted
to accept the digital certificate, click Yes, when prompted for
network
authentication information, enter username and password, navigate tothe
Test Form tab of Test View, invoke the method by clicking the buttonand
I
get the following exception:
<error>
<faultcode>JWSError</faultcode>
<faultstring>Error during JNDI lookup from
jndi:t3://10.10.245.70:7131/AccountDelegatorEJB[Lookup failed for
name:t3://10.10.245.70:7131/AccountDelegatorEJB]</faultstring>
<detail>
<jwErrorDetail> weblogic.jws.control.ControlException: Error during
JNDI
lookup from jndi:t3://10.10.245.70:7131/AccountDelegatorEJB[Lookupfailed
for name:t3://10.10.245.70:7131/AccountDelegatorEJB] at
weblogic.knex.control.EJBControlImpl.acquireResources(EJBControlImpl.java:27
8) at
weblogic.knex.context.JwsInternalContext.acquireResources(JwsInternalContext
.java:220) at
weblogic.knex.control.ControlHandler.invoke(ControlHandler.java:260)at
ibas.AccountControl.getTransactionHistory(AccountControl.ctrl) at
ibas.GetSecure.retrieveVisaHistoryTxn(GetSecure.jws:64)</jwErrorDetail>
</detail>
</error>
I have a simple Hello method as well in my WebService (which is also
restricted) and it works fine, but remote EJB access doesn't. I testedmy
prototype on Weblogic 7.2 and 8.1 platforms - same result.
Is that a bug or I am missing some additional configuration in order
to
get
that working. Has anyone seen similar behavior? Is there a knownresolution?
Or a suggested way to work around the problem?
Thank you.
Andre -
IllegalArgumentException while accessing an EJB with a servlet client
Dear All,
Hey,
I am facing some problems while accessing a deployed stateless ejb. Following is how my application is being accessed:
WEBAPP CLIENT
caller.html ------->> DisplayServletClient --------->> DisplayServlet
(Simple HTML Page) (Servlet which performs lookup) (The actual bean)
CONSOLE CLIENT
DisplayConsoleClient --------->> DisplayServlet
(Simple Console Client) (The actual bean)
I am using the J2EE reference implementation, the ejb bean is successfully deployed. The console client successfully, access the ejb. But when I try to access the ejb using the webapp client, I get the following exception:
======= EXCEPTION ENCOUNTERED ============
Application DisplayApp deployed.
Servlet Entered
HTML Content Type Set
PrintWriter Object Created
Context Object Created
Exception in Servlet Client Code: java.lang.IllegalArgumentException: Unknown co
mponent type
java.lang.IllegalArgumentException: Unknown component type
at com.sun.enterprise.naming.NamingManagerImpl.getComponentType(NamingMa
nagerImpl.java:670)
at com.sun.enterprise.naming.NamingManagerImpl.getMangledIdName(NamingMa
nagerImpl.java:708)
at com.sun.enterprise.naming.NamingManagerImpl.getComponentIdInternal(Na
mingManagerImpl.java:680)
at com.sun.enterprise.naming.NamingManagerImpl.getComponentId(NamingMana
gerImpl.java:313)
at com.sun.enterprise.naming.java.javaURLContext.getComponentContext(jav
aURLContext.java:397)
at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.j
ava:51)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at DisplayServletClient.service(DisplayServletClient.java:27)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServl
et.java:428)
at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java
:180)
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(Appl
icationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.access$0(ApplicationF
ilterChain.java:197)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilt
erChain.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:172)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:215)
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.jav
a:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
2314)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:164)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.ja
va:368)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:163)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcesso
r.java:995)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.ja
va:1088)
at java.lang.Thread.run(Thread.java:484)
======== EXCEPTION END ===========
Tweaking with the servlet client code, I have discovered that it is failing to perform a correct lookup. Can anybody suggest any remedy? My Source code is below:
=========================================================
============ Remote Interface START ==============
// The DisplayApp Remote Interface File
import javax.ejb.*;
import java.rmi.*;
public interface Display extends EJBObject
public String display() throws RemoteException;
============ Remote Interface END ==============
============ Home Interface START ==============
// The DisplayApp Home Interface File
import javax.ejb.*;
import java.rmi.*;
public interface DisplayHome extends EJBHome
public Display create() throws RemoteException, CreateException;
============ Home Interface END ==============
============ Bean Class START ==============
// The DisplayApp Bean Class File
import javax.ejb.*;
import java.rmi.*;
public class DisplayBean implements SessionBean
public String display() throws RemoteException
System.out.println("The Server Side Response");
return "Hello, Me a New Friend";
public void ejbCreate(){}
public void ejbRemove(){}
public void ejbActivate(){}
public void ejbPassivate(){}
public void setSessionContext(SessionContext ctx){}
============ Bean Class END ==============
========== Console Client Class START ======
// The Display Console Client Class File
import javax.ejb.*;
import javax.rmi.*;
import javax.naming.*;
import Display;
import DisplayHome;
public class DisplayConsoleClient
public DisplayConsoleClient()
try
Context initial=new InitialContext();
Object objref=initial.lookup("java:comp/env/DisplayJNDI");
DisplayHome home=(DisplayHome)PortableRemoteObject.narrow(objref, DisplayHome.class);
Display ref=home.create();
System.out.println("Client Side: "+ref.display());
ref.remove();
catch(Exception ex)
System.out.println("Exception in Client Code: "+ex);
ex.printStackTrace();
public static void main(String args[])
new DisplayConsoleClient();
========== Console Client Class END ======
========== Servlet Client Class START ======
// The DisplayApp Servlet Client Class File
import javax.ejb.*;
import javax.rmi.*;
import javax.naming.*;
import Display;
import DisplayHome;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class DisplayServletClient extends HttpServlet
private PrintWriter out;
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
try
System.out.println("Servlet Entered");
response.setContentType("text/html");
System.out.println("HTML Content Type Set");
out=response.getWriter();
System.out.println("PrintWriter Object Created");
Context initial=new InitialContext();
System.out.println("Context Object Created");
Object objref=initial.lookup("java:comp/env/ejb/DisplayWEBJNDI");
System.out.println("Lookup Done Successfully");
DisplayHome home=(DisplayHome)PortableRemoteObject.narrow(objref, DisplayHome.class);
System.out.println("Home Object Created");
Display ref=home.create();
System.out.println("Remote Object Created");
out.println("<html><title>The Results Page</title>");
out.println("<body<hr>");
out.println("<h1>The Client Side Response is: ");
out.println(ref.display());
out.println("</h1>");
out.println("<hr>");
out.println("</body></html>");
System.out.println("Responses Done");
out.flush();
System.out.println("Output Stream Flushed");
ref.remove();
System.out.println("Remote Object Removed");
catch(Exception ex)
System.out.println("Exception in Servlet Client Code: "+ex);
ex.printStackTrace();
========== Servlet Client Class END ======
========== Calling HTML File START ======
<html>
<body>
<hr>
<form method="get" action="/servlet/DisplayServletClient">
<input type="submit" name="submit" value="Call Now!">
</form>
<hr>
</body>
</html>
========== Calling HTML File END ======
=========================================================
Since, the descriptors were automatically generated, I have not included them here. Also, I did not build the war, jar, ear files myself, they were automatically generated by the deploytool.
Please help!!
Thanks & Bye,
Tualha KhanHey,
This was the latest code snippet which I used in the Servlet file.
========================
try
System.out.println("Servlet Entered");
response.setContentType("text/html");
System.out.println("HTML Content Type Set");
out=response.getWriter();
System.out.println("PrintWriter Object Created");
InitialContext initial=new InitialContext();
System.out.println("Context Object Created");
Object objref=initial.lookup("DisplayWEBJNDI");
System.out.println("Lookup Done Successfully");
DisplayHome home=(DisplayHome)PortableRemoteObject.narrow(objref, DisplayHome.class);
System.out.println("Home Object Created");
Display ref=home.create();
System.out.println("Remote Object Created");
out.println("<html><title>The Results Page</title>");
out.println("<body<hr>");
out.println("<h1>The Client Side Response is: ");
out.println(ref.display());
out.println("</h1>");
out.println("<hr>");
out.println("</body></html>");
System.out.println("Responses Done");
out.flush();
System.out.println("Output Stream Flushed");
ref.remove();
System.out.println("Remote Object Removed");
========================
The Response was
========================
Servlet Entered
HTML Content Type Set
PrintWriter Object Created
Context Object Created
Exception in Servlet Client Code: javax.naming.NameNotFoundException: DisplayWEB
JNDI not found
javax.naming.NameNotFoundException: DisplayWEBJNDI not found
<<no stack trace available>>
========================
So what else should I do???
Thanks & Waiting,
Tualha Khan -
Using service Locator pattern to dynamically access remote EJBs
Hi All,
Please help to guide me how I can use a service locator to retrieve a remote object (residing on another application but on same domain) .
I do not want to use Dependency Injection since I want to dynamically discover them ( there are many implementations of same interface (POJO)). Each EJB implementation implements its own remote/local interface that extends this global POJO interface.
I have two J2ee-Applications on same domain. J2EE-Application 1 has an EJB module (EJB Module 1) that intends to access an EJB Module (EJB Module 2) in J2EE-Application 2. Following observations:
1. Dependency Injection fails if (include the EJB Module 2 jar in J2EE-Application 1). Reason App Server complains the EJB has been deployed (Deployment fails)
2. Dependency Injection works if (exclude the EJB Module 2 jar in J2EE-Application 1) and include the Remote Interface in EJB Module 1(J2EE-Application 1).Positive Observation (Deployment success and DI also success)
3.Using Service Locator to retrieve the remote object if (exclude the EJB Module 2 jar in J2EE-Application 1) and include the Remote Interface in EJB Module 1(J2EE-Application 1). Negative and Positive Observation.
Positive Observation: Using dependency injection I can still retrieve the Remote Object
Another Positive: The Service Locator remote lookup to another Bean in same Application but different EJB Module is successful.
Negative Observation:
The Service Locator lookup to this same remote object with Successful Dependency Injection fails (An Ejb in a different application).
Can't retrieve the Remote Object with Service Locator. Message from Server:.
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.
Thanks in advance"I do not want to use Dependency Injection since I want to dynamically discover them ( there are many implementations of same interface (POJO))"
If you're calling ejbs from other ejbs or servlets, the same could probably be acomplished by using dependency injection (@EJB) in a number of instance variables typed with different remote/local interfaces or even with different beanName attributes (for when more than one bean implements the same managed interface in the same app - not sure how it works outside the same jee app...) , and dinamically selecting one of them; or encapsulating those injected variables into a stateless ejb as your service locator to make them accessible from POJOs too (which, due to concurrent acess, wouldn't work for statefull ejbs references...).
Anyway, using the jndi lookup service locator pattern seems ok in this case.
What doesn't seem ok, given the nature of the error for the negative observation - jndi context initialization - is that
Another Positive: The Service Locator remote lookup to another Bean in same Application but different EJB Module is successful.
Can you check your code and reconfirm that you're using the same context initialization code for both the positive and negative observations ? -
How to access an EJB from a web application deployed in the same server
Hey All,
I deployed an EJB named EventServerBean to Sun Application Server 9.0, and put the client side jar file (named eventserver.jar which is generated by Sun Application Server) to C:\Sun\AppServer\lib. Now, I have a web application which is a simple jave file -- lookup EventServer EJB and invoke a remote method in this EJB. However, the web application always throws an exception "java.lang.NoClassDefFoundError: eventserver/EventServerRemoteHome"
Here is my java class that access the ejb:
public class Post_Event {
public HashMap<String, String> getEventInfo(String event_name, String site) {
System.out.println("Post_Event, the class path: " + System.getProperty("java.class.path"));
System.out.println("Post_Event, user.dir: " + System.getProperty("user.dir"));
System.out.println("Post_Event, java.library.path: " + System.getProperty("java.library.path"));
HashMap<String, String> result = null;
EventServerRemote remote = null;
StringTokenizer st, st2;
// here get the event information from host
try {
String lookupStr = "corbaname:iiop:" + site + ":3700#ejb/EventServerBean";
InitialContext initialContext = new InitialContext();
EventServerRemoteHome remoteHome = (EventServerRemoteHome) javax.rmi.PortableRemoteObject.narrow(initialContext.lookup(lookupStr), EventServerRemoteHome.class);
if (remoteHome != null) {
remote = remoteHome.create();
} catch (javax.naming.NamingException ne) {
ne.printStackTrace();
return null;
} catch (javax.ejb.CreateException ce) {
ce.printStackTrace();
return null;
} catch (java.rmi.RemoteException re) {
re.printStackTrace();
return null;
} catch (java.io.IOException ioe) {
ioe.printStackTrace();
return null;
System.out.println("look up remote event server successfully.");
result = remote.getEvent(event_name);
return result;
} I output the class path in this java file, and the class path DOES include the path C:\Sun\AppServer\lib where eventserver\EventServerRemoteHome.class is.
Does anyone know why it happens? Why a java class can't find a class that is in its class path?
appreciate any help!<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Wael Abbas ([email protected]):
Thank you for your great topic.
I think you need to copy the snippet code and past it to every application, applet, servlet or JSP every time you need to use your EJB.
Its better to include this snippet code in a simple JavaBean and use this bean as a bridge to your EJB, you may include a connect method in your JavaBean or but the connection code in the constructor and include a setters, getters and other methods to encapsulate your EJB methods.
You can use your JavaBean in any application, applet, servlet or JSP just create an object form it and call its methods.
Its just an idea
I hope it will be useful.
<HR></BLOCKQUOTE>
null -
(261936172) Q general How can I access an EJB hosted on a remote server?
Q<general> How can I access an EJB hosted on a remote server?
A<general> The ability to add EJB control files enables you to access an EJB that
is deployed to the server on which your web service is running. When you select
"add EJB control" you need to supply the home and remote interfaces for the EJB
as well as the JNDI name. This does not provide you with the capability for creating
a control for a remotely hosted EJB. To use a EJB hosted on another server you
will have to provide the appropriate code within your web service itself. You
will have to programmatically gain to access the JNDI for the remote server, lookup
up the home stub and use it to create the remote stub for the EJB. Of course,
to make this work you must have the necessary client interfaces in you classpath
(home and remote interfaces) which can easliy be achieved by adding the EJB client.jar
file to the lib directory in the webservice WEB-INF folder.just define the different server path in the description xml file
<jndi-name>jnp://serverA(B)/....</jndi-name> -
How can i access the EJB from a Webdynpro
Dear all,
How can i access the ejb , from a webdynpro?.
Is there any way to do that?.
I want to write the entire code (business functions) within the EJB and i wan to access the entire methods from a WebDynpro Application.This is the situation.
Please help me to , resolve this problem.(Here im using JDBC Connection .. etc.).
I want to do the basic connection setting's and data retrieval part within the EJB and use that within the WebDynpro..
how can i seperate this two(i mean, i want to seperate the JDBC connections and WebDynpro,i dont want to hard code any connection parameters within the webdynpro code)
So that i want use that saet of particular function's in many webdynpro applications..
(i dont need any help regarding webservice way.)
If anyone can , please help me..
I tried that javabean class , manifest file , that way (importing javabean model).
but im getting errors.
I cant properly utilize that..
So please help me with steps regarding that,,
for javabean
and if any , for EJB also..
with regards
Kishor.GHI,
Since webdynpros follows Model View Controller Architecture You can access EJBs in webdynpro(views/frontend) infact to connec to database uding JDBC you have to utilise EJB ( opening connection to database closing, and other Business functionality).See this link
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/unkown/web dynpro tutorial and sample applications.faq#q-7
<b>How to access the Car Rental Web Service?</b>
Regards,
RK -
I am trying to access an EJB on a remote server using the following code:
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.cosnaming.CNCtxFactory");
env.put(Context.PROVIDER_URL,
"iiop://190.30.123.34:1050");
InitialContext initial = new InitialContext(env);
Context environment (Context)initial.lookup("java:comp/env");
Object ref = environment.lookup("ejb/lands.mc.bus.TopoMap");
home = (TopoMapHome) PortableRemoteObject.narrow(ref, TopoMapHome.class);I have the following entry in my web.xml:
<ejb-ref>
<ejb-ref-name>ejb/lands.mc.bus.TopoMap</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>lands.mc.bus.TopoMapHome</home>
<remote>lands.mc.bus.TopoMap</remote>
</ejb-ref>But when ever i perform the environment lookup, i get the following error:
javax.naming.NamingException: Cannot create resource instance
When i print out the bindings, the TopoMap binding is present.
Can anyone suggest what i might be doing wrong?
Thanks
tobyTried that, gives me this error:
javax.naming.NameNotFoundException: Name lands.mc.bus.TopoMap is not bound in this ContextIf i change
env.put(Context.PROVIDER_URL,"iiop://190.30.123.34:1050");To a non existent URL, tells me it cant connect to the ORB, so its definitly connecting properly. I also noticed that when i print out the bindings, it prints out only those that are in my web.xml file for the tomcat server, not the bindings that are on 190.30.123.34 (J2EE server).
Any other suggestions?
Thanks,
Toby -
How can I access an EJB in JBoss Server?
I'm using JBoss 3.0.3 and I have two Jboss servers. I trying access an EJB Entity in B by an Session in machine A. What should I do for it?
just define the different server path in the description xml file
<jndi-name>jnp://serverA(B)/....</jndi-name> -
I use oc4j in jdeveloper 10G in access a remote EJB using
sample java client both of EJB and java client on MY COMPUTER
AS SERVER I THINK I HAVE PROBLEM IN SETTING CLASS PATHS
I HAVE DOWNLOAD J2EE SDK VER 1.3.1 AND I ASSIGN MY CLASSPATHS
AS FOLLOWS:
C:\java_course1\jdbc\lib\classes12.jar;C:\java_course1\jdbc\lib\nls_charset12.jar; c:\java_course1\j2ee\home\lib;c:\java_course1\lib\ ; C:\J2Sdkee1.3.1\lib\j2ee.jar
java_course1 is folder of jdeveloper
j2Sdkee.1.3.1 is J2EE SDK VER 1.3.1
the code i have written in java client
env.put(Context.INITIAL_CONTEXT_FACTORY,"RMIInitialContextFactory");
env.put(Context.SECURITY_PRINCIPAL, "admin");
env.put(Context.SECURITY_CREDENTIALS, "welcome");
env.put(Context.PROVIDER_URL, "ormi://localhost:23893/current-workspace-app");
Context context = new javax.naming.InitialContext(env);
EmpHome empHome = (EmpHome)PortableRemoteObject.narrow(context.lookup("EmpHome"), EmpHome.class);
I get the following error message
javax.naming.NoInitialContextException: Cannot instantiate class: RMIInitialContextFactory [Root exception is java.lang.ClassNotFoundException: RMIInitialContextFactory]
Is Someting is missed in class pathes or should i copy j2ee.jar file from
C:\J2Sdkee1.3.1\lib\j2ee.jar to oc4j folderThank you for useful information i found in site
But if you help me if defintions of class passes i have assigned and
show in my message are correct or I have missed something weather
in class paths or environment variables
Again Thanks a lot -
How to write the jndi lookup for ejb using oc4j server in jdeveloper
Hi All,
i am new to the JDeveloper. i want to develop the session bean in JDeveloper using the OC4J server. how to write the jndi lookup in cllient. what are the xml files need to deploy the application. where can i mention the JNDI name in xml file. so please provide the information as soon as possible.
regards
ramThere is quite in-depth information in the Enterprise JavaBeans Developer's Guide.
Section 2 (Understanding EJB Application Development) explains the xml files needed and Section 29 (Accessing an EJB from a Client) explains how to do a JNDI lookup.
Hope this helps. -
Problems looking up EJBs using MDBs in iAS 6.5
Here is an interesting appserver behavior I have observed on 6.5.
1. bring down appserver
2. send 5 messages to the queue.
3. start appserver. MDB gets created and initialized to process messages
from the queue. Since my MDB needs to access other EJBs it will get
NameNotFoundException. This happens before my EJBs are loaded. In
onMessage() of my MDB I catch Exception and roll back transaction. Messages
will remain in the queue. MDB is sleeping.
4. Point my browser to access my application. AppServer now loads my EJBs.
Now I send the 6th message to the queue.
5. MDB receives the 6th message and is able to lookup other EJBs. Everything
works fine and the message is eventually removed from the queue.
6. Query the queue. It shows you there are 5 messages in the queue. MDB is
still sleeping.You can only successfully lookup EJBs in the current iAS MDB implementation in
the onMessage() callback - the lookups fail if you try to perform them in the
setMessageDrivenBeanContext() or ejbCreate() methods - defect has been filed for
this as it is a violation of the spec pertaining to MDBs.
I've still got to file a defect for the Transactional issue I've been
sidetracked working on other P1 issues and I don't have a customer whose gone
this far with MDBs todate, I am assuming you are using Container Managed
Transactions with your MDB.
I've successfully sent messages to both a Queue and a Topic (using durable
subscription) and had queued messsages delivered once iAS had been restarted. -
(264361962) Q ADVC-27 How do you pass the security info to access the EJB?
Q<ADVC-27> How do you pass the security info to access the EJB?
A<ADVC-27> Authentication for web service users must occur at the web layer. This
means providing appropriate web resource definitions and restrictions in the web.xml
file for your project. The most common and useful form of security for application
interaction is via client-side certificates. Then the client identity is transmitted
to the EJB is the same way as in regular J2EE environments. There is a complete description
on security on e-docs:
http://edocs.bea.com/workshop/docs70/help/guide/security/ovwSecurity.html
AdamYou need to ask Apple to reset your security questions. To do this, click here and pick a method; if that page doesn't list one for your country or you're unable to call, fill out and submit this form.
(119093)
Maybe you are looking for
-
Alpha channel showing in preview
If I import a .psd file that has an alpha channel, it shows in the preview. Does anyone know how I can eliminate the alpha channel in the preview. iView has a specific option for this but I can't seem to find anything similar in Aperture.
-
Can't see objects from all db schemas in AV when creating a FGA Policy
Hi all, I have installed Audit Vault successfully but when I try to create a FGA policy, in the Object field the objects from certain schemas don't appear in the list. I tried to verify if the user that the Agent uses to connect to the source databas
-
E-mail accts have stopped updating
As of lastTuesday (09/25) e-mail accts have stopped updating and have a continous "updating" comment
-
How to stop the transaction in a server override
Hi, I have created a server override S_TieFolder. In the extendedPostAddItem method I call a database procedure. This procedure returns a boolean value (success : true/false). When the procedure returns the false value, I want to stop the item from b
-
I am getting an error message 5G 155: If NI Number is unknown, both Date of birth and Gender must be entered We have decided not to maintain NI, but the Gender for some employees is also Unknown. This error message seems to be hard coded by SAP, any