[JBoss Portal] New message: "Re: Portlet that lists all available portals for a user"
by vineet tripathi
User development,
A new message was posted in the thread "Portlet that lists all available portals for a user":
http://community.jboss.org/message/522258#522258
Author : vineet tripathi
Profile : http://community.jboss.org/people/vineet_tripathi
Message:
--------------------------------------------------------------
Approach 1 -
When you create a portal and assign it the security to be viewed by a role or set or roles, that information is persisted in JBP_OBJECT_NODE_SEC, table of jboss portal schema. This table has 3 columns, PK, ROLE, NODE_KEY. If you query this table and group by role you will get the primary keys of all the portals to which a role is having access.
Once you have got the primary key of portals you can access JBP_OBJECT_NODE table to get the name of portals and construct the URLs to them.
Now, All the things that I mentioned above have few cons
1- The table JBP_OBJECT_NODE_SEC is not indexed on ROLE, So if your number of portals will grow you will face performance problem
2- There are portal services to get this information and probably accessing the tables directly will not be a good approach in long term(what if portal schema changes).
Approach 2-
1- Find all the Portals created. You can find the context and then get all the children of context to get a list of all the portals.
To find ur current node
PortalNode root = (PortalNode)request.getAttribute("org.jboss.portal.api.PORTAL_NODE");
PortalNode portal = root;
while (portal.getType() != PortalNode.TYPE_CONTEXT)
{
mainPage = portal;
portal = portal.getParent();
}
portal.getChildren();
configurator
2- get the domain (see the reference guide) and get the uri for each node
3- Find the RoleSecurityBinding associated with each portal
4- use the getRoleName() to determine that to which role the securtiy binding is asscoiated:
RoleSecurityBinding roleSecurityBinding = getDomainConfigurator().getSecurityBindings(uri);
roleSecurityBinding.getRoleName() ;
Let us (everyone in the forum) know ur thoughts and how u finally did it (if you have something else in your mind).
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/522258#522258
16 years, 5 months
[JNDI and Naming] New message: "Re: Name lookup fails, reason unknown"
by Timothy Mowlem
User development,
A new message was posted in the thread "Name lookup fails, reason unknown":
http://community.jboss.org/message/522246#522246
Author : Timothy Mowlem
Profile : http://community.jboss.org/people/jvm
Message:
--------------------------------------------------------------
Ah one thing looks odd. Here is the output of the Refeernce that is returned by the lookup:
Class factory: org.jboss.ejb3.proxy.impl.objectfactory.session.stateless.StatelessSessionProxyObjectFactory
Proxy for: package.interfaces.MyFacade
Looks fine. But the addrs vector contains the following:
Type: ProxyFactoryKey
Content: ProxyFactory/myapp/MyFacade/myapp/MyFacade/remote
Type: EJB Container Name
Content: jboss.j2ee:ear=myapp.ear,jar=beans.jar,name=MyFacade,service=EJB3
Type: Proxy Factory is Local
Content: false
Type: Remote Business Interface
Content: package.interfaces.MyFacade
Type: Remoting Host URL
Content: socket://127.0.0.1:3873/
The proxy factory key looks odd as it repeats myapp/MyFacade twice. Is this correct? Or a clue to the issue?
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/522246#522246
16 years, 5 months
[JNDI and Naming] New message: "Re: Name lookup fails, reason unknown"
by Timothy Mowlem
User development,
A new message was posted in the thread "Name lookup fails, reason unknown":
http://community.jboss.org/message/522234#522234
Author : Timothy Mowlem
Profile : http://community.jboss.org/people/jvm
Message:
--------------------------------------------------------------
> One thing has me confused. There is this statement: "The name being looked up is "<myapp>/<myfacade>/remote" But later you give this code:
>
> @EJB(beanName=<a name>)
> private xyzManager xyzSession;
>
> How does xyzSession relate to "<myapp>/<myfacade>/remote", or is it something completely different? If completely different, why mention it? If is is the same, why is it not:
>
> @EJB(beanName=<a name>)
> private <myfacade> xyzSession;
Sorry Peter I should have made this clearer. I have re-examined the code and what I said is not correct.
The myfacade class is a remote interface and decorated with @Remote.
It extends a set of other interfaces but those interfaces are decorated with @Local, they are NOT remote.
It extends one interface which has no decoration. Rather oddly the implementing class for that interface is decorated thus:
@Stateless(name="ControlledValueManager")
@Remote(value={ControlledValueManagerRemote.class})
public class ControlledValueManagerBean implements ControlledValueManagerLocal, ControlledValueManagerRemote
I don't understand this but I don't see how it can be the cause as the bean seems to be running and the JNDI name seems set.
So I think this is okay. The class contains most of the client calls and uses the other helper beans to do the work.
It uses dependency injection for the helper beans. I suppose the clue was in the name of the class!!
Here are some real examples from the code:
@EJB(beanName="ServiceManager)
private ServiceManager serviceSession;
@EJB(beanName="InstanceManager")
private InstanceManager instanceSession;
@EJB(beanName="SearchManager")
private SearchManager searchSession;
Each interface is @Local.
> Also ,the reference object looks OK - it would appear to be a reference for a "ProxyFactory/myapp/myfacade/myapp/myfacade/remote" which
> seems to indicate that if you cast it to myfacade you should be OK. That is verififed by this info:
>
> Type: Remote Business Interface
> Content: <package>.interfaces.myfacade
Okay. It looks like a standard java ClassCastException. So we are trying to cast a javax.naming.Reference to a package.interfaces.myfacade and that fails which I would expect from J2SE. The error output is:
Connecting to server localhost:1099
2010-01-26 09:47:06,022 DEBUG ContextFactory:41 - Connecting to localhost:1099
2010-01-26 09:47:06,025 DEBUG BeanFinder:57 - Looking up bean: myapp/myfacade/remote
2010-01-26 09:47:06,243 DEBUG BeanFinder:68 - Completed bean lookup
java.lang.ClassCastException: javax.naming.Reference cannot be cast to package.interfaces.myfacade
at package.mySession.<init>(mySession.java:64)
I believe it used to be necessary to do a PortableRemoteObject.narrow (Object obj, Class cls) to cast the returned remote proxy to the correct type but that is no longer necessary with EJB 3? Is the same thing happening but now hidden somehow?
Otherwise surely you would expect a ClassCast because a javax.naming.Reference is not a package.interfaces.myfacade?
>> "The console log showed a couple of warnings:"
>
> I don't think that the warnings have anything to do with this particular problem - as long as the name shows up in the JNDI tree, you should be
> able to look up the EJB. Of course, you might run into issues later with accessing entity beans.
Yes that was what I thought. Hibernate issues would presumably not affect the naming service, only trying to use persistence.
> Where does the client live - the one that is looking up the EJB?
I am running the client which is a java thick client via Eclipse on my MacBook Pro along with JBoss.
The databases are on a local dev server.
Frustrating as it seems to be running fine but the attempt to use it is failing...
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/522234#522234
16 years, 5 months
[JBoss Tools] New message: "Re: seam generate entities for many-to-many relationships"
by Benjamin Janssens
User development,
A new message was posted in the thread "seam generate entities for many-to-many relationships":
http://community.jboss.org/message/522233#522233
Author : Benjamin Janssens
Profile : http://community.jboss.org/people/Goschan
Message:
--------------------------------------------------------------
Hello,
yes the seam gen generates only two entity, but in the xhtml (supplier.xhtml in my case) view file, I have this :
<h:outputText value="There are no lkSupplierAddresses associated with this supplier."
rendered="#{empty supplierHome.lkSupplierAddresses}"/>
<rich:dataTable value="#{supplierHome.lkSupplierAddresses}"
var="_lkSupplierAddress"
rendered="#{not empty supplierHome.lkSupplierAddresses}"
rowClasses="rvgRowOne,rvgRowTwo"
id="lkSupplierAddressesTable">
lkSupplierAddresses is my table with the two IDs as a primary key (suppId and addId), when I try to access this outputText, or dataTable I have this exception :
16:29:15,885 ERROR [viewhandler] Error Rendering View[/Supplier.xhtml]
javax.faces.FacesException: javax.el.PropertyNotFoundException: /Supplier.xhtml @66,77 rendered="#{empty supplierHome.lkSupplierAddresses}": Property 'lkSupplierAddresses' not found on type com.orderform.session.SupplierHome_$$_javassist_seam_11
So there is a problem in the generation of the xhtml files.
Do you know is there is a fix for the generation files ftl ?
Thanks, Benjamin
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/522233#522233
16 years, 5 months
[EJB 3.0] New message: "Re: Problem deploying EJB 3.0 jar to JBoss 5.0.1 GA"
by Viktor Halitsyn
User development,
A new message was posted in the thread "Problem deploying EJB 3.0 jar to JBoss 5.0.1 GA":
http://community.jboss.org/message/522232#522232
Author : Viktor Halitsyn
Profile : http://community.jboss.org/people/vhalitsyn
Message:
--------------------------------------------------------------
The only place where I can see the DefaultDs being mentioned is the standardjbosscmp-jdbc.xml and and login-config.xml located in 'deploy/conf' dir. However this ha nothing to do with my deployment. I don't want all apps to have same login/datasource configuration for EJB. What if I need several EJB packages under one server instance? I also tried 5.1.0 GA this morning - it doesn't give me those errors about TimerService, but I recieve this
12:00:38,747 INFO [MainDeployer] deploy, url=file:/C:/Projects/Java/Test/TestWebApp/testproject-maven-j2ee/model-ejb/target/model-ejb.jar
12:00:38,903 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@28901345{vfszip:/C:/Projects/Java/Test/TestWebApp/testproject-maven-j2ee/model-ejb/target/model-ejb.jar/}
12:00:38,903 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@28901345{vfszip:/C:/Projects/Java/Test/TestWebApp/testproject-maven-j2ee/model-ejb/target/model-ejb.jar/}
12:00:39,028 INFO [JBossASKernel] Created KernelDeployment for: model-ejb.jar
12:00:39,028 INFO [JBossASKernel] installing bean: jboss.j2ee:jar=model-ejb.jar,name=TestTableServiceImpl,service=EJB3
12:00:39,028 INFO [JBossASKernel] with dependencies:
12:00:39,028 INFO [JBossASKernel] and demands:
12:00:39,028 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService
12:00:39,028 INFO [JBossASKernel] persistence.unit:unitName=#MyCompanyEntityManager
12:00:39,028 INFO [JBossASKernel] and supplies:
12:00:39,028 INFO [JBossASKernel] jndi:TestTableServiceImpl/local-com.mycompany.ejb.local.ITestTableServiceLocal
12:00:39,028 INFO [JBossASKernel] Class:com.mycompany.ejb.local.ITestTableServiceLocal
12:00:39,028 INFO [JBossASKernel] jndi:TestTableServiceImpl/remote
12:00:39,028 INFO [JBossASKernel] jndi:TestTableServiceImpl/local
12:00:39,028 INFO [JBossASKernel] jndi:TestTableServiceImpl/remote-com.mycompany.ejb.remote.ITestTableServiceRemote
12:00:39,028 INFO [JBossASKernel] Class:com.mycompany.ejb.remote.ITestTableServiceRemote
12:00:39,043 INFO [JBossASKernel] Added bean(jboss.j2ee:jar=model-ejb.jar,name=TestTableServiceImpl,service=EJB3) to KernelDeployment of: model-ejb.jar
12:00:39,043 INFO [EJB3EndpointDeployer] Deploy AbstractBeanMetaData@c4e0d3{name=jboss.j2ee:jar=model-ejb.jar,name=TestTableServiceImpl,service=EJB3_endpoint bean=org.jboss.ejb3.endpoint.deployers.impl.EndpointImpl properties=[container] constructor=null autowireCandidate=true}
12:00:39,122 WARN [MainDeployer] Failed to deploy: file:/C:/Projects/Java/Test/TestWebApp/testproject-maven-j2ee/model-ejb/target/model-ejb.jar
org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
DEPLOYMENTS MISSING DEPENDENCIES:
Deployment "jboss.j2ee:jar=model-ejb.jar,name=TestTableServiceImpl,service=EJB3" is missing the following dependencies:
Dependency "<UNKNOWN jboss.j2ee:jar=model-ejb.jar,name=TestTableServiceImpl,service=EJB3>" (should be in state "Described", but is actually in state "** UNRESOLVED Demands 'persistence.unit:unitName=#MyCompanyEntityManager' **")
Deployment "jboss.j2ee:jar=model-ejb.jar,name=TestTableServiceImpl,service=EJB3_endpoint" is missing the following dependencies:
Dependency "jboss.j2ee:jar=model-ejb.jar,name=TestTableServiceImpl,service=EJB3" (should be in state "Configured", but is actually in state "PreInstall")
Deployment "persistence.unit:unitName=#MyCompanyEntityManager" is missing the following dependencies:
Dependency "jboss.jca:name=MyCompanyDS,service=DataSourceBinding" (should be in state "Create", but is actually in state "** NOT FOUND Depends on 'jboss.jca:name=MyCompanyDS,service=DataSourceBinding' **")
DEPLOYMENTS IN ERROR:
Deployment "<UNKNOWN jboss.j2ee:jar=model-ejb.jar,name=TestTableServiceImpl,service=EJB3>" is in error due to the following reason(s): ** UNRESOLVED Demands 'persistence.unit:unitName=#MyCompanyEntityManager' **
Deployment "jboss.jca:name=MyCompanyDS,service=DataSourceBinding" is in error due to the following reason(s): ** NOT FOUND Depends on 'jboss.jca:name=MyCompanyDS,service=DataSourceBinding' **
*Important:* with 5.0.1 it actually created the tables in the database for me(although deployed with error) but 5.1.0, out-of -the box didn't.
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/522232#522232
16 years, 5 months