How to access JDBC Resource registered in Sun Java System App Server ?

I want to create a stand-alone JDBC application with Java SE using Swing technologies and JNDI technology. The purpose of using JNDI technology is to avoid change of Java Source Code every time I move the database to different location. This Java application will be used in a standalone PC installed with Windows XP Professional with no LAN / WAN connection. Of course, Internet connection is available with the PC.
I use JavaDB to store the data tables and the location of the database is D:\E-DRIVE\SAPDEV. Tomorrow, if I move this database to C:\SAPDEV or any network drive, I do not want to change the Java Source code. I want to use JNDI which, if I am not wrong, helps developers to avoid manual change of Java source code whenever the database location is changed. Changes have to be made only in the JNDI Name which contains all relevant information about the database in order to get connection no matter where the database SAPDEV is stored; it can be placed under D:\E-DRIVE directory or C:\ directory of the hard disk. To implement my intention, I started developing Java application as per the steps mentioned below:
Step 1:
To proceed, first, I sought the help of Sun Java System Application Server Admin Console. I created JNDI object for Connection Pool using the menu path Common Tasks->Resources->JDBC->Connection Pools.
JNDI Name : ABAPRPY
Resource Type : javax.sql.DataSource
Datasource class : org.apache.derby.jdbc.ClientDataSource
Description : ABAP Program Repository
The Connection Pool creation has options for General, Advanced and Additional Settings tabs and I made all the settings relevant to the database I created in D:\E-DRIVE\SAPDEV.
To confirm whether the above settings are correct, I pressed the Ping push button which is available in the General tab of the connection pool creation screen. The system responded with the message Ping Succeeded.
Step 2:
I created a JDBC Resource using the menu path Common Tasks->Resources->JDBC->JDBC Resources.
JNDI Name : jdbc/SAPDEV
Pool Name : ABAPRPY
Description : Database Connection for SAPDEV database
Status : Enabled
I can see all the above settings recorded in the domain.xml which is placed in the folder
C:\Sun\AppServer\domains\domain1\config
Step 3:
I have made sure that Sun Java System Application Server is up and running in the background with JavaDB server. I created a Java Program making sure the following JAR files are included in the classpath:
appserv-admin.jar
appserv-ee.jar
appserv-rt.jar
javaee.jar
fscontext.jar
Plus, the lib directory of JDK 1.6 & C:\Sun\AppServer\domains\domain1\config
Source code of the program is as follows: I used NetBeans IDE to create my project file.
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.*;
import javax.activation.DataSource;
public class JNDILookup {
public static void main(String[] args) {
try {
InitialContext initCtx = new InitialContext();
DataSource ds = (DataSource) initCtx.lookup("java:comp/env/jdbc/sapdev>");
} catch (NamingException ex) {
Logger.getLogger(JNDILookup.class.getName()).log(Level.SEVERE, null, ex);
When I attempted to compile the above program in NetBeans IDE ,no compilation error reported. But while executing the program, I got the following run-time error message:
SEVERE: null
javax.naming.NameNotFoundException: No object bound for java:comp/env/jdbc/sapdev> [Root exception is java.lang.NullPointerException]
at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:224)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:396)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at SAPConnect.JNDILookup.main(JNDILookup.java:21)
Caused by: java.lang.NullPointerException
at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:173)
... 3 more
Now, I want to come out of this situation; at the same time, I want to preserve the settings I have made in the Sun Java System Application Server Admin Console. That is, I want to programmatically access the data source using Connection Pool created in Sun Java System Application Server Admin Console.
I request dear forum members to provide me an appropriate solution.
Thanks and regards,
K. Rangarajan.

