jndi

JNDI Datasource for Spring 4 Hibernate 4 project not working in AWS

旧时模样 提交于 2019-12-11 08:21:59
问题 I'm trying to connect my Spring 4 & Hibernate 4 based web application hosted in Amazon Beanstalk with the database in Amazon RDS using JNDI Datasource. I connected to my EC2 environment using SSH and placed the following in /usr/share/tomcat8/conf/context.xml file; <Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" name="jdbc/TestDatabase" password="abc123" type="javax.sql.DataSource" url="xyz.com:3306/test_jndi" username="abc123"/> And in my Hibernate configuration file I

Using @Resource injection for Mongo db, inside Web Bundle inside OSGI, under Liberty Profile

a 夏天 提交于 2019-12-11 08:20:27
问题 I want to inject Mongo database (com.mongodb.DB) into OSGI Web Bundle Project, using @Resource. The application is to deployed to WebSphere Liberty Profile V8.5.5.1. Is this possible to do it? I got an error message "....The annotations could not be obtained because of the exception : java.lang.NoClassDefFoundError" However, I can inject Mongo database into WAR, using @Resource, running on WebSphere Liberty Profile, if not using OSGI. Below is lookup return null. public static final DB

How do I run range queries on LDAP

。_饼干妹妹 提交于 2019-12-11 07:44:01
问题 I am trying to retrieve data about groups on LDAP. As I need to paginate results, I need to run range queries. My setup uses JNDI to connect to LDAP. I am trying to run this query (&(objectclass=group)(range=1-500)) What am I doing wrong? I know there are range based queries for LDAP,how do I modify this query for get the same? 回答1: Well paging is one thing and range is another. You page the results that you get back from the LDAP server when there are more than 1000 entries (at least that's

giving an EJB a JNDI

狂风中的少年 提交于 2019-12-11 07:37:11
问题 I have created and EJB with a remote interface: @Stateless public class TestSessionBean implements TestSessionRemote { public void businessMethod() { System.out.println ("***businessMethod"); } } I to access it from another component (e.g a servlet) running on the server via: ic = new InitialContext(); ic.lookup("myEJB"); I am using netBeans 6.5.1 and glassfish v2. How can I do that? Thanks, Ido 回答1: actually ejb3 use a default naming convention, wich i've not found a way to get around. The

ClassCastException during JNDI lookup for MongoDB, inside WAB, running Liberty

风流意气都作罢 提交于 2019-12-11 07:09:06
问题 I want to use JNDI lookup for MongoDB, inside WAB/OSGi, running Liberty Profile. import com.mongodb.DB; @WebServlet("/MongoServlet") public class MongoServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { DB db = (DB) new InitialContext().lookup("java:comp/env/mongodb"); } catch (NamingException e) { e.printStackTrace(); } } } The JNDI lookup

JNDI datasource to oracle with grails 1.3

十年热恋 提交于 2019-12-11 06:10:43
问题 I can't get my JNDI datasource running. Followed the official grails doc I set up a datasouce in Config.groovy: grails.naming.entries = [ "mydatasource": [ type: "javax.sql.DataSource", auth: "Container", description: "Development Datasource", url: "jdbc:oracle:oci:@mydb", username: "user", password: "pass", maxActive: "8", maxIdle: "4" ] ] So, my DataSource.groovy looks like: pooled = false jndiName = "mydatasource" I tried for "mydatasource" several different notations like "jdbc

JNDI @Resource annotation

我是研究僧i 提交于 2019-12-11 06:07:12
问题 In servlet and filter classes i can initialize DataSource variable via annotation @Resource(name = "jdbc/testDB") protected DataSource ds; But how it initialize in basic class via annotation? Usually thorows NullPointerException public class AddAuto { @Resource(name = "jdbc/testDB") private DataSource ds; } 回答1: What is your container? If it's tomcat, the resource name should be something like this @Resource(name = "java:/comp/env/jdbc/testDB") protected DataSource ds; I don't know about the

javax.naming.NoInitialContextException using JNDI

喜欢而已 提交于 2019-12-11 05:16:15
问题 Iam trying to connect mysql by using JNDI. But it show an exception javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: See my code : VendorDataSource vds = new VendorDataSource(); vds.setServerName("localhost"); vds.setDatabaseName("jnditest"); vds.setDescription("The data source for inventory and personnel"); try { ctx = new InitialContext(); ctx.bind("jdbc/myds", vds); } catch

selected bean is not in the same module or enterprise application

╄→гoц情女王★ 提交于 2019-12-11 03:58:26
问题 Just a shot in the dark, but do I need a local interface to call a remote stateless EJB? when I try call the bean remotely through Netbeans: Netbeans doesn't allow a remote call, or any call, on this bean. Why not? Trying to do it manually, as below: What is the jndi global remote name for the Remote EJB which is deployed on glassfish? INFO: visiting unvisited references INFO: visiting unvisited references INFO: EJB5181:Portable JNDI names for EJB MyRemoteSessionClass: [java:global

EJB not “visible” to EJB manager. Cannot use CDI or JNDI to reference it

耗尽温柔 提交于 2019-12-11 01:58:52
问题 I have a weird problem that suddenly sprung up when I was trying to create a new EJB and inject it into another EJB so I could call its resources. I'm using Glassfish 3.1, and Java EE 6. I've done this a couple of times before without problems in the same project, but for some reason this EJB causes deployment errors. As soon as I add the annotation @EJB EJBname ejbname; To the bean I want to reference it in and save I get a deployment server error. server logs reveals: Caused by: javax