Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!

alex mueer

Greenhorn
+ Follow
since Jul 17, 2008
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 alex mueer

Hi Guys,

I managed eventually and that is a big relief.

The problem? Well, A combination of a bug, my silliness :roll: and a wrong version of software.

I chose j2sdk1.4.1_06 and j2sdkee1.3.1. To your horror, I did not let the server run while running the client ( I know you say: �how stupid!�) That is why I got wrong error messages. At last, I noticed there is a bug in RI implementation according to �Jayant Kulkarni�. (https://coderanch.com/t/158675/java-EJB-SCBCD/certification/HeadFirst-EJB-java-rmi-RemoteException)

A complete explanation of the bug can be found at http://www.wickedlysmart.com/HeadFirst/HeadFirstEJB/HeadFirstEJBNotes.html.

I would like to thank you who spend some of your valuable time to advice guys like me.

Best regards,

Al
Hi,

When running client, in my previous attempts, the j2ee server was not running. However when I run the server the following error messages appear:


C:\projects\advice>java AdviceClient
javax.naming.CommunicationException: java.rmi.MarshalException: CORBA MARSHAL 13
98079699 Maybe; nested exception is:
org.omg.CORBA.MARSHAL: Unable to read value from underlying bridge : Custom marshaling of RMI:java.lang.Throwable:F8678B4F4D2EB705 5C635273977B8CB not
compatible with local class (local class not custom marshal capable) minor code
: 1398079699 completed: Maybe
org.omg.CORBA.MARSHAL: Unable to read value from underlying bridge : Custom mars
haling of RMI:java.lang.Throwable:F8678B4F4D2EB705 5C635273977B8CB not compatible with local class (local class not custom marshal capable) minor code: 139807
9699 completed: Maybe
at com.sun.corba.ee.internal.iiop.CDRInputStream_1_0.read_value(CDRInput
Stream_1_0.java:1083)
at com.sun.corba.ee.internal.iiop.CDRInputStream.read_value(CDRInputStre
am.java:296)
at org.omg.stub.com.sun.enterprise.naming._SerialContextProvider_Stub.lo
okup(Unknown Source)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:120
)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at AdviceClient.go(AdviceClient.java:16)
at AdviceClient.main(AdviceClient.java:10)

at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:138
)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at AdviceClient.go(AdviceClient.java:16)
at AdviceClient.main(AdviceClient.java:10)


I appreciate any attempts to solve this problem.

Kind regards,


Al

Originally posted by Vijitha Kumara:
Did you set the iiop port correctly? (That may be one of the reasons) And When you are deploying the bean it ask you for a JNDI name (I think in J2EE RI 1.3), But if you are using SJSAS you have to do that in one of those tabs(can't remember what exactly,probably in the sun-specific-settings configuration in the deployment tool) after you have create the bean (before you actually deploy it).

Regards,



I set the bean JNDI name to advisor according to head first EJB. I do not know how to set the iiop port. Could you please give me some instruction?

Kind regards,

Al
Hi,

I went to deployment tool GUI. The JNDI name for my bean is advisor which I entered when deploying before. But the problem still remains.

Regards,

Al
Im so sorry I do not know how to do it. Can you give me some instructions plese?

Regards,

Al
Thank you very much for your reply.

I have used the verified version, however I face the following errors:


C:\projects\advice>java AdviceClient
javax.naming.CommunicationException: Cannot connect to ORB. Root exception is o
rg.omg.CORBA.COMM_FAILURE: minor code: 1398079490 completed: No
at com.sun.corba.se.internal.iiop.IIOPConnection.writeLock(IIOPConnectio
n.java:919)
at com.sun.corba.se.internal.iiop.IIOPConnection.send(IIOPConnection.jav
a:980)
at com.sun.corba.se.internal.iiop.IIOPOutputStream.invoke(IIOPOutputStre
am.java:76)
at com.sun.corba.se.internal.iiop.ClientRequestImpl.invoke(ClientRequest
Impl.java:74)
at com.sun.corba.se.internal.corba.ClientDelegate.invoke(ClientDelegate.
java:152)
at com.sun.corba.se.internal.corba.InitialNamingClient.resolve(InitialNa
mingClient.java:200)
at com.sun.corba.se.internal.corba.InitialNamingClient.cachedInitialRefe
rences(InitialNamingClient.java:265)
at com.sun.corba.se.internal.corba.InitialNamingClient.resolve_initial_r
eferences(InitialNamingClient.java:188)
at com.sun.corba.se.internal.corba.ORB.resolve_initial_references(ORB.ja
va:1393)
at com.sun.jndi.cosnaming.CNCtx.setOrbAndRootContext(CNCtx.java:254)
at com.sun.jndi.cosnaming.CNCtx.initUsingUrl(CNCtx.java:229)
at com.sun.jndi.cosnaming.CNCtx.initOrbAndRootContext(CNCtx.java:187)
at com.sun.jndi.cosnaming.CNCtx.<init>(CNCtx.java:71)
at com.sun.jndi.cosnaming.CNCtxFactory.getInitialContext(CNCtxFactory.ja
va:35)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
68)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246
)
at javax.naming.InitialContext.init(InitialContext.java:222)