jay44 wrote:
Bare in mind I am attempting the context.lookup() from inside the container (my code is in a session bean). I have accessed the server and have my bean "say hello" first to verify the bean works OK, then I call a method with this rather standard code:
String jndiDataSourceName ="Second_EJB_Module_DataBase";
Logger.getLogger(DynamicPU.class.getName()).log(Level.INFO,"Programatically acquiring JNDI DataDource: "+ jndiDataSourceName);
InitialContext ctx;
try {
ctx = new InitialContext();
ds =(DataSource)ctx.lookup("java:comp/env/jdbc/"+jndiDataSourceName);
} catch (NamingException ex) {
Logger.getLogger(DynamicPU.class.getName()).log(Level.SEVERE, null, ex);
return "Exception generated trying to preform JDBC DataSource lookup. \n"+ex.toString();
But when I run the code the server log shows the initial context is created Ok, but an exception is thrown becasue the resource name is not found:
(and i have tried vriations of ctx.lookup("jdbc/"+jndiDataSourceName) etc etc
You are fine here. It works in container because the InitialContext properties have been supplied already. That was the link I forwarded earlier. The InitialContext you create locally needs to locate the container JNDI. That is what the properties specify.
Where I am confused is where you indicate the stack below is from the server log. So, you initiate a standalone (java main method) application, create an InitialContext, and you see the results in your app server log?
LDR5010: All ejb(s) of [EJB_Module_1] loaded successfully!
Programatically acquiring JNDI DataDource: Second_EJB_Module_DataBase
The log message is null.
javax.naming.NameNotFoundException: Second_EJB_Module_DataBase not found
at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:216)
at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:188)
at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:192)...
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)
This is strange since I can see this resource (a JDBC connection named Second_EJB_Module_DataBase) is configured on the server from the server's admin console.
That is why you can obtain a lookup from within the container (app server).
For this lookup to work it may be that one must map the name inside an ejb-jar.xml deployed with the application, but I have also read some resources like jdbc connection should have a default name. Does anyone know if my lookup() should work without using an ejb-jar.xml mfile to explcitly map the reource for my application?
Both EBJ's and data sources can be referenced via JNDI. It's a remote lookup (that is normally optimized if it is running in the same JVM). You should not have any dependencies on a JDBC data source being set-up on ejb-jar.xml. That file can of course impact your EJB's. However, data sources are normally set-up on a container-specific basis (e.g., you probably did it through a console, but there is a spec somewhere about how to set up a data source via a resource the app server looks for; it varies from app server to app server). However, once you have that container-specific data source set-up, JNDI operates vendor-neutral. You should be able to take the code above and move it to JBoss or Weblogic or Tomcat or whatever (this is an ideal, in practice, the vendors sometimes put a data source in a name you would not expect, but again, you can use their JMX console to see what the JNDI name is).
(As I stated above if I have to use a deployment discriptor to get at this JNDI datasource, then solution is not "programmatic" as newly configured datasources could not be accessed without redeploying the entire application).
As JSchell alluded to, you will always have at least something vendor-specific. JNDI itself (the code you wrote) is totally portable. However, you have to set the various JNDI environment properties to a given vendor's spec. Ideally, you should not need a vendor's actual InitialContext application, but it's a possibility. Once you can safely cast to Context, you should be vendor-neutral (if not, demand your money back).
So that is exactly where I am stuck, trying to get the lookup to work and wondering if it should work without and xml file mapping the resource for my app.
What we ended up doing for standalone was to provide our own JNDI. If you look at the open source project JOTM, there are examples on how to use that with XBean (if integrating with Spring, as we did), you can easily set up a data source that runs standalone exactly as you get in the container. Another benefit is you get full JTA/JTS support and the ability to run XA transactions. (This might all be alphabet soup, but the app server gives it to you, and this is the way we ended up doing the same: JNDI + JTA + JTS + XA). It ends up the same application code uses a "vanilla" InitialContext and all we have to do is write one or two xml files (one for our app server, a couple for JOTM), and our actual code works the same.
I still think you have a shot at getting to the container's JNDI, just not using their full-blown app server JAR.
I think there must be a simple way to do this with an ejb-jar.xml, I am no expert in JNDI, I could be missing something simple, I will keep at it and post an answer here if I come up with it.
Thanks, jayIt is simple to code. Getting it to integrate with your app server, yes, that can be challenging. But it has nothing to do with EJB's. Write a simple test. Using nothing but DataSource and InitialContext. Let us know where you get stuck.
- Saish

