Calling EJB with HTML via SERVLET

Hi,
I used a writen example that calls EJB from HTML via SERVLET. Example name is Bonus. The problem I have is that the HTML throw error while calling SERVLET. I dont figure out what seams to be a problem. Someone know?
I wonder if the problem is in servlet? The EJB is fine!
christian
HTML CODE:(bonus.html)
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1250"/>
<TITLE>untitled1</TITLE>
</HEAD>
<BODY BGCOLOR = "WHITE">
<BLOCKQUOTE>
<H3>Bonus Calculation</H3>
<FORM METHOD="GET" ACTION="BonusAlias">
<P>Enter social security Number:<P>
<INPUT TYPE="TEXT" NAME="SOCSEC"></INPUT>
</P>
Enter Multiplier:
<P>
<INPUT TYPE="TEXT" NAME="MULTIPLIER"></INPUT>
</P>
<INPUT TYPE="SUBMIT" VALUE="Submit">
<INPUT TYPE="RESET">
</FORM>
</BLOCKQUOTE>
</BODY>
</HTML>
SERVLET CODE:(BonusServlet.java)
package mypackage5;
import mypackage5.Calc;
import mypackage5.CalcHome;
import mypackage5.impl.CalcBean;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import javax.naming.*;
import javax.rmi.PortableRemoteObject;
import java.beans.*;
public class BonusServlet extends HttpServlet {
CalcHome homecalc;
public void init(ServletConfig config) throws ServletException{
//Look up home interface
try{
//InitialContext ctx = new InitialContext();
//Object objref = ctx.lookup("Calc");
//homecalc = (CalcHome)PortableRemoteObject.narrow(objref, CalcHome.class);
Context context = new InitialContext();
CalcHome calcHome = (CalcHome)PortableRemoteObject.narrow(context.lookup("Calc"), CalcHome.class);
Calc calc;
catch (Exception NamingException) {
NamingException.printStackTrace();
public void doGet (HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String socsec = null;
int multiplier = 0;
double calc = 0.0;
PrintWriter out;
response.setContentType("text/html");
String title = "EJB Example";
out = response.getWriter();
out.println("<HTML><HEAD><TITLE>");
out.println(title);
out.println("</TITLE></HEAD><BODY>");
try{
Calc theCalculation;
//Get Multiplier and Social Security Information
String strMult = request.getParameter("MULTIPLIER");
Integer integerMult = new Integer(strMult);
multiplier = integerMult.intValue();
socsec = request.getParameter("SOCSEC");
//Calculate bonus
double bonus = 100.00;
theCalculation = homecalc.create();
calc = theCalculation.calcBonus(multiplier, bonus);
catch (Exception CreateException){
CreateException.printStackTrace();
//Display Data
out.println("<H1>Bonus Calculation</H1>");
out.println("<P>Soc Sec: " + socsec + "<P>");
out.println("<P>Multiplier: " +
multiplier + "<P>");
out.println("<P>Bonus Amount: " + calc + "<P>");
out.println("</BODY></HTML>");
out.close();
public void destroy() {
System.out.println("Destroy");

The error is that page cannot be found! When I run only the servlet it works, when I run the HTML page and enter the field throws eror that the page cannot be found!
thanks
Christian

Similar Messages

  • Error while calling EJB with a heavyweight Object Parameter

    Hi Everybody,
    I am getting the following Error when i call a EJB with a heavyweight Object Parameter in Sun ONE Application Server 7.0.0_04.
    [03/Jun/2005:13:40:39] WARNING ( 2484): CORE3283: stderr: org.omg.CORBA.BAD_PARAM: java.util.PropertyResourceBundle vmcid: OMG minor code: 6 completed: Maybe
    [03/Jun/2005:13:40:39] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.se.internal.util.Utility.throwNotSerializableForCorba(Utility.java:1018)
    [03/Jun/2005:13:40:39] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.se.internal.io.IIOPOutputStream.writeObjectField(IIOPOutputStream.java:691)
    [03/Jun/2005:13:40:39] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.se.internal.io.IIOPOutputStream.outputClassFields(IIOPOutputStream.java:745)
    [03/Jun/2005:13:40:39] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.se.internal.io.IIOPOutputStream.defaultWriteObjectDelegate(IIOPOutputStream.java:167)
    [03/Jun/2005:13:40:39] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.se.internal.io.IIOPOutputStream.outputObject(IIOPOutputStream.java:526)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.se.internal.io.IIOPOutputStream.simpleWriteObject(IIOPOutputStream.java:123)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.se.internal.io.ValueHandlerImpl.writeValueInternal(ValueHandlerImpl.java:136)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.se.internal.io.ValueHandlerImpl.writeValue(ValueHandlerImpl.java:116)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.ee.internal.iiop.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:1062)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.ee.internal.iiop.CDROutputStream.write_value(CDROutputStream.java:259)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.ee.internal.corba.TCUtility.marshalIn(TCUtility.java:136)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.ee.internal.corba.AnyImpl.write_value(AnyImpl.java:599)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.ee.internal.iiop.CDROutputStream_1_0.write_any(CDROutputStream_1_0.java:538)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.ee.internal.iiop.CDROutputStream.write_any(CDROutputStream.java:233)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.ee.internal.iiop.ShutdownUtilDelegate.writeAny(ShutdownUtilDelegate.java:196)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at javax.rmi.CORBA.Util.writeAny(Util.java:78)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.se.internal.io.ValueHandlerImpl.write_Array(ValueHandlerImpl.java:446)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.se.internal.io.ValueHandlerImpl.writeValueInternal(ValueHandlerImpl.java:134)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.se.internal.io.ValueHandlerImpl.writeValue(ValueHandlerImpl.java:116)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.ee.internal.iiop.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:916)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.ee.internal.iiop.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:651)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.ee.internal.iiop.CDROutputStream.write_value(CDROutputStream.java:263)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.se.internal.io.IIOPOutputStream.writeObjectField(IIOPOutputStream.java:685)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.se.internal.io.IIOPOutputStream.outputClassFields(IIOPOutputStream.java:745)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.se.internal.io.IIOPOutputStream.defaultWriteObjectDelegate(IIOPOutputStream.java:167)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.se.internal.io.OutputStreamHook.defaultWriteObject(OutputStreamHook.java:129)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at java.util.Vector.writeObject(Vector.java:1017)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.se.internal.io.IIOPOutputStream.writeObject(Native Method)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.se.internal.io.IIOPOutputStream.invokeObjectWriter(IIOPOutputStream.java:560)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.se.internal.io.IIOPOutputStream.outputObject(IIOPOutputStream.java:523)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.se.internal.io.IIOPOutputStream.simpleWriteObject(IIOPOutputStream.java:123)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.se.internal.io.ValueHandlerImpl.writeValueInternal(ValueHandlerImpl.java:136)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.se.internal.io.ValueHandlerImpl.writeValue(ValueHandlerImpl.java:116)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.ee.internal.iiop.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:1062)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.ee.internal.iiop.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:651)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.ee.internal.iiop.CDROutputStream.write_value(CDROutputStream.java:263)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.se.internal.io.IIOPOutputStream.writeObjectField(IIOPOutputStream.java:685)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.se.internal.io.IIOPOutputStream.outputClassFields(IIOPOutputStream.java:745)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.se.internal.io.IIOPOutputStream.defaultWriteObjectDelegate(IIOPOutputStream.java:167)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.se.internal.io.IIOPOutputStream.outputObject(IIOPOutputStream.java:526)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.se.internal.io.IIOPOutputStream.simpleWriteObject(IIOPOutputStream.java:123)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.se.internal.io.ValueHandlerImpl.writeValueInternal(ValueHandlerImpl.java:136)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.se.internal.io.ValueHandlerImpl.writeValue(ValueHandlerImpl.java:116)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.ee.internal.iiop.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:1082)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.ee.internal.iiop.CDROutputStream.write_value(CDROutputStream.java:259)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.ee.internal.javax.rmi.CORBA.Util.copyObjects(Util.java:440)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at javax.rmi.CORBA.Util.copyObjects(Util.java:296)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.mot.hris.hrsystem.ejb._HRSystem_Stub.get(Unknown Source)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.mot.hris.transaction.AddressType.submitAddressChange(Unknown Source)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.mot.hris.transaction.AddressType.submitToSAP(Unknown Source)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.mot.hris.mydata.servlet.MyDataConfirmationServlet.processServlet(Unknown Source)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at com.mot.hris.core.servlet.EnetBaseHttpServlet.service(Unknown Source)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    [03/Jun/2005:13:40:40] WARNING ( 2484): CORE3283: stderr:      at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:720)
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr:      at org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrapperValve.java:118)
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr:      at org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValve.java:278)
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr:      at java.security.AccessController.doPrivileged(Native Method)
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr:      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:274)
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr:      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr:      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr:      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr:      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr:      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr:      at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:158)
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr:      at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr: java.rmi.UnexpectedException: java.io.IOException: Serializable readObject method failed internally
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr:      at com.sun.corba.ee.internal.javax.rmi.CORBA.Util.wrapException(Util.java:370)
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr:      at javax.rmi.CORBA.Util.wrapException(Util.java:277)
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr:      at com.mot.hris.hrsystem.ejb._HRSystem_Stub.get(Unknown Source)
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr:      at com.mot.hris.transaction.AddressType.submitAddressChange(Unknown Source)
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr:      at com.mot.hris.transaction.AddressType.submitToSAP(Unknown Source)
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr:      at com.mot.hris.mydata.servlet.MyDataConfirmationServlet.processServlet(Unknown Source)
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr:      at com.mot.hris.core.servlet.EnetBaseHttpServlet.service(Unknown Source)
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr:      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr:      at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:720)
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr:      at org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrapperValve.java:118)
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr:      at org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValve.java:278)
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr:      at java.security.AccessController.doPrivileged(Native Method)
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr:      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:274)
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr:      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr:      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr:      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr:      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr:      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr:      at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:158)
    [03/Jun/2005:13:40:41] WARNING ( 2484): CORE3283: stderr:      at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)
    Can someone please help to solve this.
    Regards,
    Sunil

    Unfortunately there's not really enough information for anyone to help you much. I can tell you've hit an EOF Exception, but that's about it.
    What exactly do you mean by a heavyweight object parameter? Do you mean a large (in memory size) object?
    Without any knowledge of your application, I'd probably start by changing your ejb method to do nothing. That should tell you at least whether it's the serialization of the parameter that's the issue or not. Narrow it down from there.
    If you need more help, printing the entire stack trace of the EOFException and posting it here would be helpful.
    -- Rob

  • Getting error while calling ejb business methods from servlet

    Hi
    Iam getting error when i try to call a ejb method from servlet.Error is
    "com.netscape.server.eb.UncheckedException: unchecked exception nested exception is:java.lang.NullPointerException".
    I build the application and deployed it successfully.Iam using IAS 6.O with windows NT 4.0.
    This is just a method which takes values from database and return as an array of bean to servlet.
    Any help on this.Thanks Shank

    Hi
    I was using the session bean.Your suggestion helped me a lot.Perfect.
    I debug my program and found that from ejbCreate()exception is getting.
    I was getting the datasource object thro ejb create() initialisation.
    Somehow the look up jndi which i mentioned was not interpretting from ejb-jar.xml ias-ejb-jar.xml and datasource ref .Due to this iam getting jndi Namenotfound exception which in turns to null pointer as datasource is getting null.
    when i hardcoded in the ejb the the jndi name for datasource it is working fine.Bit worried all the existing ejbs working with the xml referenced datasource and jndi,but when i added a new ejb with same properties it is failing to get the jndi name.
    Piece of code from ias-ejb-jar.xml
    <resource-ref>
              <res-ref-name>myDataSource</res-ref-name>
              <jndi-name>jdbc/nb/myData</jndi-name>
    </resource-ref>
    Piece of code from ejb-jar.xml
    <resource-ref>
              <res-ref-name>myDataSource</res-ref-name>
              <res-type>javax.sql.DataSource</res-type>
              <res-auth>Container</res-auth>
    </resource-ref>
    Thanks a lot meka

  • Calling EJB from Oracle via IIOP

    I've spent the last two days trying to figure out how I can call an
    EJB from an Oracle Stored Procedure. I first looked into WLS JNDI
    (Using WLInitialContextFactory ), but my collegue recommended I look
    into IIOP because it is "less proprietary". I was able to get a WL
    example working that does a lookup on an EJB and "narrows" the IIOP
    object...so it looked promissing, but then I tried to load the JAR
    into Oracle and it said:
    "referenced name javax/rmi/PortableRemoteObject could not be found"
    So I did a quick check and it looks like this didn't come into
    existance until JDK 1.3. By all accounts, Oracle 8.1.6 supports JDK 2
    (1.2). So now I'm stuck. I've got a few examples about connecting to
    the Oracle ORB using session-iiop, but I don't know if Weblogic will
    be able to work with this. I don't know how I'd even call it because
    the URL requires an Oracle SID...so now what? I see three options.
    Please let me know which would be best (or another option that I'm
    missing)
    1. Try connecting with Weblogic "T3"
    2. Try to get the right combination of classes loaded so 1.2 can work
    like 1.3
    3. Use the Oracle IIOP (I have no examples for connecting to other
    ORBs so I have no idea how to lookup objects).
    Chris

    [email protected] (Chris Snyder) writes:
    Andy Piper <[email protected]> wrote in message news:<[email protected]>...
    [email protected] (Chris Snyder) writes:
    1. Try connecting with Weblogic "T3"It depends on what version of WLS you are using. If you are using 6.1
    then you are out-of-luck because this only support JDK 1.3.1.We are using WLS 6.1 and Oracle 8.1.6. There's got to be a way to
    connect what is essentially a 1.2 JVM to a 1.3.1 JVM. On my way home
    yesterday I was wondering if just straight RMI would work...although
    we need to encrypt the connection. I've seen several people talk
    about calling EJB's from stored procedures so it seems like there is a
    way. Any other ideas?The really gross way is HTTP. In a previous life I had a customer use
    oracle's HTTP plug-in to do this. You could probably invert the
    problem also. I.e. write CORBA objects that sit inside an Orb hosted
    in WLS and invoke on those using oracle's CORBA support. But HTTP is
    probably the way most likely to work. You probably couldn't use RMI
    over HTTP either - you would have to write a servlet that delegated to
    your beans.
    andy

  • HOW can I call EJB with JSP?

    Hi, I'm working with JSP and want to include some EJB. I dont know how can I access EJB through JSP. I dont know if I use the right code in JSP for calling EJB. Did someone know how to use that? Can someone tell me if is the right code in JSP in my example?
    Thanks, Kristjan
    THIS IS THE JSP: (useejb.jsp)
    <%@ taglib uri="http://xmlns.oracle.com/j2ee/jsp/tld/ojsp/ejbtaglib.tld" prefix="EJB" %>
    <%@ page import="mypackage1.MySessionEJB" %>
    <%@ page import="mypackage1.MySessionEJBHome" %>
    <%@ page import="mypackage1.impl.MySessionEJBBean" %>
    <HTML>
    <head><TITLE>USEBEAN</TITLE></head>
    <body>
    <EJB:useHome id="mySessionEJBHome" type="mypackage1.MySessionEJBHome" location="java:comp/env/ejb/mySessionEJB" local="false" />
    <EJB:useBean id="mySessionEJBBean" type="mypackage1.impl.MySessionEJBBean" local="false">
    <EJB:createBean instance="<%=mySessionEJBHome.create() %>" />
    </EJB:useBean>
    <%= mySessionEJBBean.calc() %>
    </body>
    </html>
    THIS IS THE EJB CODE:(MySessionEJBBean.java)
    package mypackage1.impl;
    import javax.ejb.SessionBean;
    import javax.ejb.SessionContext;
    import java.lang.String.*;
    public class MySessionEJBBean implements SessionBean
    public void ejbCreate(){}
    public void ejbActivate(){}
    public void ejbPassivate(){}
    public void ejbRemove(){}
    public void setSessionContext(SessionContext ctx){}
    public String calc(String value)
    return value + value;
    public String zanka(String x)
    return x;
    (MySessionEJB.java)
    package mypackage1;
    import javax.ejb.EJBObject;
    import java.rmi.RemoteException;
    public interface MySessionEJB extends EJBObject
    public String calc(String value) throws RemoteException;
    String zanka(String x) throws RemoteException;
    (MySessionEJBHome.java)
    package mypackage1;
    import javax.ejb.EJBHome;
    import java.rmi.RemoteException;
    import javax.ejb.CreateException;
    public interface MySessionEJBHome extends EJBHome
    public MySessionEJB create() throws RemoteException, CreateException;
    }

    You might want to look at using a Java Bean wrapper, this can be done automically using WebSphere. It creates what is called an access bean which the JSP imports.
    HTH,
    J.Clancey

  • Calling EJB with Annotation not successfull within Netbeans

    I am trying to call EJB but my simple program can't find a ejb
    within netbeans. I also download a stub file from the admin page and add to the ejb client path. but still without the luck
    @EJB
    private static ConverterBean converterBean;
    public static void main(String[] args) {
    // TODO code application logic here
    BigDecimal param = new BigDecimal ("100.00");
    BigDecimal amount = converterBean.dollarToYen(param);
    System.out.println( amount );
    }

    Thanks for your pointer. Could you please help me out with a small code snippet example?
    I want to make use of this existing bean (AMSProfileServiceBean ):
    @WebService(targetNamespace = "http://www.ttt.de/ota")
    @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.BARE)
    // standard EJB3 annotations
    @Local(AMSAgencyWSPortType.class)
    @Stateless
    @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
    // jboss propriatary annotations
    @WebContext(transportGuarantee = "NONE", secureWSDLAccess = false)
    public class AMSProfileServiceBean extends AbstractProfileBuilder implements AMSAgencyWSPortType
      private static Log log = LogFactory.getLog(AMSMappingServiceBean.class);
      @EJB(mappedName = "PotsdamProfileService/local")
      private PotsdamProfileService profileService;
      private Security              security;
      @EJB
      private OTAProfileBuilder     otaProfileBuilder;
      @EJB
      private OTAProfileUpdater     otaProfileUpdater;
    @Override
      public OTATTProfileReadRS otaTTReadRQ(Holder<Security> wsseHeader, OTATTReadRQ request)
    ...in my soap-connector :
    @WebServiceProvider(wsdlLocation = "WEB-INF/wsdl/PotsdamAMSAgencyWS.wsdl", targetNamespace = "http://www.ttt.de/ota", serviceName = "PotsdamAMSAgencyWS", portName = "PotsdamAMSAgencyWSPortType")
    @ServiceMode(value = Service.Mode.MESSAGE)
    public class PotsdamAgencyWSProvider extends WSProvider implements Provider<SOAPMessage>
      @Resource
      WebServiceContext     wsCtx;
    ...A small example would be really appreciated.
    Thanks.

  • JCO RFC Provider: "Bean not found" when calling EJB from ABAP via RFC

    Hello,
    I'm having trouble calling an EJB in a CE 7.1 system from ABAP via RFC. I'm trying to use the JCO RFC Provider service, which mean that I want to expose an EJB so that it can be called via Remote Function Call.
    I have documented everything, including the code and the deployment descriptors I wrote, in this thread in the CE forum: Jco RFC Provider: Bean not found
    If there's any chance you can help, please do me a favour and look into the problem.
    Thanks a lot!
    Thorsten

    Hi Vladimir,
    Thank you very much, your help was immensely valuable.
    I just had to add the function declaration to the Home Component interface, everything else was correct, and now it works.
    Cheers,
    Thorsten

  • Skype click to call interferes with HTML cut and p...

    FYI - I had to remove Skype click to call from my PC because it disables my ability to cut and paste HTML to microsoft word.
    Please fix this, thanks.

    Me too! I thought it was a Google Chrome problem. I even rebuilt my laptop over it and spent a whole day on the phone with Geeksquad! I just uninstalled Click-to-call and now the problem is gone. 
    This is a really big deal, people use copy/paste all the time and expect the formatting to work. I'm telling everybody to uninstall click-to-call and/or don't install it in the first place. I hope somebody gets serious and fixes it. And, Skype will have to acknowledge the problem and tell me it is fixed before I will give click-to-call another shot.
    Not trying to be a jerk - that is just the truth of it.

  • Calling EJB with bpelx:exec lookup-methode

    I created a EJB3.0 that I try to lookup in a BPEL Java Embedding activity with following code:
    try {          
      Object homeObj = lookup("ejb/stateless/LoginDataBean#com.unisoa.logindata.LoginDataBeanRemote");
    } catch (Exception ex) {              
       addAuditTrailEntry(ex);   
    }I get Logged exception "NameNotFoundException" as result. Unfortunately I do not have a clue why this happens.
    To prove the lookup-name I checked jndi-tree and it shows Binding-Name: ejb.stateless.LoginDataBean#com.unisoa.logindata.LoginDataBeanRemote. So jndi-name seems to be ok.
    Also I generated a java client with JDeveloper that works well too.
    Code Java Client:
    Hashtable env = new Hashtable();
    env.put( Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"; );
    env.put(Context.PROVIDER_URL, "t3://server:port");
    InitialContext context = new InitialContext( env );     
    LoginDataBeanRemote loginDataBeanRemote = (LoginDataBeanRemote)context.lookup("ejb/stateless/LoginDataBean#com.unisoa.logindata.LoginDataBeanRemote";);The bean I try to call is following:
    @Stateless(name = "LoginData", mappedName = "ejb/stateless/LoginDataBean")
    @Local(LoginDataBeanLocal.class)
    @Remote(LoginDataBeanRemote.class)
    public class LoginDataBean implements LoginDataBeanLocal, LoginDataBeanRemote{
      public LoginDataBean() {}
    }I did online research but could not find any usefull information. Also I do not know if remote or local jndi-name is necessary for lookup-methode. I am using SOA Suite 11.1.1.3.0.
    I would really appreciate some help.
    Thx
    Pascal

    Have you resolved this? I'm struggling with the exact same problem; a standalone EJB Java client works and I can see the mapped name in the soa server JNDI tree etc

  • Calling me23n with parameters via ITS weblink?

    Hi,
    I'm currently working on a BSP page which links to a R/3 (ITS standalone) directly with tcode me23n. Now, I'm just wondering if it's possible to pass parameters to that transaction? I want to call the transaction directly with a material number.
    Thanks in advance!

    No not with me23n (its because of the way me23n is built). you have to go for ME23 instead
    this weblog may be of help to you
    /people/durairaj.athavanraja/blog/2004/09/23/pass-parameter-to-its-url-upadated-21st-june-2008
    Regards
    Raja

  • Keeping contact with controlling applet while u/l XML file via servlet

    Hello everybody,
    if I am thinking too complicated, please send me other suggestions. Here's the situation:
    I already have a working applet for a metadata application, that is sending the contents of the client's textfields to a remote database via servlet communication. Now I want to implement the following:
    -The users have some attribute data in form of an XML file
    -I want them to upload this file to the server (I already have that functionality using the fileUpload libraries of Apache Commons) by calling the servlet from a pop-up html page (is there any other possibility to do the communication, i.e. getting files from the file system?)
    -the XML file should be parsed on the server and the content should be sent back to the calling applet for previewing reasons.
    -when the user gives his/her O.K. the data should be transferred to the database.
    Now there are some obstacles to overcome: When I upload the XML file to the server, I loose "contact" with the applet, i.e. the file is not connected with the applet code in any way. This is not a problem, when there is only one user at the time, but with many users loading up their data at the same time, things could get tricky.
    What I thought was to copy the XML file to a temp directory with a unique name, the name of which would be transferred back to the applet by another servlet that is called when the (upload)pop-up window closes. The name of the temp directory could be the ID of the applet thread (is there such an ID, if yes, how can it be retrieved?)
    Any suggestions (or just shaking heads concerning my complicated construction ;-) )
    Cheers and many thanks in advance
    Jan

    You may be able to read a file from the file system with the applet, but it may require you to sign the applet. If you can, then use an HttpURLConnection to the servlet and send the file that way.
    On the server side, you could create a session object (wether you actually need a session or not), and use the session's id as the key id for the directory name for the uploaded file. Session IDs are unique per client, and if the client handles cookies, then the same session will be used from one request to the next.
      session = request.getSession();
      String sessionID = session.getId();The response from the servlet would be a link to the server-side file. If you are using the Applet to send the request, you could get the response and automatically view the new file. Otherwise, you could send a page to the popup window saying: "Click This Link To See Your File" type of thing.

  • 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 Khan

    Hey,
    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

  • Call stored procedure(with parameters) via odbc

    In my application I like to use the below statement to call a stored procedure with parameter and return a result set.
    {CALL PP.getPerson('daniel')}
    but this will just return errors to my application.
    If I change the statement to:
    {CALL PP.getPerson(?')}
    and bind a parameter and its value, it will work.
    My question is, is it possible to call a stored procedure via ODBC without binding parameters in application? I mean, what will be my SQL equivalent if I don't want to do parameter binding in my application?
    Thanks in advance. I appreciate any help :-)

    hi 
    Please see the e.g bellow
    create proc proc_test(@SchoolNumber int,@SchoolName
    varchar(100),@StudentNumber int, @StudnentName
    varchar(100)output ,
    @StudentAddress varchar(100) output,
    @Studentbirthdate datetime output,
    @StudentPhoneNumber varchar(100) output,
    @GuardianName varchar(100) output)
    as
    begin
    select @StudnentName varchar=StudnentName ,
    @StudentAddress =StudentAddress,
    @Studentbirthdate =Studentbirthdate ,
    @StudentPhoneNumber =StudentPhoneNumber,
    @GuardianName =GuardianName
    from table where schoolno=@SchoolNumber
    and SchoolName=@SchoolName
    and StudentNumber=@StudentNumber
    return
    end
    http://technet.microsoft.com/en-us/library/ms187004(v=sql.105).aspx
    http://www.lynda.com/SQL-Server-tutorials/Using-input-output-parameters/104964/113058-4.html
    Please mark answered if I've answered your question and vote for it as helpful to help other user's find a solution quicker

  • Calling EJB facades via class instantiated via reflection?

    We are loading plugins via Java reflection. Anything instantiated via newInstance() does not appear to have access to the Local interface.
    Right now, to get to the session bean we must use the Remote interface. This is annoying due to the performance, and seems completely unnecessary when everything is operating in one JVM.
    Tests were done to print out the JNDI namespace and the local interfaces don't seem to be accessible. Any advice?

    My project consists of an EJB package and WAR. I have not had any problem calling the local facades from JSP, Servlet, or web service in the EJB package.
    Further, I can use XStream reflection and do local EJB calls.
    It baffles me why I can't do the local calls in some classes via InitialContext lookups.
    I will post test code next week.

  • File download via servlet doesn't work with IE via https

    I have a URL from a jsp page which points to a struts action servlet. This works with firefox via http and https. With IE it works via http but it doesn't work via https. The error message I get is "Internet Explorer cannot download ...File_name.doc from Server_name.
    Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later."
    Here is my code.
    public ActionForward execute(ActionMapping mapping, ActionForm form,
                   HttpServletRequest request, HttpServletResponse response)
                   throws Exception {
              String attachmentURL = AppSettings.get("EAIAttachmentURL");
              String encodingScheme = AppSettings.get("EAI_encoding");
              String filename = request.getParameter("URL");
              String fileStr = URLEncoder.encode(filename, encodingScheme);
              fileStr = fileStr.replaceAll("\\+","%20");
              URL targetURL = new URL(attachmentURL + "/" + fileStr);
              URLConnection connection = targetURL.openConnection();
              connection.setDoInput(true);
              connection.setDoOutput(false);
              connection.setAllowUserInteraction(false);
              BufferedInputStream attachmentStream = new BufferedInputStream(
                        connection.getInputStream());
              * Setting the content disposition filename, so that the
              * attachment preserves the original filename
              response.setHeader("Content-Disposition",
                        " attachment; filename=" + filename);
              if (connection.getContentType() != null) {
                   response.setContentType(connection.getContentType());
              else {
                   response.setContentType("application/octet-stream");
              response.setContentLength(connection.getContentLength());
              response.setHeader("Pragma", "public");
              response.setHeader("Cache-Control", "public, max-age=-1, must-revalidate");
              if ( connection.getContentEncoding() != null ) {
                   response.setHeader("Content-Encoding",
                             connection.getContentEncoding());
              BufferedOutputStream responseStream = new BufferedOutputStream(
                        response.getOutputStream());
              byte[] buffer = new byte[4096];
              int bytesRead;
              try {
                   while ((bytesRead = attachmentStream.read(buffer)) != -1) {
                        responseStream.write(buffer, 0, bytesRead);
              } catch (Exception e) {
                   log.error("AttachmentProxy error: " + e.getMessage());
              } finally {
                   if (attachmentStream != null) {
                        attachmentStream.close();
                   if (responseStream != null) {
                        responseStream.flush();
                        responseStream.close();
              return null;
    There is a bug with IE when downloading via https according to Microsoft support site. Refer to http://support.microsoft.com/default.aspx?scid=kb;en-us;812935
    According to this bug, I have set the response header - "pragma" to public and "cache-control" to public. I've also unchecked the Do not save encrypted pages to disk setting in IE Options, Advanced tab.
    Has anyone come across this problem or a similar problem. Any help is appreciated. Thanks.

    I have a URL from a jsp page which points to a struts action servlet. This works with firefox via http and https. With IE it works via http but it doesn't work via https. The error message I get is "Internet Explorer cannot download ...File_name.doc from Server_name.
    Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later."
    Here is my code.
    public ActionForward execute(ActionMapping mapping, ActionForm form,
                   HttpServletRequest request, HttpServletResponse response)
                   throws Exception {
              String attachmentURL = AppSettings.get("EAIAttachmentURL");
              String encodingScheme = AppSettings.get("EAI_encoding");
              String filename = request.getParameter("URL");
              String fileStr = URLEncoder.encode(filename, encodingScheme);
              fileStr = fileStr.replaceAll("\\+","%20");
              URL targetURL = new URL(attachmentURL + "/" + fileStr);
              URLConnection connection = targetURL.openConnection();
              connection.setDoInput(true);
              connection.setDoOutput(false);
              connection.setAllowUserInteraction(false);
              BufferedInputStream attachmentStream = new BufferedInputStream(
                        connection.getInputStream());
              * Setting the content disposition filename, so that the
              * attachment preserves the original filename
              response.setHeader("Content-Disposition",
                        " attachment; filename=" + filename);
              if (connection.getContentType() != null) {
                   response.setContentType(connection.getContentType());
              else {
                   response.setContentType("application/octet-stream");
              response.setContentLength(connection.getContentLength());
              response.setHeader("Pragma", "public");
              response.setHeader("Cache-Control", "public, max-age=-1, must-revalidate");
              if ( connection.getContentEncoding() != null ) {
                   response.setHeader("Content-Encoding",
                             connection.getContentEncoding());
              BufferedOutputStream responseStream = new BufferedOutputStream(
                        response.getOutputStream());
              byte[] buffer = new byte[4096];
              int bytesRead;
              try {
                   while ((bytesRead = attachmentStream.read(buffer)) != -1) {
                        responseStream.write(buffer, 0, bytesRead);
              } catch (Exception e) {
                   log.error("AttachmentProxy error: " + e.getMessage());
              } finally {
                   if (attachmentStream != null) {
                        attachmentStream.close();
                   if (responseStream != null) {
                        responseStream.flush();
                        responseStream.close();
              return null;
    There is a bug with IE when downloading via https according to Microsoft support site. Refer to http://support.microsoft.com/default.aspx?scid=kb;en-us;812935
    According to this bug, I have set the response header - "pragma" to public and "cache-control" to public. I've also unchecked the Do not save encrypted pages to disk setting in IE Options, Advanced tab.
    Has anyone come across this problem or a similar problem. Any help is appreciated. Thanks.

Maybe you are looking for

  • Schedule line generation through MRP

    hi, Schedule lines are not generated through MRP. i Have Maintained all settings.standard PR is creating while running MRP.the SA account assignment category is Q(Project-make to order). is this is the reason for Not geneating Schedule lines? what ne

  • Dynamic File Name in Command Spool

    Hi, I am generating file using Spool in SQL Plus. Can I generate files using spool having name in format YYYYMMDD.txt, so that I can have unique files for each day. Thanks, Raja

  • Photoshop cs6 won't work because of creative cloud

    Hi everyone, I bought indesign on february 2nd, and now my old photoshop won't work. I had photoshop CS6. They will not help me in chat and I cannot figure it out. I know there is a way to go into my desktop applications and change some code thing be

  • 2 Macs and iPhoto

    I have an iCloud account and can easily sync my Photostream albums between my iMac and my iOS devices (phone and ipad). All are using the same iCloud sign in. All obviously have their own photo libraries and the shared Photostream. I can open and sav

  • I want to install a 512 GB SSD, but I can't get the screws off of the back!!!  Such an easy upgrade.  Who can I pay to do this for me?

    I just bought a 15" MBP 2.3 i7 quad.  I didn;t have enough money to buy an SSD when I ordered the MBP, but before it arrived, I scraped together thw money and ordered one, along with a "Data Doubler". I want to take the HD out, install the SSD, load