Vaib Gupta

Greenhorn
+ Follow
since May 11, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Vaib Gupta

Hi,

I am facing an issue while running AdviceClient.java. I have used source code from head first website and followed the deployment steps line by line in chapter 1. The issue is I recieve the following error:

WARNING: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: localhost; port: 3700"
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(Unknown Source)
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(Unknown Source)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(Unknown Source)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(Unknown Source)
at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(Unknown Source)
at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(Unknown Source)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(Unknown Source)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(Unknown Source)
at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69)
at com.sun.enterprise.naming.SerialContext.narrowProvider(SerialContext.java:89)
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:128)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:288)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at AdviceClient.go(AdviceClient.java:22)
at AdviceClient.main(AdviceClient.java:14)
Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:336)
... 14 more
Caused by: java.net.ConnectException: Connection refused
at sun.nio.ch.Net.connect(Native Method)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:460)
at java.nio.channels.SocketChannel.open(SocketChannel.java:146)
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:320)
... 14 more

I think there is some port number issue for iiop. It says 3700. But j2ee is running on 1050. Is this port number issue or am I messing up something in my code? First chapter has really taken a toll on me......Looking forward to some help.

Regards,
Vaibhav
Hey I tried this piece of code and it works for me. When you use <jsp:useBean> it will create a new instance of the bean if not found in the mentioned scope. May be the instance variables of your bean are initialized by default. The new bean instance will have default values.
12 years ago
JSP
Please correct me if I have not understood your problem. You want to access 'bean' in your servlet. Isn't 'bean' set as a session attribute when you specify

<jsp:useBean id="bean" class="com.hrms.servlet.UserBean" scope="session" >

I think you can directly access this attribute using getAttribute() method.
12 years ago
JSP
May be a tool like 'fiddler' might help you to check out request and response.
I have a very simple example here. Make two jsps, for instance DemoFlush.jsp and errorProne.jsp. DemoFlush.jsp code goes like this:

<html>
<body>
Some text here
<jsp:include page="errorProne.jsp" flush="true"/>
</body>
</html>

errorProne.jsp code is like this:

<%= 0/0%>

When you access the page DemoFlush.jsp with flush attribute set to true, you'll be able to see the "Some text here" text. However if flush is set to false, you will get an exception. So in a way before including the page, flush attribute writes the code of the included page in the response. I hope this clears some doubts...
I hope I'm not disturbing the norm here but I wish to reply to Aruna's post. I can only think of 1 and 2 as the correct answers. Please PM me for 3rd answer.
Request.getHeaders(String) returns an Enumeration. So I think it should return the values as individual strings. However I have one basic doubt. Suppose I define a custom header say 'demoHeader' and set it in response like this:

response.addHeader('demoHeader', 'demoValue')

Now from where can I read this header value? The header will remain till the response has been sent to the browser. The subsequent request will not contain this header. This scenario might not have any significance in real life but I'm just curious...
You can set those attributes through server side. Once you submit the page to the server you may get the required values through request.getParameter() and then set it to the session.
May be a combination of CSS and JSP should do the trick.
12 years ago
JSP
May be you will have to include some server side code in this. First time when you load the page neither of your divs are visible. Some flag can be set which is initially false for both the divs. Once you open DIV2 and submit the page pass one request attribute after hitting the DB which jsp can read and display the div.
May be something like:

<div style="display: <%=request.getAttribute('someFlag') %>" >....</div>

I am not sure of the syntax though but something like this might work.
Ok...So you mean to say that the object returned has a reference type of JspContext but is actually an instance of PageContext...
13 years ago
JSP
But I have one basic doubt. How did this approach work? PageContext is a child of JspContext. And PageContext has extra methods such as getRequest() which are not defined for JspContext. If I cast an object of JspContext into PageContext and access getRequest from this instance, shouldn't I get a run time exception? How can the object of JspContext access a method which it has not defined? Is this some kind of a new trick?
13 years ago
JSP
Sorry for the mistake. My container is ignoring all the body-content settings and taking 'scriptless' as the value. I know for tomcat the default is 'JSP' for tags, but I'm not sure why this behavior is occurring. Thanks for your reply. I will update with my findings.
I think this would be more of an SCJP issue. ...Everthing would be decided on run time. If 'emp' has an extra property so would the underlying object of referred by 'person'...And as for any name defined in person, it would be again governed by the underlying object unless the property is static...
Hi,

I have been trying to figure out why the following situation is arising in <body-content>empty</body-content>. If I provide the entry in tld then specifying a content in the body of the tag should give an exception, but it's working smoothly in my case. Please see the following snippets:

Code from the tld:

<tag>
<name>advice</name>
<tag-class>com.example.AdvisorTagHandler</tag-class>
<body-content>empty</body-content>
<attribute>
<name>user</name>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>

Code from the tag handler:

public void doTag() throws JspException, IOException{
getJspBody().invoke(null);
}

Code from the jsp using tag:

<mine:advice>
Content should not print...
</mine:advice>

When I debug the tag handler, getJspBody() does not return null. I am using Tomcat 6.0. Is it container specific property? Please help, this trivial issue has taken my lot of time.