What do you think the problem is?

Kind regards,

Al
Thank you so much for your reply.

I am still unable to get rid of the errors. To be honest I dont get what you meant.

Regards,

Al
Hi Vijitha,

Do you mean placing the peice of code in your previous post in the AdviceClient.java after TRY and comiling and running it? if yes, I did it and it produces two error messages as followings:

C:\projects\advice>javac AdviceClient.java
AdviceClient.java:15: cannot resolve symbol
symbol : class Properties
location: class AdviceClient
Properties env = new Properties();
^
AdviceClient.java:15: cannot resolve symbol
symbol : class Properties
location: class AdviceClient
Properties env = new Properties();
^
2 errors

I need to confess I am a begginer and that was my understanding. Could you please advice me as to what is wrong that I am doing?

Kind regards,

Al
Hi Guys,

I have found an answer to my problem. However I do not have a clear understanding as to what I need to do. The following is the advice:

javax.naming.CommunicationException: Can't find SerialContextProvider

This exception usually means the JNDI Server is not running, or possibly the JNDI properties for the server are incorrect.
javax.naming.NoInitialContextException:

Need to specify class name in environment or system property,
or as an applet parameter,
or in an application resource file:
java.naming.factory.initial



Could you please tell me what I need to do?

Kind regards,

Al
I use j2sdkee1.3.1. The followings are my classpath and path. I put AdviceAppClient.jar and j2ee.jar in the classpath manually.

CLASSPATH= .;C:\jdk1.3.0_02\bin;C:\j2sdkee1.3.1\bin;C:\jboss-4.2.2.GA\jboss-4.2.2.GA\bin;C:\j2sdkee1.3.1\lib\j2ee.jar;C:\j2sdkee1.3.1\lib\locale;C:\projects\advice\AdviceAppClient.jar

PATH= C:\jdk1.3.0_02\bin;C:\j2sdkee1.3.1\bin;C:\j2sdkee1.3.1\doc\api\javax;

Many thanks,

Al
Hi Guys,

I have successfully created a bean and deployed it in J2EE server. My next step according to the head first ejb is to create a client. I compiled AdviceClient successfully (Thanks to Vijitha). However when I try to run the compiled class I get the following error:



C:\projects\advice>java AdviceClient
javax.naming.CommunicationException: Can't find SerialContextProvider
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.jav
a:63)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:120
)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at AdviceClient.go(AdviceClient.java:16)
at AdviceClient.main(AdviceClient.java:10)



Could you please tell me what is going on?

The following is the class AdviceClient:

import javax.naming.*;
import java.rmi.*;
import headfirst.*;
import javax.rmi.*;
import javax.ejb.*;

public class AdviceClient{

public static void main (String[] args){
new AdviceClient().go();
}
public void go(){
try{

Context ic=new InitialContext();
Object o=ic.lookup("Advisor");

AdviceHome home=(AdviceHome) PortableRemoteObject.narrow(o, AdviceHome.class);

Advice advisor=home.create();
System.out.println(advisor.getAdvice());
}catch (Exception ex){
ex.printStackTrace();
}
}
}

Kind regards
Dear Vijitha,

Thank you so much for your help. It worked. you are great.

Thank you
Hi,

I have successfully created a bean and deployed it in J2EE server. My next step according to the head first ejb is to create a client. But when compiling the code for AdviceClient(the client) I get the following error message:

C:\projects\advice>javac AdviceClient.java
AdviceClient.java:15: cannot resolve symbol
symbol : class context
location: class AdviceClient
context ic=new InitialContext();
^
1 error

Please tell me what I am doing wrong. The following code is the code for AdviceClient.


import javax.naming.*;
import java.rmi.*;
import headfirst.*;
import javax.rmi.*;
import javax.ejb.*;

public class AdviceClient{

public static void main (String[] args){
new AdviceClient().go();
}
public void go(){
try{

context ic=new InitialContext();
Object o=ic.lookup("Advisor");

AdviceHome home=(AdviceHome) PortableRemoteObject.narrow(o, AdviceHome.class);

Advice advisor=home.create();
System.out.println(advisor.getAdvice());
}catch (Exception ex){
ex.printStackTrace();
}
}
}

Many thanks,
Al
Hi,

When I start j2ee server, I get the errors at the bottom. What seems to be the problem?

PATH=C:\jdk1.3.0_02\bin;C:\j2sdkee1.3.1\bin;
CLASSPATH=.;C:\jdk1.3.0_02\bin;C:\j2sdkee1.3.1\bin;
C:\jboss-4.2.2.GA\jboss-4.2.2.GA\bin
j2ee_home=C:\j2sdkee1.3.1
java_home=C:\jdk1.3.0_02

I desperatly need some help regarding this.

Thank you very much in advance.


