How to connect to remote EJB 3.0 deployed on Glassfish from ADF application
Hello, as we haven't managed to deploy ADF app with EJB 3.0 on Glassfish AS, nor on tomcat 6 with openEJB, nor on JBOSS 5GA, we're trying to deploy our app with remote interface on tomcat 6. We're using ADF, JSF and EJB 3.0 (Eclipselink as JPA).
When the model project is deployed on WLS 10.3, everything works fine. Here is a part from DataControls.cpx
<Source>
<ejb-definition ejb-version="3.0" ejb-name="MySession"
ejb-type="Session"
ejb-business-interface="model.MySession"
ejb-interface-type="remote"
jndi-name="MySessionBean#model.MySession"
provider-url="t3://localhost:7001"
initial-context-factory="weblogic.jndi.WLInitialContextFactory"
xmlns="http://xmlns.oracle.com/adfm/adapter/ejb"
DataControlHandler="oracle.adf.model.adapter.bean.jpa.JPQLDataFilterHandler"/>
</Source>Now the model project is deployed on Glassfish 2. I had to change DataControls.cpx
<Source>
<ejb-definition ejb-version="3.0" ejb-name="MySession"
ejb-type="Session"
ejb-business-interface="model.MySession"
ejb-interface-type="remote"
jndi-name="MySessionBean#model.MySession"
provider-url="iiop://localhost:3700"
initial-context-factory="com.sun.enterprise.naming.SerialInitContextFactory"
xmlns="http://xmlns.oracle.com/adfm/adapter/ejb"
DataControlHandler="oracle.adf.model.adapter.bean.jpa.JPQLDataFilterHandler"/>
</Source>But I get the following error:
SEVERE: Exception:
oracle.jbo.JboException: JBO-29000: Выявлено непредвиденное исключение: javax.naming.NameNotFoundException, сообщ.=Exception in lookup.: `DocJournalService' could not be found.
at oracle.adfinternal.model.adapter.ejb.EjbDataControl.<init>(EjbDataControl.java:171)
at oracle.adfinternal.model.adapter.ejb.EjbDefinition.createDataControl(EjbDefinition.java:142)
at oracle.adf.model.adapter.DataControlFactoryImpl.createSession(DataControlFactoryImpl.java:173)
at oracle.adf.model.binding.DCDataControlReference.getDataControl(DCDataControlReference.java:166)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Caused by: javax.naming.NameNotFoundException: Exception in lookup.: `DocJournalService' could not be found. [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]
at weblogic.corba.j2ee.naming.Utils.wrapNamingException(Utils.java:58)
at weblogic.corba.j2ee.naming.ContextImpl.lookup(ContextImpl.java:252)
at weblogic.corba.j2ee.naming.ContextImpl.lookup(ContextImpl.java:230)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at oracle.adfinternal.model.adapter.ejb.EjbDataControl.<init>(EjbDataControl.java:148)
... 60 more
Caused by: org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:72)
at org.omg.CosNaming._NamingContextExtStub.resolve(_NamingContextExtStub.java:406)
at weblogic.corba.j2ee.naming.ContextImpl.lookup(ContextImpl.java:241)
... 63 more
## Detail 0 ##
javax.naming.NameNotFoundException: Exception in lookup.: `DocJournalService' could not be found. [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]
at weblogic.corba.j2ee.naming.Utils.wrapNamingException(Utils.java:58)
at weblogic.corba.j2ee.naming.ContextImpl.lookup(ContextImpl.java:252)
at weblogic.corba.j2ee.naming.ContextImpl.lookup(ContextImpl.java:230)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at oracle.adfinternal.model.adapter.ejb.EjbDataControl.<init>(EjbDataControl.java:148)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:72)
at org.omg.CosNaming._NamingContextExtStub.resolve(_NamingContextExtStub.java:406)
at weblogic.corba.j2ee.naming.ContextImpl.lookup(ContextImpl.java:241)
... 63 more
Could you tell me where is my mistake?
http://www.alexnet.fr/doc/oracle/oas10132/web.1013/b28221/undejdev003.htm
Similar Messages
-
How to Connect to Remote ECC 5.0 System from EP ?
Hi,
We are using EP6.0 - located in India, and our client ECC5.0 System is in US. Can anyone please let me know the steps how to connect to Remote ECC 5.0 System?.
Thanks in advance.
Krishna Kumar JHi,
Finally we have successfully got connected the ECC 5.0 system which is located in the remote network thru VPN Connection using the same connecting procedure for the local R/3 System.
Thanks & Regards
Krishna Kumar -
Issues in looking up a ejb deployed on glassfish from tomcat.
Hi all,
I have followed the steps mentioned in the EJB FAQ in the glassfish site and was able to lookup a remote ejb deployed in glassfish from a standalone client.
In case of standalone client, i set the appropriate jndi properties in the initial context as mentioned in the FAQ and added the 4 jars specified to the classpath of the application.
It all worked perfectly well.
But I attempted to do the same from a servlet running under tomcat.
I set the appropriate jndi properties in the intial context and added 4 jars specified in the lib directory of the war file.
But this did not turn out well and tomcat complained me with some servlet init errors.
Then i searched through the web and found this posting from you:
http://www.archivesat.com/GlassFish_Enterprise_JavaBeans_Developers/thread1399339.htm
Then i created a folder called "shared/lib" under TOMCAT_HOME directory in my machine and ran the same example. Wow.....miraculously the application ran well.
But i found that the "index.jsp" which i configured in the welcome file list does not appear now. But i was able to access the servlet without any problem. And the servlet was able to successfully lookup the ejb deployed in glassfish.
Then i thought, let me try to access the ejb from a jsf application.
Then i created a jsf application in netbeans 5.5.1 and tried to access the bean deployed in glassfish.
(Note: the jsf application runs in tomcat 5.5.17 which is bundled with netbeans)
OOPSS....
Tomcat now complains me that it cannot compile the jsp page..
This is the error i got...
org.apache.jasper.JasperException: Unable to compile class for JSP
Generated servlet error:
C:\Documents and Settings\james\.netbeans\5.5.1\apache-tomcat-5.5.17_base\work\Catalina\localhost\CityExplorer-WebClient1\org\apache\jsp\index_jsp.java:7: org.apache.jsp.index_jsp is not abstract and does not override abstract method getDependants() in org.apache.jasper.runtime.JspSourceDependent
public final class index_jsp extends org.apache.jasper.runtime.HttpJspBase
^
Generated servlet error:
C:\Documents and Settings\james\.netbeans\5.5.1\apache-tomcat-5.5.17_base\work\Catalina\localhost\CityExplorer-WebClient1\org\apache\jsp\index_jsp.java:12: getDependants() in org.apache.jsp.index_jsp cannot implement getDependants() in org.apache.jasper.runtime.JspSourceDependent; attempting to use incompatible return type
found : java.lang.Object
required: java.util.List
public Object getDependants() {
^
2 errors
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
Any ideas...
Can you please help me.
I've noticed that you were eagerly answering questions related to ejb lookup in many places.
I feel there is some potential compatability issue between tomcat and glassfish...
I request you to investigate on this and clarify the community with your response.
Thanks in advance,
James SelvakumarThank you guys!
I've found the answer myself. -
How Do i Call An xml publissher and a jsper report from ADF pages
Hi All
How Do i Call An xml publissher and a jsper report from ADF pagesI used the above links to create XML's and from there a formatted report of data from the database. I accomplish this by connecting to the database inside the XMLPublisher.java file. I also have my query hard-coded inside the DataTemplate.xml to extract the info from the database. This limits my ability on what the user can accomplish with the system.
Is it possible to run my reports based on an iterator within Jdeveloper, as opposed to having to manually enter the query and connect to the database within the XMLPublisher.java file and the template.xml?
Thanks. -
How to connect to remote server with jmx from jvisualvm
I have a WL 10.3.2 domain running on a single box. The adminserver and managed server are running on the same box, on different ports (7001 and 8001, respectively).
I have a Spring application deployed to the managed server and I've configured it to register a Spring bean as a JMX mbean.
When I run this entire configuration on my laptop, I can run jvisualvm and connect to my server and see and manipulate my registered mbean.
I'm having trouble figuring out how to get a remote connection working, however. I want to run jvisualvm on my laptop and connect to the remote server.
I first did "Add Remote Host", where I specified the IP address. It appears that this was created successfully, and it apparently was able to determine the DNS name for it.
I then tried to add a JMX connection. In the "Connection" field, I just entered the IP address followed by a colon and 8001 (managed server port number).
In the "Use security credentials" section, I entered the weblogic admin principal and credentials.
When I click OK, it chugs for a while and eventually gives up, saying:
Cannot connect to [email protected]:8001 using
service:jmx:rmi:///jndi/rmi://nn.nn.nn.nn:8001/jmxrmi
What might I be missing?I've resolved this. At least I was able to configure an authenticated connection. It doesn't use SSL yet, but I'm ok with that for a while.
Resolving this only required changing the command line parameters for the managed server, and being aware of the "jmxremote.access" and jmxremote.password" files. The following blog article helped a lot: [http://www.dzone.com/links/r/monitoring_your_java_application_with_jmx_part_2.html] .
I'm now passing the following command-line parameters:
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8888 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=true
The default "role" configured in "jmxremote.access" is "controlRole", and the "jmxremote.password" file specifies the credentials for that principal. I simply used that principal and credential in JVisualVM, and the connection succeeded.
And I just used the "host:port" form, not the protocol form.
Edited by: david.karr on Feb 4, 2011 12:47 PM -
How to connect to remote process?
Hi All,
I tried to connect to remote process that to debug my EJBs on the standalone OC4J server. But I got the message "Debugger attempting to connect to remote process at myhost 4000..................... Debugger unable to connect to remote process."
The startup command of the OC4J is: "java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=4000 -jar oc4j.jar"
I have also placed the xmlparserv2.jar, ojc.jar and jdev-rt.jar into the Filder \<OC4JHOME>\lib.
What can I do to resolve this problem?
Thanks.Which protocol is used to connect to the remote debugger?
The protocol is configured with:
1. Select Tools>Project Properties.
2. In the Project Properties page select Profiles>Debugger>Remote.
3. Select the Remote Debugging checkbox and select a protocol for remote debugging.
4. For PL/SQL, specify a database connection to locate PL/SQL source. -
How to connect a remote server in my local pc?.
I have a code to connect my server in visual basic 6.0 code, my sap version is 2007 A.
Private Sub ConnectToCompany()
'// Initialize the Company Object.
'// Create a new company object
Set oCompany = New SAPbobsCOM.Company
'// Set the mandatory properties for the connection to the database.
'// To use a remote Db Server enter his name instead of the string "(local)"
'// This string is used to work on a DB installed on your local machine
oCompany.Server = "(local)"
oCompany.language = ln_English
'// Use Windows authentication for database server.
'// True for NT server authentication,
'// False for database server authentication.
oCompany.UseTrusted = True
ChooseCompany.Show vbModal, Me
End Sub
but I want to connect my remote server and I didn't. Do i forgeting something??... I changed "(local)" for my name remote server or my local Ip for remote server. But maybe my user name windows for autentication. there is Someone who can help me please. Which one is the correct data I need??hello freind
i think yu are missing company usernsme,password,db type like this code
private void Connect()
try
Cursor = System.Windows.Forms.Cursors.WaitCursor;//Change mouse cursor
oCompany = new SAPbobsCOM.Company();
oCompany.DbServerType = (SAPbobsCOM.BoDataServerTypes.dst_MSSQL2008);
oCompany.Server = Properties.Settings.Default.ServerName.ToString();// change to your company server
oCompany.language = SAPbobsCOM.BoSuppLangs.ln_English; // change to your language
oCompany.UseTrusted = false;
oCompany.DbUserName = Properties.Settings.Default.UserID.ToString();
oCompany.DbPassword = Properties.Settings.Default.Password.ToString();
// Set connection properties
oCompany.UserName = txtUSer.Text;
oCompany.Password = txtPassword.Text;
oCompany.CompanyDB = Properties.Settings.Default.DatabaseName.ToString();
//Try to connect
lRetCode = oCompany.Connect();
if (lRetCode != 0) // if the connection failed
int temp_int = lErrCode;
string temp_string = sErrMsg;
oCompany.GetLastError(out temp_int, out temp_string);
// u.action_status("Connection Failed - " + temp_string, this);
if (oCompany.Connected) // if connected
this.Text = this.Text + " - Connected to " + oCompany.CompanyDB;
CheckUser();
Cursor = System.Windows.Forms.Cursors.Default; //Change mouse cursor
catch (Exception) -
How can I call remote ejb through jsp?(null)
Trying the code:
<%@ page import="si3.*,javax.ejb.*,javax.naming.*,java.util.*,java.rmi.RemoteException" %>
<%
int h=8;
int w=8;
Hashtable p = new Hashtable ();
p.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
p.put(Context.PROVIDER_URL,"t3://192.168.0.203:7001");
Context ctx= new InitialContext(p);
Object homeref = ctx.lookup("si3.test");
addHome home = (addHome) PortableRemoteObject.narrow(homeref, addHome.class);
add the_ejb = home.create();
out.println(the_ejb.add(h,w));
out.println("adf");
the_ejb.remove();
%>
yzj wrote:
> I have two server running weblogic5.1.
> If the jsp and ejb locate the same server running weblogic 5.1 ,works well .But one deploys the ejb (jndi name si3.test),the other runs the jsp.I use jsp call the remote ejb ,catch exception :
>
> GMT+08:00 2000:<E> <ServletContext-General> Root
> > cause of ServletException
> > javax.naming.NameNotFoundException: 'si3.test'; remaining name 'si3.test'
> > at
> > weblogic.jndi.toolkit.BasicWLContext.resolveName(BasicWLContext.java,
> > Compiled Code)
> > at
> > weblogic.jndi.toolkit.BasicWLContext.lookup(BasicWLContext.java:133)
> > at
> > weblogic.jndi.toolkit.BasicWLContext.lookup(BasicWLContext.java:574)
> > at javax.naming.InitialContext.lookup(InitialContext.java:349)
> > at jsp_servlet.client._jspService(client.java:90)
> > at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
> > at
> > weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
> > :124)
> > at
> > weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
> > l.java:744)
> > at
> > weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
> > l.java:692)
> > at
> > weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
> > Manager.java:
> > 251)
> > at
> > weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:363)
> > at
> > weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:263)
> > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
> > Code)
>
> Why? Can you help me? Thanks.
> The jsp's source(Client.jsp ):
> <%@ page import="si3.*,javax.ejb.*,javax.naming.*,java.util.*,java.rmi.RemoteException" %>
> <%
> int h=8;
> int w=8;
> Hashtable p = new Hashtable ();
> p.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
> p.put(Context.PROVIDER_URL,"t3://192.168.0.203:7001");
> Context ctx= new InitialContext(p);
> addHome home = (addHome) ctx.lookup("si3.test");
> add the_ejb = home.create();
> out.println(the_ejb.add(h,w));
> out.println("adf");
> the_ejb.remove();
> %>
>
>
[att1.html]
-
Hi all,
I'm a newbie (of java EE and Sun forum).
I have a problem.
I followed this tutorial: http://technology.amis.nl/blog/1368/connecting-to-an-ejb-30-remote-sessionbean-from-tomcat
using Netbeans 6.8, Tomcat 6.0.20, Glassfish v3.
The deploy of EJB on Glassfish is OK.
The deploy of WebApp on Tomcat is OK.
But when I access to the servlet using the browser I receive this exception.
javax.naming.NoInitialContextException: Cannot instantiate class: com.sun.enterprise.naming.SerialInitContextFactory [Root exception is java.lang.ClassNotFoundException: com.sun.enterprise.naming.SerialInitContextFactory]
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at web.MyServlet.processRequest(MyServlet.java:51)
at web.MyServlet.doGet(MyServlet.java:75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Thread.java:619)
I know that I must copy *.jar files in Tomcat dir and App libraries (https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#Step_3._Include_appserv-rt.jar_and), but it doesn't work.
What are my mistakes?
Thank you for your help.
Servlet code:
package web;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Properties;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import testbean.MySessionBeanRemote;
* @author Stefano
public class MyServlet extends HttpServlet {
* Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
Properties props = new Properties();
props.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
props.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
props.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
props.setProperty("org.omg.CORBA.ORBInitialHost", "localhost");
props.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
try {
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet MyServlet</title>");
out.println("</head>");
out.println("<body>");
out.println(MySessionBeanRemote.class.getName());
try {
InitialContext ic = new InitialContext(props);
MySessionBeanRemote mySessionRemote = (MySessionBeanRemote) ic.lookup("pippo");
out.println(mySessionRemote.getOK());
} catch (NamingException ex) {
ex.printStackTrace();
out.println("</body>");
out.println("</html>");
} finally {
out.close();Yes, I did.
I'm not sure about the right actions to do.
For example: the Glassfish FAQ told me to add gf-client*.jar to the Tomcat folder, not appserv-rt.jar , with v3.
I tried with both files. I restarted Tomcat, but nothing work :-( -
Calling EJB 3.1 deployed in Glassfish 3.1 from a web app in Tomcat7
I have a EJB 3.1 bean deployed in Glassfish 3.1.1 server. I want to call this bean from a remote web client deployed in Tomcat 7. The EJB class and its remote interface is as follows ...
Remote Interface -
@Remote
public interface MyEJBRemote
public String sayHello();
EJB Bean -
@Stateless
public class MyEJB implements MyEJBRemote
public String sayHello()
return "Hello EJB Client. Hope everything worked just fine.";
In the remote client I have the following code
Properties props = new Properties();
props.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
props.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
props.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
props.setProperty("org.omg.CORBA.ORBInitialHost", "localhost");
props.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
InitialContext ic = new InitialContext(props);
MyEJBRemote myEJBREmote = (MyEJBRemote)ic.lookup("java:global/MyEJB-1/MyEJB!com.dw.ejb.MyEJBRemote");
Now the problem is with the last line of code. In Eclise this line of code is marked as error as the MyEJBRemote class is not there in the client project (the web app going to be deployed in tomcat 7). So where do I get the client jar generated from the deployed EJB to include in the client project ? Is there any way to generate this jar file.
I tried using the glassfish command
asadmin deploy generatermistubs retrieve . MyEJB.jar
But glassfish didn't not generate any MyEJB-client.jar file. I tried a lot of times but without any success. I read up many forums. In one of them, it was mentioned that from EJB 3.1 glassfish does not generate the client stubs.
So does that mean that one cannot use remote clients from EJB 3.1 in Glasssfish anymore ? Because the client project will never compile without the MyEJB-client.jar .You don't have to generate anything, you need the business interface class in your client application (MyEJBRemote in this case). One way to do that is to put the business interfaces in a separate jar and link that jar in both your client and server projects. The glassfish 3 FAQ documents the need to include the business interface class in your client application:
http://glassfish.java.net/javaee5/ejb/EJB_FAQ.html#StandaloneRemoteEJB
Another option is to turn the EJB into a JAX-WS webservice, which can be as easy as only adding a few annotations to it. That way you don't need any additional dependencies at all; the only thing you need to do is generate the stub classes using the wsimport tool (also part of the JDK) for your client application. I'm not a huge fan of SOAP, but for internal use I find it less cumbersome and more portable than remote EJBs.
I can't offer any more advice on the topic as I don't use Glassfish. For better help, I do advise you to ask in the Glassfish forum where you'll find more people that have been in the same boat you are.
http://www.java.net/forums/glassfish/glassfish -
Invoking BPEL process from ADF application - webservice connection failed
Hi,
I am trying to invoke a Bpel process from ADF page , I deployed the same in Standalone SOA server since I had to display some Human Task Forms.
I created a webservice data control out of the bpel process and dropped the process method in my page.
The page on which I dropped the process method stopped rendering and I checked the logs and found that I got the error mesage- webservice connection failed,the webservice url could not be reached and in the logs it also asks us to check if the connections.xml is available in the meta-inf directory. I checked the conections.xml is available in the EAR.
So any pointers here and any one faced this error anytime?
is there better ways to invoke the bpel flow from ADF page.
Thanks,
RobinHi,
Check if your wsdl endpoint can accessed properly. If yes, check the soap-binding address is properly pointing to the server hosting the webservice.
Regards,
Harikiran. -
How-to access username and password protected Java EE Web services from ADF
The title of this post is exactly the same as this article by Frank Nimphius:
http://www.oracle.com/technology/products/jdev/howtos/1013/protectedws/access_protected_web_services_from_adf.htm
The article addresses the problem of securing web services using usernames and passwords, when those web services are accessed through a proxy or a data control. In the examples, the user names and passwords are specified, whether in the code or the definition of data controls. (SKING/SKING).
In a very common scenario, users login to reach a page, for example, A.jspx, which contains a button that calls a web service, for example displayDate. Suppose that user has logged in by username/pass of (AHUNOLD/AHUNOLD) and AHUNOLD has access to the service and the page. Is there any way to pass the logged in user name and password to the webservice ? Of course we can hard-code the username in the data control definition or proxy code, but this is just one of the thousands of users who have access to the service and the authentication is not dynamic this way.
Hope my question is clear. Wishing you all a great Christmas.
FarbodHi Frank, and happy new year.
Are you implying that it couldn't be done declaratively? What is your suggestion for this problem? You know the problem... As I described:
- I need to secure my web services, so when exposed, no one from inside network or the internet, can access the web service without proper permission
- The web services are shown as web controls on jspx pages. The user has logged in before reaching the page. It is irrelevant to ask him to enter user name and password again.
- I have user names, passwords and roles in Oracle Internet Directory (Identity Management). It provides some APIs and I can retrieve the usernames and attempt logging in programmically. But how can I get username and password from the session in ADF application?
I guess using SAML or certificate could be the solution, but I have a problem with SAML, described here:
Re: Webservices Security, SAML, and Identity Management (OID)
Best Regards,
Farbod -
Connecting to Remote EJB from Servlet in same application
Please help!
I was able to connect to SessionBeans and EJB from my sample java client in OCJ4 but when I try to do same thing from my web application using servlets, I get the below NullPointerException error.
The JNDI lookup works fine using java client but difficult from a servlet.
I am sure there is something I am missing.
Thanks
This is what I do in the servlet:
public void init() throws ServletException, NamingException, CreateException, RemoteException
Context jndiContext = getInitialContext();
SessionCartEJBHome home = (SessionCartEJBHome)jndiContext.lookup("SessionCartEJBBean");
sessionEJB = null;
try{
sessionEJB = (SessionCartEJB) home.create();
}catch (Exception e)
e.printStackTrace();
private static Context getInitialContext() throws NamingException
Hashtable env = new Hashtable();
// Standalone OC4J connection details
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
env.put(Context.SECURITY_PRINCIPAL, "admin");
env.put(Context.SECURITY_CREDENTIALS, "admin");
env.put(Context.PROVIDER_URL, "ormi://Princeton/ejb1");
return new InitialContext(env);
And when I call the following procedure, it blow up at the line sessionEJB.getLineItem(new Long(1304));
sessionEJB is a class variable.
void processCatalogPage(HttpServletRequest request,
HttpServletResponse response,
ActionMapping mapping,
HttpSession session
throws ServletException, IOException , Exception, FinderException{
try {
ActionForward actFor = null;
String itemId = request.getParameter("id");
if ( itemId != null ) {
String[] itemIds = new String[1];
itemIds[0] = itemId;
sessionEJB.getLineItem(new Long(1304));
actFor = mapping.findForward("catalog");
return (mapping.findForward("success"));
} catch (Exception ex)
ex.printStackTrace();
System.err.println(ex.toString());
throw new EJBException(ex.toString());
04/12/11 23:45:24 java.lang.NullPointerException
04/12/11 23:45:24 at com.alashoofi.Cart.processCatalogPage(Cart.java:187)
04/12/11 23:45:24 at com.alashoofi.Cart.execute(Cart.java:86)
04/12/11 23:45:24 at org.apache.struts.action.RequestProcessor.processActi
onPerform(RequestProcessor.java:484)
04/12/11 23:45:24 at org.apache.struts.action.RequestProcessor.process(Req
uestProcessor.java:274)
04/12/11 23:45:24 at org.apache.struts.action.ActionServlet.process(Action
Servlet.java:1482)
04/12/11 23:45:24 at org.apache.struts.action.ActionServlet.doGet(ActionSe
rvlet.java:507)
04/12/11 23:45:24 at javax.servlet.http.HttpServlet.service(HttpServlet.ja
va:740)
04/12/11 23:45:24 at javax.servlet.http.HttpServlet.service(HttpServlet.ja
va:853)
04/12/11 23:45:24 at com.evermind.server.http.ServletRequestDispatcher.inv
oke(ServletRequestDispatcher.java:765)
04/12/11 23:45:24 at com.evermind.server.http.ServletRequestDispatcher.for
wardInternal(ServletRequestDispatcher.java:317)
04/12/11 23:45:24 at com.evermind.server.http.HttpRequestHandler.processRe
quest(HttpRequestHandler.java:790)
04/12/11 23:45:24 at com.evermind.server.http.HttpRequestHandler.run(HttpR
equestHandler.java:270)
04/12/11 23:45:24 at com.evermind.server.http.HttpRequestHandler.run(HttpR
equestHandler.java:112)
04/12/11 23:45:24 at com.evermind.util.ReleasableResourcePooledExecutor$My
Worker.run(ReleasableResourcePooledExecutor.java:192)
04/12/11 23:45:24 at java.lang.Thread.run(Thread.java:534)
04/12/11 23:45:24 java.lang.NullPointerException
Dec 11, 2004 11:45:24 PM org.apache.struts.action.RequestProcessor processExcept
ion
WARNING: Unhandled Exception thrown: class javax.ejb.EJBExceptionAvi,
Thanks for your response. I am actually returning a new InitialContext in a function call in the servlet. What I have noticed though is that JDeveloper creates two ear files for the application. One for the ejbs called ejb1.ear and another for the web files webapp1.ear. These are located in the applications subdirectory in OC4J directory.
I know I have two projects in the application, model and viewController. I am just trying to follow the MVC pattern.
In short, I don't think the web and the ejbs are in same ear file. I made the web project depend on the ejbs though. There is an option to set such. I don't know how to tell JDeveloper to put them all in one ear file.
I will appreciate any suggestion.
Thanks
Matilda -
How to connect to remote sql server database?
Hallo,
I am a new member, so please excuse me if my questions are dummy.
I am using CR2008 SP2 to make reports from sql server 2005 databases.
Localy there is no connection problem and everything works perfect.
I would like to establish a connection with a remote sql server 2005,
but i am not familiar with remote data retriving. which driver should i use? static ip? vpn? server ports?
Any answer will be really appreciatedHello,
This is more a question for Microsoft to see what and how they support remote connections to databases. As long as you have the connection made CR will not have any problems. You may find it is slow so optimizing your queries is highly recommended. Passing a million records through your web connector is going to take time.....
I've personally used a VPN connection and then set the ODBC or OLE DB connection info to my test server here at work and it worked fine. But they were small data sets.
Thank you
Don -
How to connect to remote computer using ARD and AE
Does anyone have detailed instructions on how I can us my AirPort Extreme and setup all the ports to allow the use of ARD remotely?
You can configure your AirPort Extreme for ARD using the AirPort Utility. ARD is one of the choices under Port Mapping.
You get to the port mapping option, as follows:
Run the AirPort Utility.
Select the AirPort Extreme, and then, select Edit.
Select the Network tab to enable it.
Click on the "+" button under the Port Settings field.
Click on the drop-down arrow to the right of the Description field. (see image below)
Select Apple Remote Desktop. This will automatically populate the other fields on the page.
Select Save, and then, select Update.
Allow the base station to reset.
Maybe you are looking for
-
Error 7 (net::ERR_TIMED_OUT): The operation timed out
Hi, I changed from HP to Mac and I am having problems opening specific websites: https://elearning.uol.ohecampus.com/webapps/bbgs-SSO-bb_bb60/execute/login?aid=G WGdfsQZLwUD3COgrDFFbGN0TCFY9HyHlLr3ruugp%2fDzrjxUUUqph8JuKgPvdazbmO0lvlptietNgME YslS%2b
-
KDE 4.7: very slow and high disk usage
Since upgrade to KDE 4.7 on my i686 laptop, my system behaves weirdly. I noticed a slow down caused by a very high disk usage: when the HDD spins the cpu usage reported by the CPU monitor plasmoid is very high (~ 50%), while top reports a very small
-
Oracle RAC 11gR2 on Windows - Disk Storage Newbie question
Hi all I have been reading through the Grid install guide in an effort to understand how to set up a RAC solution. I am new to Oracle so a lot of these concepts I am trying to understand but from what I am reading a typical install would be to have m
-
How do I keep the the text from shifitng? In iWeb the page looks fine but after publishing the text moves causing rows of text get out of alignment. I have to keep republlishing after inserting (or deleting) spaces to get back into the best alignment
-
No sound out of Logic but audio is recognized
I bought an Oxygen 8 and I'm trying to use it with logic. I can see an imput signal when I hit a key but no sound comes out of logic at all. The Oxygen 8 is running into an audio interface and then into my macbook via usb. This set-up works fine in A