[JBoss Portal] - Re: How to get error messages on Login Failed
by matallen
I realise this is a late reply, but hopefully someone will find this answer useful.
Step 1) override the getUserStatus method in your custom loginModule
ie.
| @Override
| protected UserStatus getUserStatus(String inputPassword){
| MyUserVO user=getUserService().getUserByName(getUsernameAndPassword()[0]);
| if (!myLoginCheck(user)){
| return MyUserStatus.MY_ERROR_MESSAGE_1;
| }
| return super.getUserStatus(inputPassword);
| }
|
Step 2) pseudo extend UserStatus (the constructor is actually private so you need to reflect it). note: getUserStatus is called in the Login method if the login is successful - so remember to put any logic for a failure is the Abort method and successful login code in the Commit method
ie.
| public class MyUserStatus {
| public static UserStatus MY_ERROR_MESSAGE_1=naughtyCallOfPrivateConstructor(33945);
| private static UserStatus naughtyCallOfPrivateConstructor(int i){
| try{
| Class<?> c = Class.forName(UserStatus.class.getCanonicalName());
| Constructor[] allConstructors = c.getDeclaredConstructors();
| for (Constructor ctor : allConstructors) {
| ctor.setAccessible(true);
| UserStatus res=(UserStatus)ctor.newInstance(i);
| ctor.setAccessible(false); //return it just in case this causes an issue elsewhere
| return res;
| }
| }catch(IllegalAccessException e){
| e.printStackTrace();
| }catch(Exception e){
| e.printStackTrace();
| }
| return null;
| }
| }
|
Step 3) change your portal-server.war/login.jsp to use the new MyUserStatus - ie.
| else if (MyUserStatus.MY_ERROR_MESSAGE_1.equals(request.getAttribute("org.jboss.portal.userStatus"))){
| out.println(rb.getString("ACCOUNT_MY_ERROR_MESSAGE_1"));
| }
|
and don't forget to put the error message text in the resources file (Resource.properties in conf/bundles/)
hope this helps,
M
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4233208#4233208
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4233208
16 years, 11 months
[Installation, Configuration & DEPLOYMENT] - Problem: deployment with external Derby DB.
by sergan_m
Hello everyone, i'm new here....
I try to deploy a big RAP Project(110 jars) on JBOSS 4.2.3 Server with using of external Derby DB as data-source.
(You may be answer why not JBOSS 5.0- because it has JMX conflict with Derby). When I deploy my Project("finca27.war") 95 from 110 jar where deployed and where set as ACTIVE, but another 15 only as RESOLVED, because the Connection with derby faild :( I have create the "derby-ds.xml" with user and password in Deploy Folder of the Jboss.
Anywhere I have read that Derby needs "PERSISTENCE.XML". I have created it also, but I don't know where to put it in my Project with, which I create my "finca27.war". Is it necessary this "persistance.xml"?
PLEASE HELP!!! I have a battle with deployment on JBOSS for a long time
With your help, I hope I'll win this battle ;)
Thank you!!!
Here is my "DERBY-DS.XML":
<?xml version="1.0" encoding="UTF-8"?>
<local-tx-datasource>
<!-- The jndi name of the DataSource, it is prefixed with java:/ -->
<!-- Datasources are not available outside the virtual machine -->
<jndi-name>DerbyDS</jndi-name>
<!-- for in-process persistent db, saved when jboss stops. The
org.jboss.jdbc.DerbyDatabase mbean is necessary for properly db shutdown -->
<connection-url>jdbc:derby://localhost:23950/FINCAEVT</connection-url>
<!-- The driver class -->
<driver-class>org.apache.derby.jdbc.ClientDriver</driver-class>
<!-- The login and password -->
<user-name>webadmin</user-name>
webadmin
<!-- The minimum connections in a pool/sub-pool. Pools are lazily constructed on first use -->
<min-pool-size>5</min-pool-size>
<!-- The maximum connections in a pool/sub-pool -->
<max-pool-size>20</max-pool-size>
<!-- The time before an unused connection is destroyed -->
<idle-timeout-minutes>5</idle-timeout-minutes>
<!-- Whether to check all statements are closed when the connection is returned to the pool,
this is a debugging feature that should be turned off in production -->
<track-statements></track-statements>
<!-- This mbean can be used when using in process persistent derby -->
jboss:service=Derby
</local-tx-datasource>
FINCAEVT
here is my "Persistence.xml"
<?xml version="1.0" encoding="UTF-8"?>
<persistence-unit name="FINCAEVT">
<jta-data-source></jta-data-source>
</persistence-unit>
Here are my Logs...
16:06:44,103 INFO [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.
16:06:44,259 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DerbyDS' to JNDI name 'java:DerbyDS'
16:06:44,368 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
16:06:51,478 INFO [TomcatDeployer] deploy, ctxPath=/finca27, warUrl=.../tmp/deploy/tmp7144888728528577183finca27-exp.war/
16:06:52,337 INFO [STDOUT] osgi> 16:06:54,118 INFO [STDOUT] Persistence bundle starting...
16:06:54,118 INFO [STDOUT] Persistence bundle started.
16:06:54,228 INFO [STDOUT] ProviderTracker: New service detected...
16:06:54,228 INFO [STDOUT] ProviderTracker: Added service org.eclipse.persistence.jpa.osgi.PersistenceProviderOSGi
16:06:54,759 ERROR [STDERR] 20.05.2009 16:06:54 org.eclipse.equinox.log.LogEntry
INFO: FrameworkEvent INFO
16:06:54,759 ERROR [STDERR] 20.05.2009 16:06:54 org.eclipse.equinox.log.LogEntry
INFO: ServiceEvent REGISTERED
16:06:54,759 ERROR [STDERR] 20.05.2009 16:06:54 org.eclipse.equinox.log.LogEntry
INFO: ServiceEvent REGISTERED
16:06:54,759 ERROR [STDERR] 20.05.2009 16:06:54 org.eclipse.equinox.log.LogEntry
INFO: ServiceEvent REGISTERED
16:06:54,759 ERROR [STDERR] 20.05.2009 16:06:54 org.eclipse.equinox.log.LogEntry
INFO: ServiceEvent REGISTERED
16:06:54,759 ERROR [STDERR] 20.05.2009 16:06:54 org.eclipse.equinox.log.LogEntry
INFO: BundleEvent STARTED
16:06:54,759 ERROR [STDERR] 20.05.2009 16:06:54 org.eclipse.equinox.log.LogEntry
INFO: FrameworkEvent INFO
16:06:54,774 ERROR [STDERR] 20.05.2009 16:06:54 org.eclipse.equinox.log.LogEntry
INFO: Setting JPA property javax.persistence.transactionType to RESOURCE_LOCAL
16:06:54,774 ERROR [STDERR] 20.05.2009 16:06:54 org.eclipse.equinox.log.LogEntry
INFO: Setting JPA property eclipselink.target-server to None
16:06:55,009 ERROR [STDERR] 20.05.2009 16:06:54 org.eclipse.equinox.log.LogEntry
INFO: ServiceEvent REGISTERED
16:06:55,743 INFO [STDOUT] [EL Info]: 2009.05.20 16:06:55.509--ServerSession(15634609)--EclipseLink, version: Eclipse Persistence Services - 1.0.2 (Build 20081024)
16:06:55,759 INFO [STDOUT] Exception caught: Exception [EclipseLink-4021] (Eclipse Persistence Services - 1.0.2 (Build 20081024)): org.eclipse.persistence.exceptions.DatabaseException
Exception Description: Unable to acquire a connection from driver [null], user [null] and URL [null]. Verify that you have set the expected driver class and URL. Check your login, persistence.xml or sessions.xml resource. The jdbc.driver property should be set to a class that is compatible with your database platform
16:06:55,759 ERROR [STDERR] 20.05.2009 16:06:55 org.eclipse.equinox.log.LogEntry
SCHWERWIEGEND: Error while activating DefaultEventFromDatabaseService
Local Exception Stack: Exception [EclipseLink-4021] (Eclipse Persistence Services - 1.0.2 (Build 20081024)): org.eclipse.persistence.exceptions.DatabaseException
Exception Description: Unable to acquire a connection from driver [null], user [null] and URL [null]. Verify that you have set the expected driver class and URL. Check your login, persistence.xml or sessions.xml resource. The jdbc.driver property should be set to a class that is compatible with your database platform
at org.eclipse.persistence.exceptions.DatabaseException.unableToAcquireConnectionFromDriverException(DatabaseException.java:365) at org.eclipse.persistence.sessions.DefaultConnector.connect(DefaultConnector.java:90) at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:164) at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:570) at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:209) at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:246) at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:69) at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:118) at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:112) at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:100) at de.cenit.eb.sm.finca.functional.dblayer.events.internal.JpaUtils.createEntityManager(Unknown Source)
at de.cenit.eb.sm.finca.functional.dblayer.events.internal.JpaUtils.create(Unknown Source)
at de.cenit.eb.sm.finca.functional.dblayer.events.internal.DefaultEventFromDatabaseService.activate(Unknown Source)
at de.cenit.eb.sm.finca.functional.dblayer.events.internal.OsgiEventFromDatabaseService.activate(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.ds.instance.InvokeMethod.invokeMethod(InvokeMethod.java:144) at org.eclipse.equinox.ds.instance.InvokeMethod.activateComponent(InvokeMethod.java:60) at org.eclipse.equinox.ds.instance.BuildDispose.activate(BuildDispose.java:672) at org.eclipse.equinox.ds.instance.BuildDispose.buildComponentConfigInstance(BuildDispose.java:122) at org.eclipse.equinox.ds.instance.InstanceProcess.registerComponentConfigurations(InstanceProcess.java:145) at org.eclipse.equinox.ds.resolver.Resolver.dispatchWork(Resolver.java:701)
at org.eclipse.equinox.ds.workqueue.WorkQueue$Queued.dispatch(WorkQueue.java:57) at org.eclipse.equinox.ds.workqueue.WorkQueue.run(WorkQueue.java:108)
16:06:55,759 ERROR [STDERR] Local Exception Stack: Exception [EclipseLink-4021] (Eclipse Persistence Services - 1.0.2 (Build 20081024)): org.eclipse.persistence.exceptions.DatabaseException
Exception Description: Unable to acquire a connection from driver [null], user [null] and URL [null]. Verify that you have set the expected driver class and URL. Check your login, persistence.xml or sessions.xml resource. The jdbc.driver property should be set to a class that is compatible with your database platform
at org.eclipse.persistence.exceptions.DatabaseException.unableToAcquireConnectionFromDriverException(DatabaseException.java:365) at org.eclipse.persistence.sessions.DefaultConnector.connect(DefaultConnector.java:90) at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:164) at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:570) at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:209) at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:246) at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:69) at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:118) at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:112) at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:100) at de.cenit.eb.sm.finca.functional.dblayer.events.internal.JpaUtils.createEntityManager(Unknown Source)
at de.cenit.eb.sm.finca.functional.dblayer.events.internal.JpaUtils.create(Unknown Source)
at de.cenit.eb.sm.finca.functional.dblayer.events.internal.DefaultEventFromDatabaseService.activate(Unknown Source)
at de.cenit.eb.sm.finca.functional.dblayer.events.internal.OsgiEventFromDatabaseService.activate(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.ds.instance.InvokeMethod.invokeMethod(InvokeMethod.java:144) at org.eclipse.equinox.ds.instance.InvokeMethod.activateComponent(InvokeMethod.java:60) at org.eclipse.equinox.ds.instance.BuildDispose.activate(BuildDispose.java:672) at org.eclipse.equinox.ds.instance.BuildDispose.buildComponentConfigInstance(BuildDispose.java:122) at org.eclipse.equinox.ds.instance.InstanceProcess.registerComponentConfigurations(InstanceProcess.java:145) at org.eclipse.equinox.ds.resolver.Resolver.dispatchWork(Resolver.java:701)
at org.eclipse.equinox.ds.workqueue.WorkQueue$Queued.dispatch(WorkQueue.java:57) at org.eclipse.equinox.ds.workqueue.WorkQueue.run(WorkQueue.java:108)
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4233189#4233189
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4233189
16 years, 11 months
[Persistence, JBoss/CMP, Hibernate, Database] - Is it possible to use Hibernate persistent classes from EJB
by dimar1975
Hi all,
I have an Enterprise application made up of a :
-WAR archive
-HAR archive (Hibernate persistent classes)
now I'm going to add an EJB JAR (A Session Bean). I'm trying to use Hibernate persistent classes from the EJB however I've found some problems:
@Stateless
| public class ManagerBean implements ManagerLocal {
|
| @PersistenceUnit(unitName="unit1") SessionFactory factory;
|
| public void executeQuery() {
|
| // Factory is correctly injected here
| System.out.println("Factory is "+factory);
|
| // TransactionException
| // hsession.beginTransaction();
|
| Session hsession = factory.openSession();
|
| List <Data> result = hsession.createQuery("from com.igv.Data").list();
|
| .....
| }
The first problem I've met is that I cannot start a Transaction using Hibernate otherwise JBoss issues "javax.ejb.EJBException: org.hibernate.TransactionException: Could not register synchronization for container transaction".
This is I guess because the EJB is container managed transaction so I cannot use an external transaction manager. Ok.
Commenting that line however leads to another problem:
08:55:27,982 WARN [QuerySplitter] no persistent classes found for query class: from com.igv.Data
So my question is: can you actually use Hibernate persistent classes from an EJB or do you need to port Hibernate classes to Entity Beans ?
Thanks
Marco
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4233177#4233177
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4233177
16 years, 11 months
[JBoss Portal] - JBoss Portal embedded jackrabbit content repository.
by kiksamerik1
Hi,
I am looking for a way to remotely access the JBoss Portal embedded jackrabbit repository.
I am going the EJB3 programming model way and what I am able to do now is to get an instance of the JCRCMS in my stateless session bean
@Resource(mappedName = "java:/portal/CMS")
private JCRCMS jcrCms;
And so I can do a lot of cool stuff.
As a saw how Day CRX, JCR-Explorer, JCR Viewer, JCR Controller, can explore jackrabbit repositories, I am wondering if it is possible to do so with the JBoss portal one.
I tried with the apache jcr-explorer web app running on tomcat but i had a problem with jndi name.
I also tried with the JCR BROWSER eclipse plugin (rmi access). No way!
So I took a look at
jboss-portal-2.7.2\server\default\deploy\jboss-portal.sar\portal-cms.sar\META-INF\jboss-service.xml
and realized that the unlike the JCRCMS, the jackrabbit JCR itself isn't bound to JNDI name nor has a JRMP server association.
Is it why i can't access the JCR with the tools i mentionned?
As for the JCRCMS, a remote proxy can be provided by adding
<!-- Proxy factory for CMS -->
<!-- Use the standard JRMPInvoker from conf/jboss-service.xxml -->
<depends optional-attribute-name="InvokerName">jboss:service=invoker,type=jrmp
<!-- The target MBean -->
<depends optional-attribute-name="TargetName">portal:service=CMS
<!-- Where to bind the proxy factory -->
RemoteCMS
<!-- Invoke target method instead of invoke(Invocation mi) -->
true
<!-- Comma-separated list of exported interfaces -->
org.jboss.portal.cms.CMS
<!-- client-side interceptors -->
org.jboss.proxy.ClientMethodInterceptor
org.jboss.proxy.SecurityInterceptor
org.jboss.jmx.connector.invoker.client.InvokerAdaptorClientInterceptor
org.jboss.invocation.InvokerInterceptor
(according to sohil.shah(a)jboss.com tested and works fine)
Can we get the JBoss Portal embedded Jackrabbit JCR to the same level of exposure?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4233174#4233174
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4233174
16 years, 11 months