Problem with JNDI
hi,
i am not sure whether this is right forum or not, but could not find more better place. for this i have tried to google a lot, so if you are suggesting google please provide with google key words. and gone through this page as well : http://www.jboss.org/file-access/default/members/jbossweb/freezone/docs/2.1.0/jndi-resources-howto.html
have a small requirement,
=> need to deploy a small JNDI service on JBoss 4.2.3GA and test that service from a simple java desktop client via jnp protocol.
if any one knows how to fulfill this requirement please help...
thanx in advance
Aniruddha
Hi Aniruddha,
Thanks for responding. However, I'm not clear with your solution. Are you asking me to reboot the machine with a -b option? Its a production system and I can't do it. The client is on the same host and it throws a Connection refused : connect exception. However, the port diagnostic tool shows a connection between the server and client.
Thanks & Regards,
RNE
Similar Messages
-
Problem with JNDI in WLS 5.1
Hi all,
i have a problem with JNDI in WLE 5.1.
i am accessing an LDAP on another machine running Netscape Directory Server.
The host URL is ldap://myhost:65535/o=marco, c=fi
i am always getting back the following exception:
javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.
WLInitialContextFactory. Root exception is java.lang.ClassCastException: weblog
ic.jndi.WLInitialContextFactory
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
58)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:242
at javax.naming.InitialContext.init(InitialContext.java:218)
at javax.naming.InitialContext.<init>(InitialContext.java:194)
and my code is this:
Hashtable _environment = new Hashtable();
try {
environment.put(Context.INITIALCONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
environment.put(Context.PROVIDERURL, "ldap://myhost:65535");
if ((principal!=null) || (credentials!=null)) {
environment.put(Context.SECURITYAUTHENTICATION, "simple");
environment.put(Context.SECURITYPRINCIPAL, principal);
environment.put(Context.SECURITYCREDENTIALS, credentials);
context = new InitialContext(environment);
parser = context.getNameParser(initialCtxFactory);
} catch(Exception e) {
e.printStackTrace();
can anyone help me please??
thanx in advance
marcoTake out the "weblogic.jndi.WLInitialContextFactory" and add the respective factory NAME..
environment.put(Context.INITIALCONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
Cheers,
Naggi
Senthil Kumar S wrote:
http://weblogic.com/docs51/classdocs/API_jndi.html#delegate
Marco wrote:
Hi all,
i have a problem with JNDI in WLE 5.1.
i am accessing an LDAP on another machine running Netscape Directory Server.
The host URL is ldap://myhost:65535/o=marco, c=fi
i am always getting back the following exception:
javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.
WLInitialContextFactory. Root exception is java.lang.ClassCastException: weblog
ic.jndi.WLInitialContextFactory
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
58)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:242
at javax.naming.InitialContext.init(InitialContext.java:218)
at javax.naming.InitialContext.<init>(InitialContext.java:194)
and my code is this:
Hashtable _environment = new Hashtable();
try {
environment.put(Context.INITIALCONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
environment.put(Context.PROVIDERURL, "ldap://myhost:65535");
if ((principal!=null) || (credentials!=null)) {
environment.put(Context.SECURITYAUTHENTICATION, "simple");
environment.put(Context.SECURITYPRINCIPAL, principal);
environment.put(Context.SECURITYCREDENTIALS, credentials);
context = new InitialContext(environment);
parser = context.getNameParser(initialCtxFactory);
} catch(Exception e) {
e.printStackTrace();
can anyone help me please??
thanx in advance
marco--
http://www.net4tech.com -
Please Help me!!!!!! Problems with JNDI and datasouces
Hello Friends.
I'm new in JNDI, sorry for my english
I am working wit java,jsp,struts and connect to Oracle 8i database but with the traditional way.
In this moment i can connect to datasouce with JNDI from jsp or java servlet of this way without problems.
Context initContext = new InitialContext();
Context envContext = (Context)initContext.lookup("java:comp/env/");
DataSource ds = (DataSource)envContext.lookup("jdbc/myoracle");
Connection C = ds.getConnection();
But, When i try to connect from java class compiled out of tomcat is does'nt work, the program show trobles like
"javax.naming.NameNotFoundException: java:comp/env/"
whit this java code:
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.fscontext.RefFSContextFactory");
try {
Context ctx = new InitialContext(env);
Context envContext = (Context)ctx.lookup("java:comp/env/");
DataSource ds = (DataSource)envContext.lookup("jdbc/myoracle");
Connection conn = ds.getConnection();
} catch (NamingException e) {
System.err.println(e.getMessage());
i have the jar's file fscontext.jar, providerutil.jar, jndi alocated in WEB-INF/lib/
Please Help me!!!Results using
try{
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.cosnaming.CNCtxFactory");
Context initContext = new InitialContext(env);
Context envContext = (Context)initContext.lookup("java:comp/env");
DataSource ds = (DataSource)envContext.lookup("jdbc/myoracle");
Connection C = ds.getConnection();
}catch(Exception E){
System.out.println(E.getMessage()+E.getClass());
Result : Cannot connect to ORBclass javax.naming.CommunicationException -
Problem with JNDI/LDAP AND connection pool
I'm a newbie to Java but am attempting to write a servlet that retrieves info use to populate the contents of drop down menus. I'd like to only have to do this once. The servlet also retrieves other data (e.g. user profile info, etc ...). I'd like to be able to use the connection pool for all of these operations but I'm getting a compile error:
public class WhitePages extends HttpServlet {
ResourceBundle rb = ResourceBundle.getBundle("LocalStrings");
public static String m_servletPath = null;
public static String cattrs = null;
public static String guidesearchlist[] = {};
public static int isLocalAddr = 0;
private int aeCtr;
private String[] sgDNArray;
private HashMap sgDN2DNLabel = new HashMap();
private HashMap sgDN2SearchGuide = new HashMap();
private String strport;
private int ldapport;
private String ldaphost;
private String ldapbinddn;
private String ldapbindpw;
private String ldapbasedn;
private int maxsearchcontainers;
private int maxsearchkeys;
private String guidesearchbases;
private String guidecontainerclass;
private String strlocaladdr;
private String providerurl;
// my init method establishes the connection
// pool and then retrieve menu data
public void init(ServletConfig config) throws ServletException {
super.init(config);
String strport = config.getInitParameter("ldapport");
ldapport = Integer.parseInt(strport);
String strconts = config.getInitParameter("maxsearchcontainers");
maxsearchcontainers = Integer.parseInt(strconts);
String strkeys = config.getInitParameter("maxsearchkeys");
maxsearchkeys = Integer.parseInt(strkeys);
ldaphost = config.getInitParameter("ldaphost");
ldapbinddn = config.getInitParameter("ldapbinddn");
ldapbindpw = config.getInitParameter("ldapbindpw");
ldapbasedn = config.getInitParameter("ldapbasedn");
guidesearchbases = config.getInitParameter("guidesearchbases");
guidecontainerclass = config.getInitParameter("guidecontainerclass");
strlocaladdr = config.getInitParameter("localaddrs");
providerurl = "ldap://" + ldaphost + ":" + ldapport;
/* Set up environment for creating initial context */
Hashtable env = new Hashtable(11);
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, providerurl.toString());
/* Enable connection pooling */
env.put("com.sun.jndi.ldap.connect.pool", "true");
StringTokenizer st = new StringTokenizer(guidesearchbases, ":" );
String guidesearchlist[] = new String[st.countTokens()];
for ( int i = 0; i < guidesearchlist.length; i++ ) {
guidesearchlist[i] = st.nextToken();
// Get a connection from the connection pool
// and retrieve the searchguides
StringBuffer asm = new StringBuffer(""); // This is the advanced search menu htmlobject buffer
StringBuffer strtmpbuf = new StringBuffer(""); // This is the simple search menu htmlobject buffer
try {
StringBuffer filter = new StringBuffer("");
filter.append("(objectclass=" + guidecontainerclass + ")");
String[] attrList = {"dn","cn","searchguide"};
SearchControls ctls = new SearchControls();
ctls.setReturningAttributes(attrList);
ctls.setSearchScope(SearchControls.SUBTREE_SCOPE);
String attrlabelkey;
sgDNArray = new String[guidesearchlist.length];
for( int i = 0; i < guidesearchlist.length; i++ ) {
// Search each of the namingspaces where
// searchguides exist then build
// the dynamic menus from the result
DirContext ctx = new InitialDirContext(env);
NamingEnumeration results = ctx.search(guidesearchlist, filter, ctls);
I get a compile error:
WhitePages.java:164: cannot resolve symbol
symbol : method search (java.lang.String,java.lang.StringBuffer,javax.naming.directory.SearchControls)
location: interface javax.naming.directory.DirContext
NamingEnumeration results = ctx.search(guidesearchlist[i], filter, ctls);
^
WhitePages.java:225: cannot resolve symbol
symbol : variable ctx
location: class OpenDirectory
ctx.close();
^
Can anyone help? If there is someone out there with JNDI connection pool experience I would appreciate your assistance!Manish
The issue may not be related to the number of connections or the initial
connections. Check your heap size (ms, mx). Turn on verbosegc. Your heap may
not be big enough to accept the 25,000 rows.
Bernie
"Manish Kumar Singh" <[email protected]> wrote in message
news:3e6c34ca$[email protected]..
We are creating the result set with 25000 rows(each row has 56 columns) bygetting the connection using data source. With the initial capacity of the
connection pool is 5 and the max capacity as 30 and grow connection as 1,
the server gets out of memory exception, when we issue a new request, even
after closing the previous connections.
Now, if we change the initial capacity to 1 and rest all the things assame, the issue gets resolved and the server works fine.
Could you please help me out in this regard????
thanks in advance
manish -
Problem with JNDI and JSP in Tomcat
Hi,
Basically, what I've done is to use the Tomcat administration web
application to create the DataSource, which looks like it populated the
server.xml (see below). I then try to access the testconn.jsp, and am
getting that "Name java:comp is not bound in this Context" error.
I was wondering if anyone could tell me what I'm doing wrong?
Thanks,
Feri
My Configuration:
- Tomcat 5.0.19
- MySQL 4.0.18-nt
- mysql-connector-java-3.0.15-ga-bin.jar
server.xml:
<GlobalNamingResources>
<!-- Test entry for demonstration purposes -->
<Environment name="simpleValue" type="java.lang.Integer" value="30"/>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users -->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved">
</Resource>
<ResourceParams name="UserDatabase">
<parameter>
<name>factory</name>
<value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
</parameter>
<parameter>
<name>pathname</name>
<value>conf/tomcat-users.xml</value>
</parameter>
</ResourceParams>
<!--Feri test JNDI-->
<Context crossContext="true" debug="5" docBase="injury" path="/injury" reloadable="true">
<Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_injury_log." suffix=".txt" timestamp="true"/>
<Resource name="jdbc/injury" auth="Container"
type="javax.sql.DataSource">
</Resource>
<ResourceParams name="jdbc/injury">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>username</name>
<value>root</value>
</parameter>
<parameter>
<name>password</name>
<value>root</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost:3306/injury</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>30</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>10</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>10000</value>
</parameter>
</ResourceParams>
</Context>
<!--Feri test JNDI end-->
</GlobalNamingResources>
\webapps\injury\WEB-INF\web.xml:
<resource-ref>
<description>Resource reference to a factory for java.sql.Connection instances that may be used for talking to a particular database that is configured in the server.xml file.</description>
<res-ref-name>jdbc/injury</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
\webapps\injury\testconn.jsp
<%@ page import="java.sql.*" %>
<%@ page import="javax.sql.*" %>
<%@ taglib prefix="ct" uri="/injury" %>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
<h1>Connection test</h1>
<ct:connection name="jdbc/injury">
<%
Statement stmt= conn.createStatement();
ResultSet rs;
rs = stmt.executeQuery("select * from user");
while (rs.next()){
%><%=rs.getString(1)%><%=rs.getInt(2) %><br><%
rs.close();
stmt.close();
%>
</ct:connection>
ConnectionTag.java
import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import javax.naming.*;
import javax.sql.*;
import javax.sql.DataSource;
public class ConnectionTag extends TagSupport implements TryCatchFinally {
private Connection conn;
// JNDI name of the connection
private String name;
public void setName(String name)
this.name = name;
public int doStartTag()
throws JspException
try {
Context env = (Context) new InitialContext().lookup("java:comp/env");
DataSource ds = (DataSource) env.lookup(name);
if (ds != null)
conn = ds.getConnection();
} catch (Exception e) {
throw new JspException(e);
if (conn == null)
throw new JspException("can't open connection " + name);
pageContext.setAttribute("conn", conn);
return EVAL_BODY_INCLUDE;
public void doCatch(Throwable t)
throws Throwable
throw t;
public void doFinally()
try {
Connection conn = this.conn;
this.conn = null;
pageContext.removeAttribute("conn");
conn.close();
} catch (Exception e) {
Tomcat 5.0\conf\Catalina\localhost\injury.xml
<?xml version='1.0' encoding='utf-8'?>
<Context displayName="Injury" docBase="E:\Tomcat 5.0\webapps\injury" path="/injury" className="org.apache.catalina.core.StandardContext"
cachingAllowed="true" charsetMapperClass="org.apache.catalina .util.CharsetMapper" cookies="true" crossContext="false" debug="0"
mapperClass="org.apache.catalina.core.StandardContextMapper" useNaming="true" wrapperClass="org.apache.catalina.core.StandardWrapper" >
<Resource auth="Container" description="Resource reference to a factory for java.sql.Connection instances that may be used for talking to a particular database that is configured in the server.xml file." name="jdbc/injury" type="javax.sql.DataSource"/>
<ResourceLink global="jdbc/injury" name="injury" type="javax.sql.DataSource"/>
</Context>Hi,
First of all, you can find alot of information about this in the forum about jsp's.
I think a good thing to do is not to put your context tag directly into the server.xml file.
What you should do is create a context.xml file with the context-tag in it, and put it in the META-INF directory of your .war file. Upon deployment to tomcat5 this file will be extracted from the war, copied to the conf\enginename\hostname directory, and it will be renamed to contextName.xml.
I think you are developing directly into the webapps directory, and I believe you should avoid that and use the deployment feature of the manager web-app or you should use the deployertool from you ide or standalone ant.
anyway, for starters try to remove the context tag from the server.xml file as described above, and check out the jsp / jdbc forums for simular problems and answers.
good luck -
PROBLEMS WITH JNDI AND NAMEPARSER/URGENT
Hi all,
i am experiencing lot of problems in accessing an LDAP under
NetscapeDirectory Server using WLS.
i can connect to the LDAP (using a delegate provider, the one from Sun),
however, when
i try to get the NameParser from the context, i always got the exception
Exception in thread "main" java.io.IOException: Class
com.sun.jndi.ldap.LdapName
Parser with code=123 does not implement Serializable, Externalizable or
WLSerial
izable
at
weblogic.common.internal.WLObjectOutputStreamBase.writeObjectBody(WLO
bjectOutputStreamBase.java:895)
at
weblogic.common.internal.WLObjectOutputStreamBase.writeObject(WLObjec
tOutputStreamBase.java:1011)
at
weblogic.common.internal.WLObjectOutputStreamBase.writeObjectWL(WLObj
ectOutputStreamBase.java:166)
at
weblogic.rmi.extensions.AbstractOutputStream2.writeObject(AbstractOut
putStream2.java:82)
at
weblogic.jndi.remote.DirContextWrapper_WLSkel.invoke(DirContextWrappe
r_WLSkel.java:299)
at
weblogic.rmi.extensions.BasicServerObjectAdapter.invoke(BasicServerOb
jectAdapter.java, Compiled Code)
at
weblogic.rmi.extensions.BasicRequestHandler.handleRequest(BasicReques
tHandler.java:69)
at
weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest
.java:15)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java,
Compiled Code)
--------------- nested within: ------------------
weblogic.rmi.MarshalException: error marshalling return
- with nested exception:
[java.io.IOException: Class com.sun.jndi.ldap.LdapNameParser with
code=123 does
not implement Serializable, Externalizable or WLSerializable]
at
weblogic.jndi.remote.DirContextWrapper_WLSkel.invoke(DirContextWrappe
r_WLSkel.java:301)
at
weblogic.rmi.extensions.BasicServerObjectAdapter.invoke(BasicServerOb
jectAdapter.java, Compiled Code)
at
weblogic.rmi.extensions.BasicRequestHandler.handleRequest(BasicReques
tHandler.java:69)
at
weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest
.java:15)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java,
Compiled Code)
--------------- nested within: ------------------
weblogic.rmi.ServerException: A remote exception occurred while
executing the me
thod on the remote object
- with nested exception:
[weblogic.rmi.MarshalException: error marshalling return
- with nested exception:
[java.io.IOException: Class com.sun.jndi.ldap.LdapNameParser with
code=123 does
not implement Serializable, Externalizable or WLSerializable]]
at
weblogic.rmi.extensions.AbstractRequest.sendReceive(AbstractRequest.j
ava:76)
at
weblogic.jndi.remote.DirContextWrapper_WLStub.getNameParser(DirContex
tWrapper_WLStub.java:929)
at
javax.naming.InitialContext.getNameParser(InitialContext.java:499)
at
com.nokia.nsg.admintool.model.DelegateTest.main(DelegateTest.java:43)
--------------- nested within: ------------------
weblogic.rmi.extensions.RemoteRuntimeException: Undeclared checked
exception - w
ith nested exception:
[weblogic.rmi.ServerException: A remote exception occurred while
executing the m
ethod on the remote object
- with nested exception:
[weblogic.rmi.MarshalException: error marshalling return
- with nested exception:
[java.io.IOException: Class com.sun.jndi.ldap.LdapNameParser with
code=123 does
not implement Serializable, Externalizable or WLSerializable]]]
at
weblogic.jndi.remote.DirContextWrapper_WLStub.getNameParser(DirContex
tWrapper_WLStub.java:954)
at
javax.naming.InitialContext.getNameParser(InitialContext.java:499)
Has anyone ever find this exception???
can anyone help me???
thanx in advance and regards
marcoFriend, In LAN the network speed is high so you don't feel the problem. But on real network the speeds becomes slow and when one thread on the reading process is suspended and the other on write is executed the results are ostensible to be unreliable.
One alternative is use synchronization or some synchronization flag, but I suggest you to have one thread for both the task. Though you have a thread for each client connected.
Single thread model will help you to avoid synchronization headches and also the access won't be simultaneous.
You have to change the design a little.
Hope that works,
Ashish -
Problems with JNDI lookup for java:comp/env/ejb
Hi all,
I'm using OC4J 9.0.3 and I have problems when looking up for the local
EJB context.
I have a SLSB which refers to another SLSB via a JNDI mapping like
shown below. Both services are deployed within one EAR file.
(snippets of ejb-jar.xml and orion-ejb-jar.xml)
<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>ServiceABean</ejb-name>
<home>com.coi.ServiceAHome</home>
<remote>com.coi.ServiceA</remote>
<ejb-class>com.coi.ServiceABean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<ejb-ref>
<ejb-ref-name>ejb/some/sub/packages/ServiceB</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.coi.ServiceBHome</home>
<remote>com.coi.ServiceB</remote>
</ejb-ref>
</session>
</enterprise-beans>
</ejb-jar>
<orion-ejb-jar>
<enterprise-beans>
<session-deployment location="global/some/sub/packages/ServiceA" name="ServiceABean">
<ejb-ref-mapping name="ejb/some/sub/packages/ServiceB" location="global/some/sub/packages/ServiceB" />
</session-deployment>
</enterprise-beans>
</orion-ejb-jar>
The ApplicationInitialContextFactory will be used (prepared by the container),
so the lookup for ServiceB within a method of ServiceA should work as follows:
public class ServiceABean implements SessionBean
public void someMethod()
InitialContext con = new InitialContext(); // will be of class ApplicationContext
Context localEjbContext = (Context)con.lookup( "java:comp/env/ejb" );
ServiceBHome serviceBHome = (ServiceBHome) PortableRemoteObject.narrow(
localEjbContext.lookup( "some/sub/packages/ServiceB" ),
ServiceBHome.class );
The problem is now, that the lookup for "java:comp/env/ejb" doesn't work
and throws a NameNotFoundException.
To figure out what's actually happening during lookup I debugged a little bit and
tried a few things:
1. A lookup for "java:comp" works fine. It returns an instance of class FlatMapContext
which consists of a hash map which itself contains an entry for "env".
2. So a lookup for "env" on that FlatMapContext also works and returns an instance of SubContext.
3. A lookup for "ejb" using this SubContext causes a NameNotFoundException
with message "java:comp/env/ejb not found".
4. A lookup like con.lookup( "java:comp/env" ) throws also a NameNotFoundException
with message "java:comp/env not found (not inside a J2EE module, for instance a Web-App,
EJB, or Application-Client)".
Does anyone know something about this?
Regards
--thomasHi Debu,
Great! 9.0.4 will be released in june/july this year, right? Sorry for my ironical reaction, but does that mean, that I don't have any chance to get my whole stuff running in 9.0.3? I cannot believe that. Isn't there a wordaround I could apply? A setting or whatever to substitute the daft FlatCtx by something else that is implemented according to the spec?
Regards
--thomas -
Problems with JNDI between JSP and EJB
Good morning:
I've got a problem related to EJB and JNDI.
I want to run methods of an EJB that is in Weblogic, from a JSP that runs IPlanet. When I try to execute getInitialContext() I catch a NamingException. The error description is :Cannot instantiate class: weblogic.jndi.T3InitialContextFactory
I have this code in the JSP:
Context initialCtx;
initialCtx = getInitialContext();
private InitialContext getInitialContext() throws NamingException
Properties p = new Properties();
(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.T3InitialContextFactory");
(Context.PROVIDER_URL,"t3://atlas:7001");
InitialContext ctx = null;
ctx = new InitialContext(p);
return ctx;
Configuration:
JSP runs in IPlanet 4.1 SP7
EJB runs in a Weblogic 5.1. Atlas it's the server name
IPlanet and Weblogic runs on differents machines.
Can anybody help me?
Thanks in advance
DavidI have two weblogic jars (weblogicaux.jar and one service pack of weblogic) in the iplanet classpath.
I don't know if I have to configure Weblogic with any special parameter (RMI/IIOP) or something similar in IPlanet.
Can anybody help me?
Thanks. -
Jboss and eclipse, problems with JNDI
Hi, i have managed to deploy my j2ee application (according to jboss), its a simple HelloWorld app, problem is when i try to look it up.
In the client:
System.out.println("starter");
Context context = new InitialContext();
System.out.println("etter context");
Object objref = context.lookup("HelloWorld");
// Stops here and a javax.naming.NoInitialContextException is thrown...
// What is wrong?
The jboss.xml file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 2.4//EN" "http://www.jboss.org/j2ee/dtd/jboss_2_4.dtd">
<jboss>
<enterprise-beans>
<session>
<ejb-name>HelloWorld</ejb-name>
<jndi-name>ejb/HelloWorld</jndi-name>
</session>
</enterprise-beans>
<resource-managers>
</resource-managers>
</jboss>I have managed to run the file now but i had to do it from command prompt and include every jar file from jboss + the files in my project. My problem now is an eclipse problem i think.
I have created a client wich looks up the ejb, but the thing is that i have to manually import a bunch of jboss jar-files to get it to work. isn't there a way i can make eclipse / jboss import those jar's automatically? perhaps create a client automatically or something?
Hope someone can help.. -
hi,
i created my own Queue and QueueConnectionFactory using the j2eeadmin tool. both objects show up just fine when i run j2eeadmin -listXXX
however when i try to lookup either one of these with the runtime api, i get javax.naming.NameAlreadyBoundException
my client code may not be correct, but here's what i have:
InitialContext jndiContext = new InitialContext();
jndiContext.lookup( name );
where name is the name that object is bound to.
if anyone has any idea what i'm doing wrong, please let me know.
thanks,
mark.u can set jndi name during u deploy the EJB ,for example ,after u start the deploytool ,u have built a group of ejb classes such as sessionbean, remote interface ,home interface ,then deploy them as a ejb,after this u can get the menu about alias ,so set the name when u write ur script to call the ejb ,just give the same name as u wrote just now
-
JNDI problem with Sun Application Server
I am trying to call a extremely simple EJB from a remote computer. But everytime I run the client I get a Class castException. I have used Weblogic and Jboss in the past and I never had any problem with JNDI. I included all the files except for the descriptor. Please help, this is driving me nut.
Here is the exception i get:
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 clients.testEjbTest.main(testEjbTest.java:42)
The remote Interface :
package ejb.test;
import javax.ejb.*;
public interface Test extends javax.ejb.EJBObject{
public String getResult() throws java.rmi.RemoteException;
The Home interface is:
package ejb.test;
import javax.ejb.*;
public interface TestHome extends javax.ejb.EJBHome{
public Test create() throws java.rmi.RemoteException, CreateException;
The Bean is:
package ejb.test;
import javax.ejb.*;
public class TestBean implements javax.ejb.SessionBean {
public TestBean() {}
public String getResult() { return "hello";}
public void ejbActivate() { }
public void ejbPassivate() { }
public void ejbRemove() { }
public void ejbCreate() throws CreateException { }
public void setSessionContext(javax.ejb.SessionContext sessionContext) { }
The client is:
public class testEjbTest {
public testEjbTest() { }
public static void main(String[] args) {
try{
Properties env = new Properties();
env.setProperty("java.naming.factory.initial", "com.sun.jndi.cosnaming.CNCtxFactory" );
env.setProperty("java.naming.provider.url", "iiop://192.168.0.102:3700");
InitialContext ic = new InitialContext(env);
Object objref = ic.lookup("TestBean");
Object tt = PortableRemoteObject.narrow(objref, ejb.test.TestHome.class);
}catch(Exception e){e.printStackTrace();}Hi,
I am new to this Forum.
I have an application running on Weblogic.
I want to shift to using SunOne as the Webserver and weblogic as application server.
But when I deploy the application I am getting this ClassCastException
at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow.
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 com.elsevier.portal.admin.web.proxy.LoginProxy.getLoginSession(LoginProxy.java:156)
at com.elsevier.portal.admin.web.proxy.LoginProxy.authenticateUser(LoginProxy.java:48)
at com.elsevier.portal.admin.web.actions.LoginAction.login(LoginActi
on.java:201)
at com.elsevier.portal.admin.web.actions.LoginAction.execute(LoginAction.java:80)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java
:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:
525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:807)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
at org.apache.catalina.core.StandardWrapperValve.invokeServletServic
e(StandardWrapperValve.java:771)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:322)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
warning: CORE3283: stderr: at org.apache.catalina.core.StandardHostValve.invoke(StandardHostVal
ve.java:209)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:161)The code snippet is as follows�.
protected LoginSession getLoginSession() throws ApplicationException {
LoginSessionHome home = null;
LoginSession object = null;
try {
home = (LoginSessionHome) (PortableRemoteObject.narrow(ProxyUtil.getEJBHome(getProperties().getProperty(DataCoreConstants.LOGIN_JNDI_NAME),getProperties()),LoginSessionHome.class));
object = home.create();
catch(ClassCastException cse){
cse.printStackTrace();
logger.error("Class Cast Exception is thrown while casting the Object to LoginSessionHome");
logger.error(cse);
throw new ApplicationException(ExceptionConstants.CLASS_CAST_EXCEPTION);
return object;
}Same method is running on weblogic without any problem�
Help needed urgently.
Regards,
Neha. -
hi all,
i have a problem with JNDI pooling
everything apear to be ok
but when i insert a UTF String into database the string appear a ??????????
I know that i must set the charset for the connection to utf
but i dont know how to set it in JNDI
i use this code to do it :
this code is getConnection() method
Context ctx = new InitialContext();
if(ctx == null ) {
throw new Exception("Boom - No Context");
Connection conn = null;
ds = (DataSource)ctx.lookup("java:comp/env/jdbc/jdbc/myDB");
if (ds != null) {
conn = ds.getConnection(); // get connection from datasource pool
return conn;this the web.xml
<resource-ref>
<description>DBConnection</description>
<res-ref-name>jdbc/myDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>and this the server.xml
<Context path="/myPath" docBase="myDocBase" debug="5" reloadable="true" crossContext="true" source="org.eclipse.jst.j2ee.server:myDocBase">
<Resource name="jdbc/myDB"
auth="Container"
type="javax.sql.DataSource"
maxActive="100"
maxIdle="30"
maxWait="10000"
username="$$$"
password="$$$"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/myTest" />
</Context>Edited by: daigoor on Jul 1, 2010 5:49 AM
Edited by: daigoor on Jul 1, 2010 5:59 AM
Edited by: daigoor on Jul 1, 2010 7:32 AMthe solution was to set the characterEncoding in the url in server.xml
even i try it before but the server was not started
he tell me that i must insert a ";" after password
finally i found that the xml file does not understand the char "&" as it so the server was not started
i search about this char in xml and found that it must be written as "&"
i try this code and its work fine
<Context path="/myDB"
docBase="myDB"
debug="5"
reloadable="true"
crossContext="true"
source="org.eclipse.jst.j2ee.server:myDB">
<Resource name="jdbc/MYdbcomhDS"
auth="Container"
type="javax.sql.DataSource"
maxActive="100"
maxIdle="30"
maxWait="10000"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/mydb?user=$$$&password=$$$&characterEncoding=UTF8" />
</Context>thank you for help
Edited by: daigoor on Jul 4, 2010 4:25 AM -
Problem with creating Connection pool and JNDI, driver is not detected
Hi,
I have an issue with creating Connection Pool and JNDI.
I'm using:
- JDK 1.6
- OS: Linux(ubuntu 8.10)
- Netbeans IDE 6.5.1
- Java EE 5.0
- Apache Tomcat 6.0.18 Its lib directory contains all necessary jar files for Oracle database driver
- Oracle 11g Enterprise
My problem is that the Oracle database driver is not detected when I want to create a pool (it works pretty well and is detected without any problem when I create ordinary connection by DriverManager)
Therefore after running:
InitialContext ic = new InitialContext();
Context context = (Context)ic.lookup("java:comp/env");
DataSource dataSource = (DataSource)context.lookup("jdbc/oracle11g");
Connection connection = dataSource.getConnection();and right after dataSource.getConnection() I have the following exception:
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class 'oracle.jdbc.OracleDriver'
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1136)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
at servlets.Servlet1.doPost(Servlet1.java:47)
at servlets.Servlet1.doGet(Servlet1.java:29)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1130)
... 17 more
My application context file (context.xml) is:
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/WebApplication3">
<Resource auth="Container"
driverClassName="oracle.jdbc.OracleDriver"
maxActive="8"
maxIdle="4"
name="jdbc/oracle11g"
username="scott"
password="tiger"
type="javax.sql.DataSource"
url="jdbc:oracle:thin:@localhost:1521:database01" />
</Context>and my web.xml is:
<resource-ref>
<description>Oracle Datasource example</description>
<res-ref-name>jdbc/oracle11g</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
...I found similar threads in different forums including sun, such as
http://forums.sun.com/thread.jspa?threadID=567630&start=0&tstart=0
http://forums.sun.com/thread.jspa?threadID=639243&tstart=0
http://forums.sun.com/thread.jspa?threadID=5312178&tstart=0
, but no solution.
As many suggest, I also tried to put context directly in the server.xml (instead of my application context) and referencing it by <ResourceLink /> inside my application context but it didn't work and instead it gave me the following message:
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class ' ' for connect URL 'null'
Has anyone succeeded in creating a connection pool with JNDI by using Tomcat 6 or higher ? If yes, could kindly explain about the applied method.
Regards,Hello again,
Finally I managed to run my application also with Tomcat 6.0.18. There was only two lines that had to be modified
in the context.xml file (the context of my application project and not server's)
Instead of writing
<Context antiJARLocking="true" path="/WebApplication2">
type="javax.sql.DataSource"
factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
</Context>we had to write:
<Context antiJARLocking="true" path="/WebApplication2">
type="oracle.jdbc.pool.OracleDataSource"
factory="oracle.jdbc.pool.OracleDataSourceFactory"
</Context>- No modification was needed to be done at server level (niether server.xml nor server context.xml)
- I just added the ojdbc6.jar in $CATALINA_HOME/lib (I didn't even need to add it in WEB-INF/lib of my project)
- The servlet used to do the test was the same that I presented in my precedent post.
For those who have encountered my problem and are interested in the format of the web.xml and context.xml
with Tomcat 6.0, you can find them below:
Oracle server: Oracle 11g Enterprise
Tomcat server version: 6.0.18
Oracle driver: ojdbc.jar
IDE: Netbeans 6.5.1
The context.xml file of the web application
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/WebApplication2">
<Resource name="jdbc/oracle11g"
type="oracle.jdbc.pool.OracleDataSource"
factory="oracle.jdbc.pool.OracleDataSourceFactory"
url="jdbc:oracle:thin:@localhost:1521:database01"
driverClassName="oracle.jdbc.OracleDriver"
userName="scott"
password="tiger"
auth="Container"
maxActive="100"
maxIdle="30"
maxWait="10000"
logAbandoned="true"
removeAbandoned="true"
removeAbandonedTimeout="60" />
</Context>The web.xml of my web application
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<resource-ref>
<description>Oracle Database 11g DataSource</description>
<res-type>oracle.jdbc.pool.OracleDataSource</res-type>
<res-auth>Container</res-auth>
<res-ref-name>jdbc/oracle11g</res-ref-name>
</resource-ref>
<servlet>
<servlet-name>Servlet1</servlet-name>
<servlet-class>servlets.Servlet1</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Servlet1</servlet-name>
<url-pattern>/Servlet1</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>Ok, now I'm happy as the original problem is completely solved
Regards -
Websphere 6: JNDI problem with Sping - urgent.
Hi,
I have my cJSC project working fine with JNDI on my local sun app server. However when deploying to websphere I am getting problems.
Obviously websphere is different setup and I have had to add the following to the web.xml to get a datasource
<resource-ref>
<description>VMS Datasource</description>
<res-ref-name>jdbc/VMSDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
However, the app is still bombing out with following..
Error page exception
The server cannot use the error page specified for your application to handle the Original Exception printed below. Please see the Error Page Exception below for a description of the problem with the specified error page.
Original Exception:
Error Message: SRVE0207E: Uncaught initialization exception thrown by servlet
Error Code: 500
Target Servlet: Faces Servlet
Error Stack:
java.lang.NullPointerException
at javax.faces.webapp.FacesServlet.init(FacesServlet.java:144)
at com.ibm.ws.cache.servlet.ServletWrapper.init(ServletWrapper.java:231)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:274)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:480)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:2954)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:221)
at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:210)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1912)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:84)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:472)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:411)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:288)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminaters(NewConnectionInitialReadCallback.java:207)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:109)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:566)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:619)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:952)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1039)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1469)
Error Page Exception:
Error Message: Cannot find FacesContext
Error Code: 0
Target Servlet: null
Error Stack:
javax.servlet.jsp.JspException: Cannot find FacesContext
at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:405)
at com.sun.faces.taglib.jsf_core.ViewTag.doStartTag(ViewTag.java:105)
at com.ibm._jsp._ErrorPage._jspx_meth_f_view_0(_ErrorPage.java:330)
at com.ibm._jsp._ErrorPage._jspService(_ErrorPage.java:63)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:88)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.cache.servlet.ServletWrapper.serviceProxied(ServletWrapper.java:264)
at com.ibm.ws.cache.servlet.CacheHook.handleFragment(CacheHook.java:344)
at com.ibm.ws.cache.servlet.CacheHook.handleServlet(CacheHook.java:216)
at com.ibm.ws.cache.servlet.ServletWrapper.service(ServletWrapper.java:246)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1282)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1239)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:113)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:82)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:670)
at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:117)
at com.ibm.ws.jsp.webcontainerext.JSPExtensionServletWrapper.handleRequest(JSPExtensionServletWrapper.java:178)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:294)
at com.ibm.ws.webcontainer.webapp.WebApp.sendError(WebApp.java:2593)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:2983)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:221)
at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:210)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1912)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:84)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:472)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:411)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:288)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminaters(NewConnectionInitialReadCallback.java:207)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:109)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:566)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:619)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:952)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1039)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1469)
Anybody used JSC and Websphere with JNDI? I go live next week and don't want to have to configure a context file each time for production.
Regards,
LOTIIs the resource ref the same as you configured for the bundled
Sun App server ?
We do have a sample JNDI application and tip if they help:
http://developers.sun.com/prodtech/javatools/jscreator/reference/code/sampleapps/2/JaasAuthentication.zip
(see the README file in the zip file)
http://developers.sun.com/prodtech/javatools/jscreator/reference/tips/2/jaas_authentication.html
John -
Problems with binding Object (JNDI/WebSphere)
Hello.
I'm trying to bind my objects on WebSphere Application Server 5.0 from stand-alone java application running on remote machine (IBM JRE).
Java source code on remote JVM:
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
props.put(Context.PROVIDER_URL, corbaloc:iiop:tisproject:2811);
final InitialContext ctx = new InitialContext(props);
Object obj = ctx.lookup("");
ctx.bind("MailService", new MailService());class MailService, of course, implements Serializable
I also use property file on client side to connect to remote WAS: sas.client.props with following properties:
com.ibm.CORBA.authenticationTarget=BasicAuth
com.ibm.CORBA.loginSource=properties
com.ibm.CORBA.loginUserid=wpsadmin
com.ibm.CORBA.loginPassword=wpspassword
I consider, that the problem is a kind of security issue, but i can't find the solution. Please, tell me what should I do.
I have the following stacktrace:
12:03:54.967 com.ibm.CORBA.iiop.ClientDelegate@69143a7a invoke:777 P=34108:O=0:CT ORBRas[default] Received SystemException org.omg.CORBA.NO_PERMISSION:
Trace from server: 209891810 at host tisproject.tf.local >>
org.omg.CORBA.NO_PERMISSION: not authorized to perform bind_java_object operation. vmcid: 0x0 minor code: 0 completed: No
at com.ibm.ws.naming.cosbase.WsnOptimizedNamingImplBase.performAuthorizationCheck(WsnOptimizedNamingImplBase.java:2808)
at com.ibm.ws.naming.cosbase.WsnOptimizedNamingImplBase.bind_java_object(WsnOptimizedNamingImplBase.java:844)
at com.ibm.WsnOptimizedNaming._NamingContextImplBase._invoke(Unknown Source)
at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:608)
at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:461)
at com.ibm.rmi.iiop.ORB.process(ORB.java:432)
at com.ibm.CORBA.iiop.ORB.process(ORB.java:1728)
at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2227)
at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:65)
at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:95)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))
<< END server: 209891810 at host tisproject.tf.local
vmcid: 0x0 minor code: 0 completed: No
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:80)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:44)
at java.lang.reflect.Constructor.newInstance(Constructor.java:315)
at com.ibm.rmi.iiop.ReplyMessage._getSystemException(ReplyMessage.java:199)
at com.ibm.rmi.iiop.ReplyMessage.getSystemException(ReplyMessage.java:148)
at com.ibm.rmi.iiop.ClientResponseImpl.getSystemException(ClientResponseImpl.java:207)
at com.ibm.rmi.corba.ClientDelegate.invoke(ClientDelegate.java:526)
at com.ibm.CORBA.iiop.ClientDelegate.invoke(ClientDelegate.java:1150)
at com.ibm.rmi.corba.ClientDelegate.invoke(ClientDelegate.java:748)
at com.ibm.CORBA.iiop.ClientDelegate.invoke(ClientDelegate.java:1180)
at org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:486)
at com.ibm.WsnOptimizedNaming._NamingContextStub.bind_java_object(Unknown Source)
at com.ibm.ws.naming.jndicos.CNContextImpl.cosBindJavaObject(CNContextImpl.java:3229)
at com.ibm.ws.naming.jndicos.CNContextImpl.doBind(CNContextImpl.java:1929)
at com.ibm.ws.naming.jndicos.CNContextImpl.bind(CNContextImpl.java:577)
at com.ibm.ws.naming.util.WsnInitCtx.bind(WsnInitCtx.java:164)
at javax.naming.InitialContext.bind(InitialContext.java:369)
at ru.teleform.mail.reporterclient.MailReporterClient2.main(MailReporterClient2.java:34)
, p1=<null> Server logs:
[15.08.06 12:03:54:762 MSD] bcf7d89 RoleBasedAuth E SECJ0306E: No received or invocation credential exist on the thread. The Role based authorization check will not have an accessId of the caller to check. The parameters are: access check method bind_java_object on resource NameServer and module /com/ibm/ws/naming/bootstrap/xml/NameServer.xml. The stack trace is java.lang.Exception: dump thread stack for debugging
at com.ibm.ws.security.role.RoleBasedAuthorizerImpl.checkAccess(RoleBasedAuthorizerImpl.java:291)
at com.ibm.ws.naming.cosbase.WsnOptimizedNamingImplBase.performAuthorizationCheck(WsnOptimizedNamingImplBase.java:2791)
at com.ibm.ws.naming.cosbase.WsnOptimizedNamingImplBase.bind_java_object(WsnOptimizedNamingImplBase.java:844)
at com.ibm.WsnOptimizedNaming._NamingContextImplBase._invoke(Unknown Source)
at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:608)
at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:461)
at com.ibm.rmi.iiop.ORB.process(ORB.java:432)
at com.ibm.CORBA.iiop.ORB.process(ORB.java:1728)
at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2227)
at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:65)
at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:95)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))
[15.08.06 12:03:54:762 MSD] bcf7d89 RoleBasedAuth A SECJ0305I: Role based authorization check failed for security name <null>, accessId no_cred_no_access_id while invoking method bind_java_object on resource NameServer and module /com/ibm/ws/naming/bootstrap/xml/NameServer.xml.
[15.08.06 12:03:54:778 MSD] bf43d89 RoleBasedAuth E SECJ0306E: No received or invocation credential exist on the thread. The Role based authorization check will not have an accessId of the caller to check. The parameters are: access check method bind_java_object on resource NameServer and module /com/ibm/ws/naming/bootstrap/xml/NameServer.xml. The stack trace is java.lang.Exception: dump thread stack for debugging
at com.ibm.ws.security.role.RoleBasedAuthorizerImpl.checkAccess(RoleBasedAuthorizerImpl.java:291)
at com.ibm.ws.naming.cosbase.WsnOptimizedNamingImplBase.performAuthorizationCheck(WsnOptimizedNamingImplBase.java:2791)
at com.ibm.ws.naming.cosbase.WsnOptimizedNamingImplBase.bind_java_object(WsnOptimizedNamingImplBase.java:844)
at com.ibm.WsnOptimizedNaming._NamingContextImplBase._invoke(Unknown Source)
at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:608)
at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:461)
at com.ibm.rmi.iiop.ORB.process(ORB.java:432)
at com.ibm.CORBA.iiop.ORB.process(ORB.java:1728)
at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2227)
at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:65)
at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:95)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))I have no idea, why properties is not passing onto the server.Hi, I was wondering if you ever managed to resolve this issue. I am having a similar problem. I'm wanting to store an object in JDNI so that it can be referenced by all the servers in our distributed environmant. It works ok for me in mt developemt environment (RAD 6), but that is only because I have global security turned off, as soon as it's deployed to a server with global security turned on it doesn't work, I have read soo much over the past few days and have found that it is to do with the permissions that are set up in the admin console under Server>Environment>naming there are two roles here one is All_Users and the other is All_Authenticated, by default All_Users has read access only.
This is as far as I have got at the moment, I am now looking at how to use these roles from my application without expecting the user of the app to log on, I have found some articles about using JAAS to do this, but I haven't found any good explanations about it or any good examples.
Aside from that is you are just wanting to make your MailService globally available you should look at Dynamic caching, this is a Distributed Map API that will allow you to hold an object in the jndi Tree in a Map using a key, I have gone this route, but am still needing to know how to work with JNDI directly for storing objects.
This is the code I am using:
//lookup name given to the distributed map object
private static final String JNDI_DIST_MAP_LOOKUP = "services/cache/distributedmap";
private void cacheTree(Collection tree) {
logger.debug("TreeNodeManager: cacheTree called");
//TreeNodeManager.tree=tree;
try {
DistributedMap distMap = (DistributedMap) getContext().lookup(
JNDI_DIST_MAP_LOOKUP);
if (logger.isDebugEnabled()) {
logger
.debug("TreeNodeManager: cacheTree: Storing tree in distributedMap '"
+ JNDI_DIST_MAP_LOOKUP
+ "' using Key:'"
+ DIST_MAP_KEY + "'");
distMap.put(DIST_MAP_KEY, tree);
} catch (NamingException e) {
logger.error(e);
}
Maybe you are looking for
-
LIRC not working on Thinkpad 600e
Hi, I recently bought a simple infrared-receiver (attached to the serial port - ttyS0). It works very well with my Desktop (runnung arch linux), but, unfortunately, not with my old thinkpad (also running arch). I followed the lirc-article from the wi
-
Voicemail waiting indicator will not quit flashing
I am using the home phone connect and I had a voicemail. I deleted it and the message waiting indicator will not stop flashing. When I go into the menu it says there are no new messages. So I went into the personal options and selected message wating
-
How to get Host name and SQL Instance Name by T-SQL
I am using SQL 2000, 2005 and 2008. I have few multi instances SQL servers. I would like to gather following information: Host Name SQL Instance Name SQL Version Server1 Server1 SQL 2000 Server1 Server1\ABC SQL 2005 Server1 Server1\XYZ SQL 2008 Serve
-
Mac air not charging, no orange or green lights but the indication on the screen showing being charged but the % not getting better than 38% despite charging it overnite. Help please
-
I use MB pro running Lion OSX 10.7.5 and Now I have bought MB Air with Mountain Lion,Can I transfer my MB Pro stuff running Lion to MB air running Mountain Lion or do I need to buy Mountain Lion for my Pro and create a backup and then transfer ,Altho