Similar Messages

  • How can I deploy JBI Application in Sun Java System Application Server 9?

    I developed a demo "Loan Processing Composite Application " in Netbeans.org(http://www.netbeans.org/kb/55/loanprocessing.html).
    The guide only show the deployment using Netbeans6.Now I want to deploy it directly using Server9 , how can I do?
    How to deploy a soa application in Sun Java System Application Server 9? Is there any doc?
    Please~~I'm puzzled.

    To deploy a JBI application to Sun's App Server, you will need a JBI compliant ESB installed. OpenESB would be my first choice here. Then as far as installing your components without Netbeans, there are two choices. 1) Copy your SA's to the JBI/ESB autodeploy directory and you binding components and service engines to the JBI/ESB autoinstall directory. 2) Use the ant tasks that the JBI specification (http://jcp.org/en/jsr/detail?id=208) requires for all JBI implementations. OpenESB's JBI tasks are detailed here: http://wiki.open-esb.java.net/Wiki.jsp?page=JBIAntTaskReference. These ant tasks can be wrapped with maven goals if needed.
    Jeff

  • Configure MS SQL Server 2000 DataSource in Sun Java Systema App Server

    How can I configure Sun Java Systema App Server 8 to use a DataSource of MSSQL Server 2000?

    This has been covered in this forum multiple times. It is also documented in the SJSAS developers guide jdbc chapter. If you still have questions, please post, but the info has previously been discussed here and recently

  • Using Sun Java System App Server Update 1 with JDK1.5's XML

    Hi,
    I have some new code that uses new XML features from JDK 1.5,
    e.g., the Validation API.
    However, this code fails to run on Sun Java System App Server Update 1,
    since the server uses the 'endorsed' mechanism to load outdated XML libraries.
    When I remove the outdated XML JAR's from the server's 'endorsed' directory,
    the server fails to start....
    I would really like to keep using the new XML features....

    Where are you placing your jars? I would bundle them with your application. Do not replace the system jars.
    There were some package changes to avoid collisions that I believe made jswdp 1.4 and sjsas 8.1

  • SetConnectTimeout Doesn't Work in Sun Java System App Server EE 8.1

    Hi all,
    I have a code that sends a request through HTTP using HttpURLConnection. Roughly, the code is as follows.
    HttpURLConnection huc = (HttpURLConnection) url.openConnection();
    huc.setConnectTimeout(10000); // 10 seconds.
    ....I tested it in a normal Java console program and it was working fine. I tested it again inside a servlet using Tomcat and it was okay. But when I tested in a servlet using Sun Java System Application Server, it didn't work. I reckon there must be some configuration that I need to set in Sun Java Application Server, but I just don't know where. I've been googling it for few days with no answer :( Do you guys have any idea about this?
    Thanks in advance.

    Hi all,
    I have a code that sends a request through HTTP using HttpURLConnection. Roughly, the code is as follows.
    HttpURLConnection huc = (HttpURLConnection) url.openConnection();
    huc.setConnectTimeout(10000); // 10 seconds.
    ....I tested it in a normal Java console program and it was working fine. I tested it again inside a servlet using Tomcat and it was okay. But when I tested in a servlet using Sun Java System Application Server, it didn't work. I reckon there must be some configuration that I need to set in Sun Java Application Server, but I just don't know where. I've been googling it for few days with no answer :( Do you guys have any idea about this?
    Thanks in advance.

  • Does anyone have SSL working with the Sun Java System App Server PE?

    We have been having problems (to say the least) getting SSL to work with the Sun Java Application Server 8.1 Platform Edition.
    We have a signed certificate from VeriSign and have it imported correctly, but when you test it by going to https://localhost:8182/ (note that 8182 is the port set up for SSL) you get a warning mesage saying that the certificate cannot be verified. When you view the certificate you see that it is the one that got automatically generated for you by the app server and not the one we purchased from VeriSign.
    So, I was just wondering if anyone out there has gotten this to work and if so, what document did you follow to tell yoiu how it was done!
    THANK YOU!

    once apon a time i had a real problem with the same issue.. best of luck.. i forget now how to fix.. sorry.

  • How can I run a servlet with Sun Java System Application Server PE 8?

    I've created a package with a TestServlet.class inside, used the deploytool to create a WAR and deployed this using the autodeploy folder.
    The filestructure has been generated and I find the TestServlet.class in
    [installdir]\domains\domain1\applications\j2ee-modules\testProject\WEB-INF\classes\[packagefolderstructure]\TestServlet.class.
    The context root is working fine, but I have no clue how I can run the servlet directly via the URL.
    I've tried many things like
    http://localhost:8080/testProject/TestServlet
    http://localhost:8080/testProject/servlet/TestServlet
    http://localhost:8080/testProject/servlet/[packagenamewithpoints]TestServlet
    http://localhost:8080/testProject/servlet/[packagenamewithslashes]TestServlet
    etc etc
    Can somebody tell me please how to write URLs to deployed servlets? Or send me an example url and xml descriptor files?
    Thanks a lot in advance!

    in web.xml use servlet mapping
    <servlet-mapping>
        <servlet-name>TestServlet</servlet-name>
        <url-pattern>/doit</url-pattern>
    </servlet-mapping>then use http://localhost:8080/testProject/doit

  • How to disable non secure port on Sun Java System Directory Server 5.2

    Hi, can someone tell me how to disable the non secure port 389 on the SJS Directory Server 5.2? I only see two options for the directory server to listen on the non secure port or both secure and non secure ports. I see that someone mentioned to change the port the loopback ip address but the gui doesn't allow that.
    Any help is appreciated.
    Thanks,
    Mike

    Yep! You can add the loopback address to the listen host attr, directly to the dse.ldif (insntace stopped of course) or ldapmodify the config entry

  • Firebird connection pool on Sun Java System App Server 8.0.0_01

    Hello everybody!
    I�ve tried (without success) to make a Firebird connection pool (of type "javax.sql.ConnectionPoolDataSource") on Sun AS 8.
    I�ve used "org.firebirdsql.pool.FBConnectionPoolDataSource" class (and I�ve tried also the other classes from the "firebirdsql-full.jar" package that�s included in Firebird 1.5.0 JDBC Driver distribution).
    Things appear to be OK, but I never get a response after ping-ing the resource...and this not OK, for sure...
    I might mention that any other connection pool that I�ve done (mysql, oracle, db2, mssql) works fine.
    Any thoughts?
    Thank you.

    The answer is yes. I can connect without a pool, through DriverManager.getConnection(...) and so on...
    Also, the config information for the pool conforms the driver docs. The strange thing is that I can register a Firebird DataSource with the "fscontext" JNDI provider, and I can lookup the registered DataSource...

  • Sun Java System Application Server  into Netbean 6.1

    Hi , I am new to Java community,
    I like to lean J2EE so I downloaded
    jdk-1_5_0_16-windows-i586-p and installed
    then I installed
    java-tools-bundle-update5-windows
    I am trying to do the initial setup and do the sample
    The Java EE 5 Tutorial
    See this tutorial for information on building and deploying Java EE 5 applications.
    When I try to register the Sun Java System Application Server into Netbean 6.1
    I could not I have warning, says
    Provide a valid server installation location
    But I gave, C:\Sun\AppServer
    If you guys can give any light on this appreciated

    It doesn't sound like you have installed a Java EE (formerly J2EE) application server. Your download of "jdk-1_5_0_16-windows-i586-p" is Java Standard Edition, which you need, but you also need an implementation of Java Enterprise Edition. The [Sun Java System Application Server|http://developers.sun.com/appserver/] is certainly a valid Java EE implementation, but I don't see in your steps where you downloaded that. There are several types of NetBeans downloads ("bundles") you can perform and I believe that one or more bundles (such as "All" and "Web & Java EE") includes GlassFish as part of the download. I recommend using the GlassFish Java EE implementation that comes with NetBeans 6.1 for learning how to use Java EE with NetBeans. Alternatively, you can download GlassFish separately at [https://glassfish.dev.java.net/|https://glassfish.dev.java.net/].

  • How do I use a JDBC Resource set-up in Sun Java System Appliation Server?

    How do I use a JDBC Resource set-up in Sun Java System Appliation Server 8.2?
    I created a JDBC Resource labeled "jdbc/__PetroPool" that is backed by a Connection Pool labeled "PetroPool".
    Since this is set-up in Sun Java System Appliation Server 8.2, I am looking for suggestions, examples or guides on how I can use this connection.
    I've been browsing the developer's guide for Sun Java System Appliation Server 8.2 without much luck.
    Googling really doesn't provide a lot of useful information either...
    Any suggestions, examples or guides on how I can use this connection is greatly appreciated.
    Thanks,
    --Todd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    How do I use a JDBC Resource set-up in Sun Java System Appliation Server 8.2?
    I created a JDBC Resource labeled "jdbc/__PetroPool" that is backed by a Connection Pool labeled "PetroPool".
    Since this is set-up in Sun Java System Appliation Server 8.2, I am looking for suggestions, examples or guides on how I can use this connection.
    I've been browsing the developer's guide for Sun Java System Appliation Server 8.2 without much luck.
    Googling really doesn't provide a lot of useful information either...
    Any suggestions, examples or guides on how I can use this connection is greatly appreciated.
    Thanks,
    --Todd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Adding a JDBC driver in Sun Java System Web Server 7

    I'm trying to configure JDBC database connection pooling for a Microsoft SQL Server 2005 Express Edition though the Sun Java System Web Server 7 administration console. I don't want to use the MSSQL JDBC driver that comes bundled with the SJSWS 7. So I've downloaded the lastest MSSQL JDBC driver from the Microsoft website and put in the "lib" subdirectory of the SJSWS installation directory. So when I go to add a new JDBC resource through the administration console, the newly added MSSQL database driver doesn't appear in the "Driver Vendor" drop-down box.
    How do I add the downloaded JDBC driver to the server so that it appears in the "Driver Vendor" drop-down under "Create JDBC resource".

    Check this documentation from MS on using the JDBC driver with DataSource
    http://msdn2.microsoft.com/en-us/library/ms379052.aspx
    SJS Web Server 7.0 should work with any driver that has support for javax.sql.DataSource. The great majority of drivers do.
    So instead of using the driver name, use the DataSource class name:
    com.microsoft.sqlserver.jdbc.SQLServerDataSource
    The properties to add should be:
    user=username
    password=password
    servername=sql_server_hostname
    portnumber=sql_server_port
    databasename=databasename
    In general, all the setters required to get the datasource configured can be set as properties.

  • How deploy the EJB in security on the Sun Java System Application Server 9?

    I hava deploied a simple Hello EJB Object on PE 9(Sun Java System Application Server Platform Edition 9). I can use this EJB object without user name an password On any client. See the following code section:
         public static void main(String[] args) {
              try{
                   Properties props = System.getProperties();
                   props.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.enterprise.naming.SerialInitContextFactory");
                   props.put(Context.PROVIDER_URL,"iiop://localhost:3700");
                   Context ctx = new InitialContext(props);
                   Hello h = (Hello) ctx.lookup("ejb/test/Hello");
                   System.out.println(h.sayHello());
              }catch(Exception e){
                   e.printStackTrace();
    Please tell me how deploy the EJB in security on the Sun Java System Application Server 9? So that, The client must set the user name and password when lookup the ejb object. Like the following:
    props.put(Context.SECURITY_PRINCIPAL,"admin")
    props.put(Context.SECURITY_CREDENTIALS,"1234");

    Guys,
    I too have the same issue. If anyone has an answer, please let me know.
    Is this GlassFish problem? or Prgram issue?
    Find below the source code
    package TransactionSecurity.bean;
    import javax.annotation.Resource;
    import javax.annotation.security.DeclareRoles;
    import javax.annotation.security.PermitAll;
    import javax.annotation.security.RolesAllowed;
    import javax.ejb.Remote;
    import javax.ejb.SessionContext;
    import javax.ejb.Stateless;
    import javax.ejb.TransactionAttribute;
    import javax.ejb.TransactionAttributeType;
    @Stateless
    @Remote(TSCalculator.class)
    @DeclareRoles({"student", "teacher"})
    public class TSCalculatorBean implements TSCalculator {
         private @Resource SessionContext ctx;
         @PermitAll
    //     @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
         public int add(int x, int y) {
              System.out.println("CalculatorBean.add  Caller Principal:" + ctx.getCallerPrincipal().getName());
              return x + y;
         @RolesAllowed( { "student" })
         public int subtract(int x, int y) {
              System.out.println("CalculatorBean.subtract  Caller Principal:" + ctx.getCallerPrincipal().getName());
              System.out.println("CalculatorBean.subtract  isCallerInRole:" + ctx.isCallerInRole("student"));
              return x - y;
         @RolesAllowed( { "teacher" })
         public int divide(int x, int y) {
              System.out.println("CalculatorBean.divide  Caller Principal:" + ctx.getCallerPrincipal().getName());
              System.out.println("CalculatorBean.divide  isCallerInRole:" + ctx.isCallerInRole("teacher"));
              return x / y;
    package TransactionSecurity.bean;
    import javax.ejb.Remote;
    @Remote
    public interface TSCalculator {
            public int add(int x, int y);
            public int subtract(int x, int y);
            public int divide(int x, int y);
    package TransactionSecurity.client;
    import java.util.Properties;
    import javax.ejb.EJBAccessException;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import TransactionSecurity.bean.TSCalculator;
    public class TSCalculatorClient {
         public static void main(String[] args) throws Exception {
              // Establish the proxy with an incorrect security identity
              Properties env = new Properties();
              env.setProperty(Context.SECURITY_PRINCIPAL, "kabir");
              env.setProperty(Context.SECURITY_CREDENTIALS, "validpassword");
            env.setProperty(Context.INITIAL_CONTEXT_FACTORY,"com.sun.appserv.naming.S1ASCtxFactory");
            env.setProperty(Context.PROVIDER_URL,"iiop://127.0.0.1:3700");
            env.setProperty("java.naming.factory.initial","com.sun.enterprise.naming.SerialInitContextFactory");
            env.setProperty("java.naming.factory.url.pkgs","com.sun.enterprise.naming");
            env.setProperty("java.naming.factory.state","com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
            env.setProperty("org.omg.CORBA.ORBInitialHost", "127.0.0.1");
            env.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
              InitialContext ctx = new InitialContext(env);
              TSCalculator calculator = null;
              try {
                   calculator = (TSCalculator) ctx.lookup(TSCalculator.class.getName());
              } catch (Exception e) {
                   System.out.println ("Error in Lookup");
                   e.printStackTrace();
                   System.exit(1);
              System.out.println("Kabir is a student.");
              System.out.println("Kabir types in the wrong password");
              try {
                   System.out.println("1 + 1 = " + calculator.add(1, 1));
              } catch (EJBAccessException ex) {
                   System.out.println("Saw expected SecurityException: "
                             + ex.getMessage());
              System.out.println("Kabir types in correct password.");
              System.out.println("Kabir does unchecked addition.");
              // Re-establish the proxy with the correct security identity
              env.setProperty(Context.SECURITY_CREDENTIALS, "validpassword");
              ctx = new InitialContext(env);
              calculator = (TSCalculator) ctx.lookup(TSCalculator.class.getName());
              System.out.println("1 + 1 = " + calculator.add(1, 1));
              System.out.println("Kabir is not a teacher so he cannot do division");
              try {
                   calculator.divide(16, 4);
              } catch (javax.ejb.EJBAccessException ex) {
                   System.out.println(ex.getMessage());
              System.out.println("Students are allowed to do subtraction");
              System.out.println("1 - 1 = " + calculator.subtract(1, 1));
    }The user kabir is created in the server and this user belongs to the group student.
    Also, I have enabled the "Default Principal To Role Mapping"
    BTW, I'm able to run other EJB3 examples [that does'nt involve any
    security features] without any problems.
    Below is the ERROR
    Error in Lookupjavax.naming.NamingException: ejb ref resolution error for remote business interfaceTransactionSecurity.bean.TSCalculator [Root exception is java.rmi.AccessException: CORBA NO_PERMISSION 0 No; nested exception is:
         org.omg.CORBA.NO_PERMISSION: ----------BEGIN server-side stack trace----------
    org.omg.CORBA.NO_PERMISSION:   vmcid: 0x0  minor code: 0  completed: No
         at com.sun.enterprise.iiop.security.SecServerRequestInterceptor.handle_null_service_context(SecServerRequestInterceptor.java:407)
         at com.sun.enterprise.iiop.security.SecServerRequestInterceptor.receive_request(SecServerRequestInterceptor.java:429)
         at com.sun.corba.ee.impl.interceptors.InterceptorInvoker.invokeServerInterceptorIntermediatePoint(InterceptorInvoker.java:627)
         at com.sun.corba.ee.impl.interceptors.PIHandlerImpl.invokeServerPIIntermediatePoint(PIHandlerImpl.java:530)
         at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.getServantWithPI(CorbaServerRequestDispatcherImpl.java:406)
         at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:224)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1846)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1706)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:1088)
         at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:223)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:806)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:563)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2567)
         at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)
    ----------END server-side stack trace----------  vmcid: 0x0  minor code: 0  completed: No]
         at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:425)
         at com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:74)
         at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
         at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:403)
         at javax.naming.InitialContext.lookup(InitialContext.java:351)
         at TransactionSecurity.client.TSCalculatorClient.main(TSCalculatorClient.java:35)
    Caused by: java.rmi.AccessException: CORBA NO_PERMISSION 0 No; nested exception is:
         org.omg.CORBA.NO_PERMISSION: ----------BEGIN server-side stack trace----------
    org.omg.CORBA.NO_PERMISSION:   vmcid: 0x0  minor code: 0  completed: No
         at com.sun.enterprise.iiop.security.SecServerRequestInterceptor.handle_null_service_context(SecServerRequestInterceptor.java:407)
         at com.sun.enterprise.iiop.security.SecServerRequestInterceptor.receive_request(SecServerRequestInterceptor.java:429)
         at com.sun.corba.ee.impl.interceptors.InterceptorInvoker.invokeServerInterceptorIntermediatePoint(InterceptorInvoker.java:627)
         at com.sun.corba.ee.impl.interceptors.PIHandlerImpl.invokeServerPIIntermediatePoint(PIHandlerImpl.java:530)
         at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.getServantWithPI(CorbaServerRequestDispatcherImpl.java:406)
         at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:224)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1846)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1706)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:1088)
         at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:223)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:806)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:563)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2567)
         at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)
    ----------END server-side stack trace----------  vmcid: 0x0  minor code: 0  completed: No
         at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.mapSystemException(Util.java:277)
         at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:205)
         at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:152)
         at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(BCELStubBase.java:225)
         at com.sun.ejb.codegen._GenericEJBHome_Generated_DynamicStub.create(com/sun/ejb/codegen/_GenericEJBHome_Generated_DynamicStub.java)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:372)
         ... 5 more
    Caused by: org.omg.CORBA.NO_PERMISSION: ----------BEGIN server-side stack trace----------
    org.omg.CORBA.NO_PERMISSION:   vmcid: 0x0  minor code: 0  completed: No
         at com.sun.enterprise.iiop.security.SecServerRequestInterceptor.handle_null_service_context(SecServerRequestInterceptor.java:407)
         at com.sun.enterprise.iiop.security.SecServerRequestInterceptor.receive_request(SecServerRequestInterceptor.java:429)
         at com.sun.corba.ee.impl.interceptors.InterceptorInvoker.invokeServerInterceptorIntermediatePoint(InterceptorInvoker.java:627)
         at com.sun.corba.ee.impl.interceptors.PIHandlerImpl.invokeServerPIIntermediatePoint(PIHandlerImpl.java:530)
         at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.getServantWithPI(CorbaServerRequestDispatcherImpl.java:406)
         at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:224)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1846)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1706)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:1088)
         at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:223)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:806)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:563)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2567)
         at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)
    ----------END server-side stack trace----------  vmcid: 0x0  minor code: 0  completed: No
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
         at com.sun.corba.ee.impl.protocol.giopmsgheaders.MessageBase.getSystemException(MessageBase.java:913)
         at com.sun.corba.ee.impl.protocol.giopmsgheaders.ReplyMessage_1_2.getSystemException(ReplyMessage_1_2.java:131)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.getSystemExceptionReply(CorbaMessageMediatorImpl.java:685)
         at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.processResponse(CorbaClientRequestDispatcherImpl.java:472)
         at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.marshalingComplete(CorbaClientRequestDispatcherImpl.java:363)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.invoke(CorbaClientDelegateImpl.java:219)
         at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:192)
         ... 13 moreAny help is appreciated.
    Regards!
    Nithi.
    Edited by: EJB3 on Aug 17, 2008 8:17 PM

  • Tivoli Access Manager 6.0 with Sun Java System Directory 6.3

    Hi,
    We have been using Tivoli Access Manager 6.0 with Sun Java System Directory 6.3 .
    Using IBM TAM Java API we can administer the user creation but the API provide support only to create user with required attribute as user name, password, description, setAccoutntvalid etc.
    But Sun Java System Directory 6.3 contains the many attributes as just to name a few...
    First Name (givenname), User ID (uid),Password (userPassword), Confirm Password
    E-mail (mail), Telephone Number (telephoneNumber), Country (c),Fax Number (facsimileTelephoneNumber), Locality (l), Organization (o), Organizational Unit (ou), accessHint, accountHint, departmentNumber, description, destinationIndicator, displayName, employeeNumber ETC...
    Now My Issue is if we need to add the values for other attributes as "accessHint" , "employeeNumber" etc, then how can we acheive using IBM TAM Java API or is there any other way.
    Thanks for your kind help...

    Looks like the attribute sunIdentityServerDiscoEntries is defined twice in the schema. Run the following and see where it is defined for the second time.
    # cd /var/opt/SUNWdsee/dsins1/config/schema
    # grep -w sunIdentityServerDiscoEntries *.ldif | grep -iv objectclasses
    Edited by: etst123 on Mar 3, 2009 1:28 PM

  • How to make weblogic proxy to work on Sun Java system web server 7?

    Hi Every one,
    I am working on upgrade our Sun one 6.1 webserver to Sun Java system web server 7. Our website uses weblogic server to process jsp, web server only send static pages. I did all configurations as on Sun one. But somehow, the webserver does not forward "get jsp page" request to weblogic. The log record is:
    for host 10.78.124.118 trying to GET /home.jsp, send-file reports: HTTP4142: can't find /www/a/WebServer7/docs/bmd9i/home.jsp (File not found)
    home.jsp is at weblogic server.
    And redirect "NameTrans fn="redirect" from="/" url="/home.jsp"" seems does not work. when I type on IE http://32.69.253.131/ (32.69.253.131 is http listener IP), it always shows index.html page under the document root.
    Could some on can help? I am the first time to configurate web server. Thanks in advance.
    The configuration files are like:
    1. magnus.conf
    # Copyright 2006 Sun Microsystems, Inc. All rights reserved.
    # Use is subject to license terms.
    Init fn="load-modules" funcs="wl_proxy,wl_init" shlib="/www/a/WebServer7/weblogic6.1sp6/libproxy.so"
    Init fn="wl_init"
    2. obj.conf
    # Copyright 2010 Sun Microsystems, Inc. All rights reserved.
    # Use is subject to license terms.
    # You can edit this file, but comments and formatting changes
    # might be lost when you use the administration GUI or CLI.
    #<Object name="weblogic">
    #Service fn="wl_proxy" WebLogicCluster="32.69.253.86:7210" ConnectTimeoutSecs="240" ConnectRetrySecs="60"
    #</Object>
    <Object name="default">
    <Client method="TRACE">
    AuthTrans fn="set-variable" remove-headers="transfer-encoding" set-headers="content-length: -1" error="501"
    </Client>
    #AuthTrans fn="match-browser" browser="*MSIE*" ssl-unclean-shutdown="true"
    NameTrans fn="strip-params"
    NameTrans fn="redirect" from="/" url="/home.jsp"
    NameTrans fn="redirect" from="/index.jsp" url="/home.jsp"
    NameTrans fn="redirect" from="/index.html" url="/home.jsp"
    NameTrans fn="document-root" root="$docroot"
    NameTrans fn="pfx2dir" from="/mc-icons" dir="/www/a/WebServer7/lib/icons" name="es-internal"
    NameTrans fn="home-page" path="index.html"
    <If $uri =~ "/*.jsp">
    Service method="(GET|HEAD|POST|PUT)" fn="wl_proxy" WebLogicCluster="32.69.253.86:7210" ConnectTimeoutSecs="240" ConnectRetrySecs="60"
    #Service method="(GET|HEAD|POST|PUT)" type="text/jsp" fn="wl_proxy" WebLogicCluster="32.69.253.86:7210" ConnectTimeoutSecs="240" ConnectRetrySecs="60"
    </If>
    PathCheck fn="unix-uri-clean"
    PathCheck fn="check-acl" acl="default"
    PathCheck fn="find-pathinfo"
    PathCheck fn="find-compressed" check-age="off" vary="on"
    ObjectType fn="type-by-extension"
    ObjectType fn="force-type" type="text/plain" charset="iso_8859-1"
    ObjectType fn="set-default-type" charset="iso_8859-1"
    Service method="(GET|HEAD)" type="magnus-internal/directory" fn="send-error"
    Service method="(GET|HEAD)" type="*~magnus-internal/*" fn="send-file"
    AddLog fn="flex-log" name="access"
    </Object>
    <Object name="es-internal">
    PathCheck fn="check-acl" acl="es-internal"
    </Object>
    <Object name="send-precompressed">
    PathCheck fn="find-compressed"
    </Object>
    <Object name="compress-on-demand">
    Output fn="insert-filter" filter="http-compression"
    </Object>
    3.mime.types
    I add one line: type=text/jsp exts=jsp

    Quick obvious question - Are you positive you're editing the correct obj.conf? Check the config directory and see if there is a second one called something like <instance>.obj.conf (where <instance> is the name of your configured instance).
    Alternatively you can grep for object-file in the server.xml to see which obj.conf the server is using:
    # grep object-file server.xml
        <object-file>bare-php.obj.conf</object-file>Assuming that you are editing the correct obj.conf file, are you making certain to restart Web Server after making your changes?

Maybe you are looking for