[EJB 3.0] - Re: Remote Not bound -- Help me !
by Sukar1205
THis is the error
| javax.naming.NameNotFoundException: remote not bound
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
| at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
| at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
| at org.jnp.server.NamingServer.lookup(NamingServer.java:270)
| at sun.reflect.GeneratedMethodAccessor75.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
| at sun.rmi.transport.Transport$1.run(Transport.java:153)
| at java.security.AccessController.doPrivileged(Native Method)
| at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
| at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
| at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
| at java.lang.Thread.run(Thread.java:595)
| at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
| at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
| at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
| at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:589)
| at javax.naming.InitialContext.lookup(InitialContext.java:351)
| at ejb.Client.lookupCustomerBean(Client.java:92)
| at ejb.Client.main(Client.java:39)
| Exception in thread "main" java.lang.RuntimeException: javax.naming.NameNotFoundException: remote not bound
| at ejb.Client.lookupCustomerBean(Client.java:96)
| at ejb.Client.main(Client.java:39)
| Caused by: javax.naming.NameNotFoundException: remote not bound
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
| at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
| at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
| at org.jnp.server.NamingServer.lookup(NamingServer.java:270)
| at sun.reflect.GeneratedMethodAccessor75.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
| at sun.rmi.transport.Transport$1.run(Transport.java:153)
| at java.security.AccessController.doPrivileged(Native Method)
| at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
| at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
| at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
| at java.lang.Thread.run(Thread.java:595)
| at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
| at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
| at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
| at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:589)
| at javax.naming.InitialContext.lookup(InitialContext.java:351)
| at ejb.Client.lookupCustomerBean(Client.java:92)
| ... 1 more
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4086709#4086709
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4086709
18 years, 9 months
[JBoss Portal] - Re: Render pages based on user roles
by saigon_man
I found the answer to this, eventhough this just satisfied part of my problem. To render the tabs/pages and/or portlets based on user's roles,
1. In *-object.xml
1.1 Under the security-constraint tag, list all possible usernames who can access to this portal
| <security-constraint>
| <policy-permission>
| <role-name>User</role-name>
| <action-name>view</action-name>
| </policy-permission>
| <policy-permission>
| <role-name>Admin</role-name>
| <action-name>view</action-name>
| </policy-permission>
| </security-constraint>
|
1.2 Then, under each tag, you should list the name of the users who can view this page
| <security-constraint>
| <policy-permission>
| <role-name>Admin</role-name>
| <action-name>view</action-name>
| </policy-permission>
| </security-constraint>
|
The Admin username above can view all of the portlets defined for this page.
2. To restrict which portlets should be seen by this Admin user, in the portal-instances.xml, do the same security as above for each portlet instance
| <deployment>
| <instance>
| <instance-id>HelloWorldPortletInstance</instance-id>
| <portlet-ref>HelloWorldPortlet</portlet-ref>
|
| <security-constraint>
| <policy-permission>
| <role-name>Admin</role-name>
| <action-name>view</action-name>
| </policy-permission>
| </security-constraint>
| </instance>
| </deployment>
|
With the codes above, the Admin user when he logs in that page, if there are more than one portlet besides the HelloWorldPortlet, he only sees the HelloWorldPortlet.
Hope this will help others who are looking for the same answer
SGM
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4086707#4086707
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4086707
18 years, 9 months
[EJB 3.0] - Remote Not bound -- Help me !
by Sukar1205
I am testing a customerBean class through a client class but its giving me remote not bound. I checked the JNDI tree and remote is NOT UNDER customerBean. a little help would be great to get this program running. All I am trying to do is add a customer in a table.
Here is the code for client ....
|
| public class Client {
|
| /** Creates a new instance of Client */
| public static void main(String[] args) throws Exception
| {
| Connection conn;
| // Step 1: Load the JDBC driver.
| Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
| System.out.println("Driver Loaded.");
| // Step 2: Establish the connection to the database.
| String url = "jdbc:sqlserver://localhost:1433;database=kc";
| conn = DriverManager.getConnection(url, "sa", "hi");
| System.out.println("Got Connection.");
|
| Client c = new Client();
| CustomerRemote r = c.lookupCustomerBean();
| TempCustomer first = new TempCustomer();
| first.setId(20);
| first.setName("aaaa");
| r.addCustomer(first);
| }
|
This is the lookupCustomerBean function which where it gives me remote not bound
| private CustomerRemote lookupCustomerBean() {
| try {
| Hashtable props = new Hashtable();
| props.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
| props.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
| props.put("java.naming.provider.url", "localhost");
| Context c = new InitialContext(props);
| //HERE IS THE PROBLEM !!
| return (CustomerRemote)c.lookup("CustomerBean/remote");
| }
| catch(NamingException ne) {
| Logger.getLogger(getClass().getName()).log(Level.SEVERE,"exception caught", ne);
| throw new RuntimeException(ne);
| }
| }
|
Please some one tell me what is wrong with this code. why is remote not under customerBean.
Thanks in advance,
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4086705#4086705
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4086705
18 years, 9 months
[EJB 3.0] - Re: EJB 2.1 and EJB 3 in same jar
by Marcin.Cinik
Descriptor file: (it contains declarations for EJB2.1 session beans only - EJB3 beans use annotations for the whole appserver staff).
| <?xml version="1.0" encoding="UTF-8"?>
|
| <ejb-jar 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/j2ee/ejb-jar_3_0.xsd" version="3.0">
|
| <description><![CDATA[No Description.]]></description>
| <display-name>Generated by XDoclet</display-name>
|
| <enterprise-beans>
|
| <!-- Session Beans -->
| <session >
| [...]
|
|
Here is what JBoss 4.2GA says:
| 2007-09-20 15:30:50,257 WARN [ServiceController] Problem creating service jboss.j2ee:service=EJB3,module=xxx.jar
| org.jboss.xb.binding.JBossXBException: Failed to parse source: NYI
| at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:178)
| at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:169)
| at org.jboss.ejb3.metamodel.EjbJarDDObjectFactory.parse(EjbJarDDObjectFactory.java:82)
| at org.jboss.ejb3.Ejb3HandlerFactory$DDFactory.<init>(Ejb3HandlerFactory.java:44)
| at org.jboss.ejb3.Ejb3HandlerFactory.getInstance(Ejb3HandlerFactory.java:83)
| at org.jboss.ejb3.Ejb3Deployment.deploy(Ejb3Deployment.java:365)
| at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:321)
| at org.jboss.ejb3.Ejb3Module.createService(Ejb3Module.java:77)
| at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:260)
|
| [...]
| Caused by: java.lang.RuntimeException: NYI
| at org.jboss.ejb3.metamodel.EjbJarDDObjectFactory.setValue(EjbJarDDObjectFactory.java:1306)
| 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 org.jboss.xb.binding.ObjectModelBuilder.invokeFactory(ObjectModelBuilder.java:417)
| at org.jboss.xb.binding.DelegatingObjectModelFactory.setValue(DelegatingObjectModelFactory.java:154)
| at org.jboss.xb.binding.ObjectModelBuilder.endElement(ObjectModelBuilder.java:358)
| at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHandler.endElement(SaxJBossXBParser.java:295)
| at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
|
|
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4086700#4086700
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4086700
18 years, 9 months