Logging for J2EE Server Version: 1.3.1-b17 started at: Fri Jul 18 23:44:18 GMT+01:00 2008..
Using the Java HotSpot(TM) Client VM and the version number 1.3.0_02 from Sun Microsystems Inc..
VM is using the classpath: C:\j2sdkee1.3.1\lib\system\cloudscape.jar;C:\j2sdkee1.3.1\lib\system\tools.jar;C:\j2sdkee1.3.1\lib\cloudscape\RmiJdbc.jar;C:\j2sdkee1.3.1\lib\cloudscape\cloudclient.jar;C:\j2sdkee1.3.1\lib\classes;C:\j2sdkee1.3.1\classes;C:\j2sdkee1.3.1\lib\j2ee.jar;C:\j2sdkee1.3.1\lib\toolclasses;C:\j2sdkee1.3.1\lib\j2eetools.jar;C:\j2sdkee1.3.1\lib\locale;;C:\jdk1.3.0_02\lib\tools.jar;C:\j2sdkee1.3.1\lib\jhall.jar .
J2EE Home Directory has been set to: C:\j2sdkee1.3.1.


java.lang.NoSuchMethodError
at com.sun.corba.ee.internal.corba.AnyImpl.createTypeCodeForClass(AnyImpl.java:1256)
at com.sun.corba.ee.internal.iiop.ShutdownUtilDelegate.createTypeCode(ShutdownUtilDelegate.java:223)
at com.sun.corba.ee.internal.iiop.ShutdownUtilDelegate.writeAny(ShutdownUtilDelegate.java:178)
at javax.rmi.CORBA.Util.writeAny(Util.java:80)
at org.omg.stub.com.sun.enterprise.naming._SerialContextProvider_Stub.rebind(Unknown Source)
at com.sun.enterprise.naming.SerialContext.rebind(SerialContext.java:188)
at com.sun.enterprise.naming.SerialContext.rebind(SerialContext.java:202)
at javax.naming.InitialContext.rebind(InitialContext.java:370)
at com.sun.enterprise.naming.NamingManagerImpl.publishObject(NamingManagerImpl.java:192)
at com.sun.enterprise.naming.NamingManagerImpl.publishObject(NamingManagerImpl.java:149)
at com.sun.enterprise.server.J2EEServer.bindObject(J2EEServer.java:718)
at com.sun.enterprise.server.J2EEServer.createServerObject(J2EEServer.java:473)
at com.sun.enterprise.server.J2EEServer.run(J2EEServer.java:244)
at com.sun.enterprise.server.J2EEServer.main(J2EEServer.java:972)
Dear all,

I am a beginner trying to create ejbs using Head first ejb book. I am not able to start my j2ee server.

I keep facing the following error message when trying to start the server using j2ee �verbose command.

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\ali>j2ee -verbose
J2EE server listen port: 1050
Naming service started:1050
Exception in thread "main" java.lang.NoSuchMethodError
at com.sun.corba.ee.internal.corba.AnyImpl.createTypeCodeForClass(AnyIm
l.java:1256)
at com.sun.corba.ee.internal.iiop.ShutdownUtilDelegate.createTypeCode(S
utdownUtilDelegate.java:223)
at com.sun.corba.ee.internal.iiop.ShutdownUtilDelegate.writeAny(Shutdow
UtilDelegate.java:178)
at javax.rmi.CORBA.Util.writeAny(Util.java:80)
at org.omg.stub.com.sun.enterprise.naming._SerialContextProvider_Stub.r
bind(Unknown Source)
at com.sun.enterprise.naming.SerialContext.rebind(SerialContext.java:18
)
at com.sun.enterprise.naming.SerialContext.rebind(SerialContext.java:20
)
at javax.naming.InitialContext.rebind(InitialContext.java:370)
at com.sun.enterprise.naming.NamingManagerImpl.publishObject(NamingMana
erImpl.java:192)
at com.sun.enterprise.naming.NamingManagerImpl.publishObject(NamingMana
erImpl.java:149)
at com.sun.enterprise.server.J2EEServer.bindObject(J2EEServer.java:718)
at com.sun.enterprise.server.J2EEServer.createServerObject(J2EEServer.j
va:473)
at com.sun.enterprise.server.J2EEServer.run(J2EEServer.java:244)
at com.sun.enterprise.server.J2EEServer.main(J2EEServer.java:972)



The followings are the setting on my pc.

user variable

PATH=C:\j2sdk1.4.0\bin;C:\j2sdkee1.3.1\bin;

CLAssPATH=.;C:\jdk1.3.0_02\bin;C:\j2sdkee1.3.1\bin;C:\j2sdkee1.3.1\lib\j2ee.jar;
C:\j2sdkee1.3.1\lib\locale;C:\Program Files\Java\jre1.6.0_02\bin;

system variable

PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;
C:\jdk1.3.0_02\bin;C:\j2sdkee1.3.1\bin;

CLASSPATH=.;C:\jdk1.3.0_02\bin;C:\j2sdkee1.3.1\lib\j2ee.jar;
C:\Program Files\Java\jre1.6.2_02\bin;


j2ee_home=C:\j2sdkee1.3.1
java_home=C:\jdk1.3.0_02

Could you please help me as I have been spending more than one week trying to figure it out without any success.

Many thanks in advance.

Al