Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!

Rajesh Khan

Ranch Hand
+ Follow
since Oct 16, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
3
Received in last 30 days
0
Total given
13
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rajesh Khan

I am using Netbeans and am experimenting with EJBs.

I have two projects (2 separate applications)

1- A J2EE Project called EnterpriseApp

2- A standard J2SE Project called Test

Now Here is what I did - in EnterpriseApp I generated a stateless EJB called TestEJB with both local and remote interfaces. For the remote project selection I selected the Test App. In short the bean code looks like this


And in the J2SE client Project here is my main class through which i am trying to access the bean



This is the contents of JNDI.properties file

java.naming.factory.initial = com.sun.enterprise.naming.SerialInitContextFactory
java.naming.factory.url.pkgs = com.sun.enterprise.naming
java.naming.factory.state = com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl
#optional. Defaults to localhost. Only needed if web server is running
#on a different host than the appserver
org.omg.CORBA.ORBInitialHost = localhost
#optional. Defaults to 3700. Only needed if target orb port is not 3700.
org.omg.CORBA.ORBInitialPort = 3700

And I get this error at
TestEjbRemote testEJB = (TestEjbRemote) ctx.lookup("stateless.TestEjbRemote");




Any suggestions on how i may resolve this issue ?


I cant seem to call the controller (DisplayIncomeAction) from my struts.xml


Any suggestions ?
5 years ago
I ran my first struts2 example from http://www.vaannila.com/struts-2/struts-2-example/object-backed-java-beans-example-1.html which just displayed a form and echoed the contents back and I had a pretty basic question , I dont see the program attaching anything to the request object at the same time I read that using httpRequest object in struts2 is not a good practice.What I want to know is how is the object being attached and to what is it being attached to since its being accessed by the result page?


The struts.xml is


The form submitted calls the UserAction which is



and the echo form is
5 years ago
I am completely new to struts and I am trying to integrate it into my project.

I created an action called LoginAction and inserted it into the web.xml as follows:


I then placed struts-config.xml next to my web.xml with the following content


But when I submit a form with action="login.do"
I get the following:

Any suggestions what might be going wrong ?
5 years ago
The problem is resolved if i use <div class = "msg"> ... </div> instead of <p> . Hope someone could tell me why <p> doesnt work
5 years ago
JSP

The behavior of the above code regarding mixing of CSS with generated HTML is confusing me. According to my understanding no matter what condition is accepted (ConditionA or ConditionB) the generated HTML in both cases should be inside the class "msg" however I am getting different results. ConditionB only gets enclosed in the class msg whereas condition A in which a table is generated is placed below the class "msg" (i.e the class is closed and then the table starts) Could anyone tell me whats going on?
5 years ago
JSP
Here what i tried. Unfortunately its not working
C:\jibx>java -cp C:\jibx\tutorial example25.Test
6 years ago
I am getting the following error , does anyone know what i am doing wrong

6 years ago
Here is the output that i get
C:\jibx\tutorial\example24\example>dir
Volume in drive C is WINDOWS
Volume Serial Number is 1C8F-663E

Directory of C:\jibx\tutorial\example24\example

05/06/2012 06:16 PM <DIR> .
05/06/2012 06:16 PM <DIR> ..
05/06/2012 06:16 PM 1,122 Address.class
05/06/2012 04:04 PM 3,445 Address.java
05/06/2012 06:16 PM 748 Customer.class
05/06/2012 04:04 PM 1,761 Customer.java
05/06/2012 06:16 PM 757 Item.class
05/06/2012 04:04 PM 1,876 Item.java
05/06/2012 04:54 PM 4,872 Order.java
05/06/2012 06:16 PM 1,022 Shipping.class
05/06/2012 04:04 PM 877 Shipping.java
10 File(s) 18,590 bytes
2 Dir(s) 160,025,100,288 bytes free

C:\jibx\tutorial\example24\example>C:\"Program Files"\Java\jdk1.7.0\bin\javac Order.java
Order.java:33: error: cannot find symbol
private Customer customer;
^
symbol: class Customer
location: class Order
Order.java:34: error: cannot find symbol
private Address billTo;
^
symbol: class Address
location: class Order
Order.java:35: error: cannot find symbol
private Shipping shipping;
^
symbol: class Shipping
location: class Order
Order.java:36: error: cannot find symbol
private Address shipTo;
^
symbol: class Address
location: class Order
Order.java:37: error: cannot find symbol
private List<Item> itemList = new ArrayList<Item>();
^
symbol: class Item
location: class Order
Order.java:65: error: cannot find symbol
public Customer getCustomer() {
^
symbol: class Customer
location: class Order
Order.java:74: error: cannot find symbol
public void setCustomer(Customer customer) {
^
symbol: class Customer
location: class Order
Order.java:83: error: cannot find symbol
public Address getBillTo() {
^
symbol: class Address
location: class Order
Order.java:92: error: cannot find symbol
public void setBillTo(Address billTo) {
^
symbol: class Address
location: class Order
Order.java:101: error: cannot find symbol
public Shipping getShipping() {
^
symbol: class Shipping
location: class Order
Order.java:110: error: cannot find symbol
public void setShipping(Shipping shipping) {
^
symbol: class Shipping
location: class Order
Order.java:119: error: cannot find symbol
public Address getShipTo() {
^
symbol: class Address
location: class Order
Order.java:128: error: cannot find symbol
public void setShipTo(Address shipTo) {
^
symbol: class Address
location: class Order
Order.java:137: error: cannot find symbol
public List<Item> getItemList() {
^
symbol: class Item
location: class Order
Order.java:146: error: cannot find symbol
public void setItemList(List<Item> list) {
^
symbol: class Item
location: class Order
Order.java:37: error: cannot find symbol
private List<Item> itemList = new ArrayList<Item>();
^
symbol: class Item
location: class Order
16 errors

C:\jibx\tutorial\example24\example>
6 years ago
6 years ago
Note a.java , b.java and c.java are in the same folder
6 years ago
HI i have 3 java files

I managed to generate .class files for both a and b using

but when i do the same for c.java I get the error
error: cannot find symbol b and c
Any suggestions on how i could solve this problem ?
6 years ago
The following bind command works if the source files are next to bind.xml

java -jar C:\jibx\lib\jibx-bind.jar example24\binding.xml

How would i make the above command work if the generated java files were created say in a folder called "example" thus having a "package example" on top of them ?
Hi is there a way by which i can generate a random no between a specific range.
I read that the class allows you to generate no between 0-n ie.(0-65) what if i want to generate random nos between 55-65 ??
6 years ago