Sun One EJB problem - PortableRemoteObject.narrow ClassCastException...
Hi all,
I'm using Sun One app server 7 for the first time and am having a bit of difficulty. I have deployed a very simple EAR containing one stateless session bean just to test it. The ear appears to have deployed correctly but PortableRemoteObject.narrow is throwing a ClassCastException when trying to do a remote lookup on the bean.
I'm using the following env settings...
initialContextFactory = com.sun.enterprise.naming.SerialInitContextFactory
providerUrl = iiop://127.0.0.1:3700The lookup appears to work okay - this line of code executes successfully
Object objref = initialContext.lookup(jndiHomeName);...objref appears to initalise succesfully (if I toString() it I get an iiop stream of some sort). However, it is the next line that is failing...
Object obj = PortableRemoteObject.narrow(objref, homeClass);...this is the exception I get...
java.lang.ClassCastException
at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(Unknown Source)
at javax.rmi.PortableRemoteObject.narrow(Unknown Source)
at com.scorlog.ServiceLocator.getRemoteHome(ServiceLocator.java:145)Furthermore, when PortableRemoteObject.narrow() executes, I get the following console exception on the server...
com.sun.corba.ee.internal.core.DuplicateServiceContext
at com.sun.corba.ee.internal.core.ServiceContexts.put(ServiceContexts.java:208)
at com.sun.corba.ee.internal.iiop.ServerRequestImpl.getServiceContextsForReply(ServerRequestImpl.java:258)
at com.sun.corba.ee.internal.iiop.ServerRequestImpl.createResponse(ServerRequestImpl.java:89)
at com.sun.corba.ee.internal.POA.SubcontractResponseHandler.createReply(SubcontractResponseHandler.java:50)
at org.omg.CosNaming.NamingContextExtPOA._invoke(NamingContextExtPOA.java:377)
at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatchToServant(GenericPOAServerSC.java:569)
at com.sun.corba.ee.internal.POA.GenericPOAServerSC.internalDispatch(GenericPOAServerSC.java:211)
at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatch(GenericPOAServerSC.java:113)
at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:275)
at com.sun.corba.ee.internal.iiop.RequestProcessor.process(RequestProcessor.java:83)
at com.iplanet.ias.corba.ee.internal.iiop.ServicableWrapper.service(ServicableWrapper.java:25)
at com.iplanet.ias.util.threadpool.FastThreadPool$ThreadPoolThread.run(FastThreadPool.java:288)
at java.lang.Thread.run(Thread.java:534)
FINE: No SAS context element found in service context listI have seen the forum that other users have had similar problems and the suggestion was that the client can't see the ejb stubs. I don't think this is the problem in my case as I deployed the same ear on weblogic 7 (obviously substituting sun-ejb-jar.xml for a weblogic-ejb-jar.xml) and successfully executed the same client code for the remote lookup.
My feeling is that the problem revolves around the JNDI binding. Could it be the case that even though the object is binding properly, the app server doesn't realise it is an ejb and not a jdbc/jms/mail object? The documentation gives details on looking up a JDBC, javamail, URL, JMS resource (http://docs.sun.com/source/817-2177/djjndi.html) but not ejb so I could be doing something simple wrong here...
My sun-ejb-jar.xml is as follows....
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated by XDoclet -->
<sun-ejb-jar>
<enterprise-beans>
<ejb>
<ejb-name>SBTest</ejb-name>
<jndi-name>ejb/SBTestBean</jndi-name>
</ejb>
</enterprise-beans>
</sun-ejb-jar>However, I noticed on another thread, a user had some additional elements under their <ejb> tag like this...
<?xml version="1.0" encoding="UTF-8"?>
<sun-ejb-jar>
<enterprise-beans>
<name>Ejb1</name>
<ejb>
<ejb-name>HelloBean</ejb-name>
<jndi-name>HelloBean</jndi-name>
<ejb-ref>
<ejb-ref-name>ejb/helloBean</ejb-ref-name>
<jndi-name>HelloBean</jndi-name>
</ejb-ref>
</ejb>
</enterprise-beans>
</sun-ejb-jar>However, when I tried to add and <ejb-ref> element to my xml doc the ear failed to deploy. This is the error I get in the admin console...
Error
Deployment Error -- Error while running ejbc -- Fatal Error from EJB Compiler -- --
Failed to load deployment descriptor for: testApp cause: Error converting J2EE-
specific ejb xml to object representation: testApp.jar app_testApp Generated by
XDoclet This bean has no ejb reference by the name of [ejb/SBtest]
ejb/SBTestSBTestThis problem is eating up my time and being made all the more frustrating by the fact that a) it deploys on weblogic and b) the documentation is terrible. Even the sample application that comes with sun one only provides the .class files for the code that does the ejb look up and not the .java so you can't see how they hell they do it!
Unfortunately I am tied to using Sun One so I really need to solve this problem fast. If anyone can provide any help I'd greatly appreciate it.
Cheers,
John :)
I am having the same problem after upgrading to Sun One from iplanet. Any clue?
Similar Messages
-
MySQL & Sun ONE studio problem
hello all,
It seemed like I've got the data source & database driver stuff setup to work with MySQL database in Sun ONE studio. However, when I tried to run the helloworld_TestApp (CMP App), I've got the SQL syntax error. I tried to look at the sun-j2ee-ri.xml, and it looked just fine to me.. please help.
Here is the XML descriptor
<?xml version="1.0" encoding="UTF-8"?>
<j2ee-ri-specific-information>
<server-name></server-name>
<rolemapping/>
<web>
<display-name>helloworld_TestApp</display-name>
<servlet>
<servlet-name>dispatch</servlet-name>
</servlet>
<servlet>
<servlet-name>error</servlet-name>
</servlet>
<servlet>
<servlet-name>viewer</servlet-name>
</servlet>
<context-root>helloworld_TestApp</context-root>
<ejb-ref>
<ejb-ref-name>ejb/TestedEJB</ejb-ref-name>
<jndi-name>helloworld</jndi-name>
</ejb-ref>
</web>
<enterprise-beans>
<unique-id>1</unique-id>
<ejb>
<ejb-name>helloworld</ejb-name>
<jndi-name>helloworld</jndi-name>
<ejb20-cmp>
<sql-statement>
<operation>loadRow</operation>
<sql>SELECT "lastname" FROM "helloworld" WHERE "firstname" = ? </sql>
</sql-statement>
<sql-statement>
<operation>storeRow</operation>
<sql>UPDATE "helloworld" SET "lastname" = ? WHERE "firstname" = ? </sql>
</sql-statement>
<sql-statement>
<operation>deleteRow</operation>
<sql>DELETE FROM "helloworld" WHERE "firstname" = ? </sql>
</sql-statement>
<sql-statement>
<operation>deleteTable</operation>
<sql>DROP TABLE "helloworld"</sql>
</sql-statement>
<sql-statement>
<operation>findByPrimaryKey</operation>
<sql>SELECT "firstname" FROM "helloworld" WHERE "firstname" = ? </sql>
</sql-statement>
<sql-statement>
<operation>createRow</operation>
<sql>INSERT INTO "helloworld" ( "firstname" , "lastname" ) VALUES ( ? , ? )</sql>
</sql-statement>
<sql-statement>
<operation>createTable</operation>
<sql>CREATE TABLE "helloworld" ("firstname" VARCHAR(255) NOT NULL , "lastname" VARCHAR(255), CONSTRAINT "pk_helloworl" PRIMARY KEY ("firstname") )</sql>
</sql-statement>
<create-table-deploy>true</create-table-deploy>
<delete-table-undeploy>false</delete-table-undeploy>
</ejb20-cmp>
<principal>
<name></name>
</principal>
<ior-security-config>
<transport-config>
<integrity>supported</integrity>
<confidentiality>supported</confidentiality>
<establish-trust-in-target>supported</establish-trust-in-target>
<establish-trust-in-client>supported</establish-trust-in-client>
</transport-config>
<as-context>
<auth-method>username_password</auth-method>
<realm>default</realm>
<required>true</required>
</as-context>
<sas-context>
<caller-propagation>supported</caller-propagation>
</sas-context>
</ior-security-config>
</ejb>
<cmpresource>
<ds-jndi-name>jdbc/MySQL</ds-jndi-name>
<default-resource-principal>
<name>root</name>
<password>root</password>
</default-resource-principal>
</cmpresource>
</enterprise-beans>
</j2ee-ri-specific-information>
And here is the error message:
The exception java.rmi.ServerException was thrown when invoking findByPrimaryKey with parameters:
thinh
Following is the stack trace:
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: java.rmi.RemoteException: nested exception is: java.sql.SQLException: Syntax error or access violation: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '"helloworld" WHERE "firstname" = 'thinh'' at line 1; nested exception is: java.sql.SQLException: Syntax error or access violation: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '"helloworld" WHERE "firstname" = 'thinh'' at line 1 at com.sun.corba.ee.internal.javax.rmi.CORBA.Util.wrapException(Util.java:345) at javax.rmi.CORBA.Util.wrapException(Util.java:277) at ..
...more and more..Where are you running your application? I assume you
are running your application on RI. Are you running
on RI or S1AS?I am running my application on R1, is there a problem with it? can the S1AS solve the problem?
Thanks & regards,
Tim -
HELP PLEASE: Tomcat 3 - Sun ONE Migration Problems
Hi everybody. We are new Sun One users. We are trying unsuccessfully to migrate our tomcat application to this environment. in order to deploy it we have created a WAR file from the Netbeans Ide and we are trying to load it into Sun One AS... but it seems there is something wrong with the process becouse we don't have access to the defined jdbc resources. Any help would be very apreciated... and please, excuse my English.
Javier MorenoThanks a lot of for your fast answer, but we haven't don't too much progress...
dbping shows a message about "java.lang.NoSuchMethodException: setdataSourceName"
wich probably means mysql driver isn't fully implemented. anyway i will try
to describe the steps we make to create de pool hoping you will be able to
help us...
That's what we do:
- first, we create a Connection pool:
name -> MySQLPool
database vendor -> Other
datasource class -> com.mysql.jdbc.jdbc2.optional.MysqlDataSource
serverName -> localhost
portNumber -> 3306
user -> test
password -> test
databasename -> jdbc:mysql://localhost/pol
datasourcename -> pol
- then, we define the resource:
jndi name -> jdbc/jdbc-pol01
pool name -> MySQLPool
data source enabled -> true
- in the web.xml of the application we got (just before /webapp):
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/jdbc-pol01</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
- and we obtain the connection with a chunk of code like this:
ctx = new InitialContext();
dsName = "java:comp/env/jdbc/jdbc-pol01";
ds = (javax.sql.DataSource) ctx.lookup(dsName);
con = ds.getConnection();
If we don't write the resource-ref element at web.xml it fails at the lookup
step (not finding the resource). but when we add the element the appserver
claims "Error loading new module in virtual server: javax.naming.InvalidNameException: Real jndi name cannot beempty for jdbc/jdbc-polds.
We don't know what to do and the death line is comming here fast... any help
would be very much apreciated.
Thanks in advance, good karma.
jv -
ClassCastException while PortableRemoteObject.narrow
Hello,
I am getting the ClassCastException when I am narrowing the looked up home object.
Here is the exception:
java.lang.ClassCastException
at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:293)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
at samples.ejb.client.HelloClient.main(HelloClient.java:50)
Here is the code :
try {
System.out.println("Looking up greeter bean home interface");
String JNDIName = "HelloGreet";
System.out.println("Looking up: " + JNDIName);
Object objref = initContext.lookup(JNDIName);
System.out.println("Object from the look up -->"+objref);
home = (HelloHome)javax.rmi.PortableRemoteObject.narrow(objref, HelloHome.class);
any help appreciated. Thanks in advance
With Regards,
J. P. NaiduHi Pullaiah,
I've same problem with Sun ONE AS (notice that I encounter same problem on J2EE Reference Implementation too).I looked up for a solution everywhere but I did't find it and I'd be very happy if someone could post one.
Thanks ,
Fil -
ClassCastException in PortableRemoteObject.narrow inside Weblogic
Hello,
I'm trying to invoke EJB residing on WLS 6.1 SP2 server from EJB on another exacly
the same server.
Properties properties = new Properties();
properties.put(javax.naming.Context.PROVIDER_URL, "t3://host:7001");
properties.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
ivjInitContext = new InitialContext(properties);
Object homeObject = ivjInitContext.lookup("jndiName");
BeanHome home = (BeanHome)PortableRemoteObject.narrow(homeObject,BeanHome.class);
And I get java.lang.ClassCastException: $Proxy74
on narrow line.
Everything works fine when I invoke the same code from regular java application
instead of EJB.Is it the ClassLoader problem ?
Does any workaround exists ?
Thank you.How are you generating your stubs? i.e. are you using the -iiop option? if so
then you would need to call the EJB in question using iiop://host:7001. So you
can either take out the iiop option and recompile the stubs or change the call
to iiop but then you would also need to replace this line: properties.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
with this (javax.naming.Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.cosnaming.CNCtxFactory");
hope this helps!
-geoff.
"Elena Neroslavskaya" <[email protected]> wrote:
>
Hello,
I'm trying to invoke EJB residing on WLS 6.1 SP2 server from EJB on another
exacly
the same server.
Properties properties = new Properties();
properties.put(javax.naming.Context.PROVIDER_URL, "t3://host:7001");
properties.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
ivjInitContext = new InitialContext(properties);
Object homeObject = ivjInitContext.lookup("jndiName");
BeanHome home = (BeanHome)PortableRemoteObject.narrow(homeObject,BeanHome.class);
And I get java.lang.ClassCastException: $Proxy74
on narrow line.
Everything works fine when I invoke the same code from regular java application
instead of EJB.Is it the ClassLoader problem ?
Does any workaround exists ?
Thank you. -
Classcastexception on portableremoteobject narrow
I was successfully connecting to an EJB on my WebLogic server from a Java
IDL client using the iiop protocol, cosnaming initialcontextfactory. I'm at
a loss as to what is different now that is causing this to fail. I'm sure
it has something to do with how I'm generating the stubs and/or the
client/server classpath, but can't see what I'm doing wrong now. My steps
are as follows.
1) Create the EJB jar (call it jar1) using weblogic.ejbc
2) Run jar1 through weblogic.ejbc using -idl -iiop, creating jar2
3) Deploy jar2 in the java client's classpath
I get the initial context fine, but when I get to this line:
_home = (myHome)(PortableRemoteObject.narrow(ctx, myHome.class));
I get the following error:
java.lang.ClassCastException
at
com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemo
teObject.java:296)
Can anyone give me some assistance?
Thx!
Sandy BarlettaOk, here's what's going on here. The problem happens when I use
com.sun.jndi.cosnaming.CNCtxFactory as my initial context factory. After the
lookup of the home interface, what I get back in my context object if I call
getClass().getName() is the following:
com.sun.jndi.cosnaming.CNCtx
The class cast exception occurs when I try to narrow this to my home
interface.
If I use weblogic.jndi.WLInitialContextFactory instead of
com.sun.jndi.cosnaming.CNCtxFactory, what I get back in my context object if
I call getClass().getName() is
com.sun.corba.se.internal.iiop.CDRInputStream$1 and the narrow succeeds.
What gives? Do I have to use the weblogic context factory? I was hoping to
avoid the need for weblogic packages on the client. Also, our whole reason
for using IIOP was to avoid compatibility problems between weblogic servers
running at different version levels. If I have to use the weblogic context
factory, and we have a weblogic client running at a different version from
the server, will there be problem?
Sandy Barletta
"Sandy Barletta" <[email protected]> wrote in message
news:[email protected]...
I was successfully connecting to an EJB on my WebLogic server from a Java
IDL client using the iiop protocol, cosnaming initialcontextfactory. I'mat
a loss as to what is different now that is causing this to fail. I'm sure
it has something to do with how I'm generating the stubs and/or the
client/server classpath, but can't see what I'm doing wrong now. My steps
are as follows.
1) Create the EJB jar (call it jar1) using weblogic.ejbc
2) Run jar1 through weblogic.ejbc using -idl -iiop, creating jar2
3) Deploy jar2 in the java client's classpath
I get the initial context fine, but when I get to this line:
_home = (myHome)(PortableRemoteObject.narrow(ctx, myHome.class));
I get the following error:
java.lang.ClassCastException
at
com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemo
teObject.java:296)
Can anyone give me some assistance?
Thx!
Sandy Barletta -
PortableRemoteObject.narrow throws ClassCastException
Hi Friends,
I am trying to access home interface of a stateless session EJB from an Applet running in JRE 1.3.1 in IE. My EJB is running in WebLogic Server 6.1. I am getting a cast error while narrowing the remote home interface. My server and client are running on the same machine though they are in different JVMs. I was able to access this remote home interface in a simple test program running from command line.
This session bean accesses other entity beans deployed in the same WebLogic server, if that has anything to do with it.
Following is the error callstack:
java.lang.ClassCastException
at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:296)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
Any help in resolving this issue will be greatly appreciated.
Thanks,
Krishna.Hello
I have same problem in Java Web Start.
This Situation is same.
I report the result of my investigation.
I'm having a problem in lookup remote object when using JWS.
My application runs normally in Java Application without JWS.
I'm using BEA WebLogic Server 6.1.
My application acts in EJB client application.
But my application runs normally in WebLogic Server 6.0 and JWS.
When I cast remote object to my interface, I encountered this kind of error.
java.lang.ClassCastException
at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow
at javax.rmi.PortableRemoteObject.narrow
While using WebLogic Server 6.0, I include stub classes in my jar file.
But in WebLogic Server 6.1, ejbc does not generate stub classes.
WebLogic uses Dynamic proxy technology in JDK 1.3 for this purpose.
So, EJB client conflict with sand box security policy...
When I add the following line to javaws.policy file,
my application runs without problem.
permission java.io.SerializablePermission "enableSubstitution";
Is everyone suffering from this kind of problem?
Is this problem improved in the future?
I need more information about this problem.
I am not sure, this is specification.
Thanks in advance
Hiroki -
Hi,
I have a problem with a JNDI -lookup() using the CORBA namig system.
After looking up: System.out.println( lookup("jndi-name") );
I get an IOR: IOR:0000000000000053524d493a...............
ok
then I print out the name and the package of this object:
Object o = lookup("jndi-name");
System.out.println("name of o : " + o.getClass().getName());
System.out.println("package of o : " + o.getClass().getPackage());
and get:
name of o : com.sun.corba.ee.impl.corba.CORBAObjectImpl
package of o : package com.sun.corba.ee.impl.corba
I expected the type of a Home-Interface, so that i could narrow the object o:
PortableRemoteObject.narrow( o , classname);
and the result is a:
java.lang.ClassCastException
at com.sun.corba.ee.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:293)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)........
What's wrongThe most likely reason is that the stubs for that home interface are not being found. Double-check your classpath to make sure they are available to the code at runtime.
-ken -
ClassCastException with PortableRemoteObject.narrow call
I want to call an ejb component located on a different machine and I can not get it to work. So I tried to deploy it under my version of jboss and try to invoke it. I was able to call it but when I added Context.PROVIDER_URL to my properties I get a classCastException.
String host = "jnp://localhost:1099";
props.setProperty(Context.PROVIDER_URL, host);
I started getting the following exception
2006-11-03 10:17:18,319 ERROR [STDERR] java.lang.ClassCastException
2006-11-03 10:17:18,319 ERROR [STDERR] at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narr
ow(PortableRemoteObject.java:229)
2006-11-03 10:17:18,319 ERROR [STDERR] at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObjec
t.java:137)
As soon as I uncomment that props.setProperty(Context.PROVIDER_URL, host);
line everything works fine.
I have seen this type of exception before when I tried invoking the ejb on a different computer as well. When I inspect the object with reflection I see that it found the right interface.
This is my code again:
Properties props = new Properties();
props.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.security.jndi.JndiLoginInitialContextFactory");
props.setProperty(Context.SECURITY_PRINCIPAL, "admin");
props.setProperty(Context.SECURITY_CREDENTIALS, "admin");
props.put(javax.naming.Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
String host = "jnp://localhost:1099";
props.setProperty(Context.PROVIDER_URL, host);
ctx = new InitialContext( props );
Object object = ctx.lookup( "ejb/com/blah/Manager" );
ManagerRemoteHome home = (ManagerRemoteHome)PortableRemoteObject.narrow ( object, ManagerRemoteHome.class);
ManagerRemote manager = home.create();
Thanks1099 is the RMI/JRMP Registry. You are using RMI/IIOP. Is this port number really correct?
-
Adding CMP-fields to a EJB in sun ONE studio 5
I have a CMP EJB, and initialized its fields against a table in a database (PointBase). When I later try adding additional fields, these fields naturally doesnt exist in the database.
Then i make a test-module for the CMP EJB. When I try mapping the CMP-fields, I get in trouble with the field that doesnt exist in the database-table.
How can I get around this problem, must I really manually update the database schema, or can I somehow "tell" SUN ONE studio to make the field for me.yes, but is there a way of letting J2EE handle all
this "Under the hood", so i dont even have to worry
about the internal datastructure in the database?You could drop the table from the database and then have Studio or deploytool create the tables (now with the additional fields) on deployment.
-Ian Evans
Sun Microsystems
J2EE Tutorial team -
Problem with SUN ONE STUDIO Update 4
Hi,
I created a simple entity bean with finder methods and business methods.
But when I am trying to test the entity bean by generating the New EJB Client, and at the time executing the EJB client test client the following error as occured.
[b][b]Deploying... EAR Unable to deploy theC:/developer/JavaProject/test/test.earApplication
Deployment Error -- Error while running ejbc -- Fatal Error from EJB Compiler -- -- Error while processing CMP beans.
Please help me
Thank youHi ,
To know the reasons for deployment failure , you
could run your application using the Sun One verifier tool. Right click your application node and select Sun one verifier under the tools category.
Please post the results of the verifier tool in case you are not able to resolve the problem.
-Amol -
Creating JAR of an ejb from sun one studio 5.0
I�ve got the following error when I�m trying to generate the jar of and ejb from sun one studio 5.0. What�s the problem?
org/w3c/dom/Document.java [0:0] No file named org/w3c/dom/Document.java exists on disk in src.zip.
Therefore it may not be compiled with an external compiler.
You may need to check it out from version control or save some changes to it.
com/ssos/ejb/information/EJBModule_InformationEJB.ejbmodule [0:0] Problem compiling class: "org/w3c/dom/Document" reason: Compile failed
Called From: com/iplanet/services/util/XMLParser
Called From: com/iplanet/services/ldap/DSConfigMgr
Called From: com/iplanet/services/util/I18n
Called From: com/iplanet/sso/SSOTokenManager
Called From: com/iplanet/am/sdk/AMCommonUtils
Called From: com/iplanet/am/sdk/AMException
Called From: com/iplanet/dpro/session/service/SessionService
Called From: com/iplanet/services/naming/WebtopNaming
Called From: com/iplanet/dpro/session/SessionID
Called From: com/iplanet/dpro/session/Session
Called From: com/iplanet/am/util/Locale
Called From: com/iplanet/sso/SSOException
Called From: com/iplanet/sso/SSOToken
Called From: com/ssos/ejb/information/LocalInformationEJB
Errors compiling EJBModule_InformationEJB.Hep, we have the same problem. I am still trying to figure out why. I have some idea about the reason but I am testing my founding. It seems to me that the problem shows up when I add my database driver in Runtime/Databases/drivers tree (IBM DB2 driver: db2jcc.jar)
Like I am saying I am still checking the connection. When I am convinced that indeed that is the problem, I will then try to find out why and what to do to make my life easier.
clogon -
Remote Interface problem using Sun ONE App & web server
HI,
1) I am using an S'less SB. I have local & remote interfaces. I am using the sun one appserver7 & the sun ones's htttp server. By default it doesnt pick up the remote interfaces is it ? How do i make my remote interfaces work ? what are the changes required in config/xml ?
2) However i changed my client code (i.e my action class which is called by the struts action servlet ) to access the localhome rather than the remote home, but then i get java.lang.classcastexception.
pls help !
sanjayHi parsuram,
Thanks for the tip. After looking at the sample source code, I did finally figure out the solution - so I'll post it in case anyone else happens to be working with websphere studio has the same issue deploying on sun one.
To access local interface ejb, you must have the following
1. ejb-local-ref tag in the ejb-jar.xml like so underneath the <session> or <entity> tag of the bean which you plan to access the local ejb with.
<ejb-local-ref>
<ejb-ref-name>TestL</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>memory.simple.TestLLocalHome</local-home>
<local>memory.tool.simple.TestLLocal</local>
<ejb-link>TestL</ejb-link>
</ejb-local-ref>
2. similar ejb-ref tag in sun-ejb-jar.xml
<ejb-ref>
<ejb-ref-name>TestL</ejb-ref-name>
<jndi-name>localejbs/module_memory.betaEJB/TestL68640023372300293</jndi-name>
</ejb-ref>
note: sun generates the <jndi-name> and overwrites whatever you put in that tag no matter what you put in there.
3. here is the code to access
Context initial = new InitialContext();
TestLLocalHome tlHome=(TestLLocalHome) Initial.lookup
("TestL");
//the string must match <ejb-ref-name> underneath <ejb-local-ref>
4. note that the jndi name for the local interface bean becomes irrelevant. only the <ejb-ref-name> in the ejb-jar and sun-ejb-jar matter. furthermore, both <ejb-ref-name> must be the same or you won't be able to deploy.
5. This is completely my fault for not checking the "proper" way to access local interfaces. in websphere, they let you get away without the ejb-ref tags and just use the string "local:/TestL"!
-matt -
PortableRemoteObject.narrow Problem
Hello, I have a jsp that is talking to a servlet that is suppose to connect to a stateless session bean in 9.0.3. The bean deploys fine. I continue to get the following error when the servlet tries to talk to the bean. The servlet works fine on JRun 4 talking to the same bean. Here is my code.
Hashtable env = new Hashtable();
env.put(Context.PROVIDER_URL, "ormi://141.254.22.145:23791/JRun2");
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.URL_PKG_PREFIXES, "com.evermind.naming");
Context context = new InitialContext(env);
System.out.println("context: " + context.getEnvironment().toString());
Object o = (Object) context.lookup("SessionManagerLiteStateless");
System.out.println("o: " + o.toString());
sessionManagerLiteStatelessHome = (SessionManagerLiteStatelessHome)PortableRemoteObject.narrow(o, SessionManagerLiteStatelessHome.class);
The context outputs the Home interface fine but it bombs on sessionManagerLiteStatelessHome = (SessionManagerLiteStatelessHome)PortableRemoteObject.narrow(o, SessionManagerLiteStatelessHome.class);
Here is the error.
java.lang.ClassCastException
at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(Unkno
wn Source)
at javax.rmi.PortableRemoteObject.narrow(Unknown Source)
at JRun2.OracleServlet.init(OracleServlet.java:30)
at com.evermind.server.http.HttpApplication.loadServlet(HttpApplication.
java:1956)
at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.
java:4355)
at com.evermind.server.http.HttpApplication.getRequestDispatcher(HttpApp
lication.java:2184)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpReques
tHandler.java:617)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.ja
va:259)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.ja
va:106)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExec
utor.java:803)
at java.lang.Thread.run(Unknown Source)Michael -
That looks like a correct set of calls to me.
Can I ask what environment are you running in? An OC4J standalone or a 9iAS environment?
** If this is a 9iAS environment, then the port number for the ORMI lookup will be different than 23791. The actual ORMI port number for a 9iAS instance is dynamically allocated when the OC4J processes are started. The defdault port ranges for ORMI are 3000-3100 by default. The process manager starts at the lower bound and works it's way sequentially along until a free port is found. So usually for the OC4J_Home instance, the ORMI port is 3000.
I've never used the URL_PKG_PREFIXES myself, what happens if you remove that entry for the Hashtable?
-steve- -
Problem calling entity bean from session bean using sun one app server
Hi,
I am getting the following exception while calling entity bean(bmp) from stateless session(cmp)bean.
SEVERE: IOP5012: Some runtime exception ocurred in IIOP: [javax.ejb.EJBException: nested exception is: java.lang.RuntimeException: Unable to create reference org.omg.CORBA.OBJ_ADAPTER: vmcid: SUN minor code: 1015 completed: No]
SEVERE: IOP5013: Unable to create reference: [org.omg.CORBA.OBJ_ADAPTER: vmcid: SUN minor code: 1015 completed: No]
SEVERE: EJB5029: Exception getting ejb context : [CustomerEJB]
SEVERE:
WARNING: CORE3283: stderr: javax.transaction.TransactionRolledbackException: CORBA TRANSACTION_ROLLEDBACK 9998 Maybe; nested exception is:
WARNING: CORE3283: stderr: org.omg.CORBA.TRANSACTION_ROLLEDBACK: vmcid: 0x2000 minor code: 1806 completed: Maybe
WARNING: CORE3283: stderr: at com.sun.corba.ee.internal.iiop.ShutdownUtilDelegate.mapSystemException(ShutdownUtilDelegate.java:114)
WARNING: CORE3283: stderr: at com.sun.corba.ee.internal.javax.rmi.CORBA.Util.wrapException(Util.java:358)
WARNING: CORE3283: stderr: at javax.rmi.CORBA.Util.wrapException(Util.java:277)
WARNING: CORE3283: stderr:
My primary key implementation is
public class CustomerEJBKey implements java.io.Serializable {
static final long serialVersionUID = 3206093459760846163L;
public String customerId;
public DBConfigBean dbConfigBean;
* Creates an empty key for Entity Bean: CustomerEJB
/*public CustomerEJBKey() {
public CustomerEJBKey(String customerId,DBConfigBean dbConfigBean){
this.customerId = customerId;
this.dbConfigBean = dbConfigBean;
public String getCustomer(){
return customerId;
public DBConfigBean getDBConfigBean(){
return dbConfigBean;
* Returns true if both keys are equal.
public boolean equals(Object key) {
if(key instanceof CustomerEJBKey)
return this.customerId.equals(((CustomerEJBKey)key).customerId) &&
this.dbConfigBean.equals(((CustomerEJBKey)key).dbConfigBean);
else
return false;
* Returns the hash code for the key.
public int hashCode() {
return customerId.hashCode() + dbConfigBean.hashCode();
and entity bean method invocation is,
homeFactory = EJBHomeFactory.getInstance();
home = (CustomerEJBHome) homeFactory.lookup(CustomerEJBHome.class);
remote = (CustomerEJB) PortableRemoteObject.narrow( home.findByPrimaryKey(new CustomerEJBKey(customerId,dbBean)), CustomerEJB.class);
This works fine in Websphere and JBoss. Do you have any idea why I am getting this exception?
Appreciate your response.
Regards,
Sankar.My suggestion is to put some System.out.println() statements and see if the output helps in any way in debugging. I can't think of anything on the top of my head although I have been working lightly on SunONE.
By the way, you referred the stateless bean as CMP. Just wanted to tell you that you are wrong. The terms CMP and BMP refer to persistence, which is applied to Database tables and not to stateless/stateful session beans which are written for some specific purpose independent of underlying database.
Maybe you are looking for
-
Recently Mozilla is having problems displaying some websites. Previously these website displayed fine, and in Internet Explorer they still displays them fine. For example. http://www.yr.no/ displays few graphics, and all the text is in times new roma
-
Terms of Payment - T052 data extraction
Hello Gurus, Can you help me in a matter? I`m looking for a standard data extraction mode of Terms of Payment (T052) table. Is tere a standard datasource, or I`m just able to get those data from R3 side to Bw using generic extractor? thx laszlo
-
Hi Experts Like in R/3 in SRM how do we maintain header conditions in purchase order. In SRM in header details no tab is there for Header conditions. Kindly help. Regards
-
How To traverse files under subfolder using Traverse folder option
My files are stored as Newborn.txt under each year's subfolder, How to implement this. Eg: C:\Ravi\N90\Newborn.txt C:\Ravi\N91\Newborn.txt C:\Ravi\N92\Newborn.txt C:\Ravi\N93\Newborn.txt Pl help me to read the files using the for each loop containe
-
Dear All, I'm using usb devices for user authentification on a web application. The certificate has a PKCS#11 format. Does any one have an idea how can I accomplish the user authentification? Does JCE supports the PCKS#11 format? Thanx mouha