[JBoss Portal] - Re: Servlet calling java:portal/UserModule
by Antoine_h
bad idea....
(by the way, just a question : if you encounter a problem with the database, will you try to directly read the db file and decrypt it to get your info ?... just joking to try make you relax a little... and not go further in what I think is a wrong direction)
well, what I would recommend is :
- use the clean way : with the getPrincipal() from the servlet request
- but for this, I guess you have to read some doc about all this... to understand what's going on in the security process, and how to use it in your servlet.
you will make a real stable code and application,... and learn a lot about all this... for the next needs...
a few things to read that will be helpfull (if you have not read it yet... ;-) :
- the jsr-168 doc : look for the things about portlets and servlets "relation". (search for servlet word in the doc). this is really worthwhile.
- the portal documentation about login, security, the use of JAAS and Tomcat
- search the servelt api for things about the getPrincipal() method, on the servlet request.
***************************
by the way, in your servlet, the getPrincipal() will return you a java principal, that is the one of the user logged in the portlet... only if the servlet is registered under the same tomcat security domains than the portlet.
I mean : the serlet can tell you if the portal user is logged, only if it is registered under the same security domain, with the portal.
Did you check this ?
about this : read about Tomcat and JAAS authentication process.
and look at how this is defined in the web.xml that define the portal main servlet.
basicaly, you may copy the configuration of the the portal main servlet, into the war of your servlet.
the file to look at are :
...\deploy\jboss-portal.sar\portal-server.war\WEB-INF\jboss-web.xml
...\deploy\jboss-portal.sar\portal-server.war\WEB-INF\web.xml
...\deploy\jboss-portal.sar\conf\login-config.xml (but this one should not be usefull...)
hope it helps...
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4138397#4138397
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4138397
18 years, 1 month
[JBoss Tools (users)] - file extension .jsf ? instead of .jsp and .xhtml
by Antoine_h
Hi,
I have seen nothing about that in any doc, tuto, etc...
**************************************
Philosophical question : why the JSF files have the .jsp extension ?
or the .xhtml ?
they are not xhtml
they are not anymore jsp
in all the tutorials or doc I have seen, for configuring jsf on jboss, all the config samples leads you to : "you put .jsp... and you'll run with jsp"
and idem with xhtml.
well, I wonder why ?
I would like to have JSF file with .jsf extension...
or know the reason behing this amazing thing...
*********************************
Practical question : Config of JBoss Tools to set .jsf extension for the JSF files ?
I have configured my JBoss Tools and JBoss Portal 2.6.4 with JSF, RichFaces... to use jsf files.
works nice.
but in JBoss Tools :
- the jsf files are recognized for global editor features : without the toolTips, the code completion, the drag and drop of new components...
- I have found nothing to define the extention of the jsf files
=> is there a way to configure JBoss Tools to have the JSF files with .jsf extension ? and so JBoss Tools runs with full features...
even if someone knows how to do that cleanly by changing things directly in the xml descriptor files of the pluggin...
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4138396#4138396
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4138396
18 years, 1 month
[EJB/JBoss] - rollbacked transaction exception
by kedzol
Hi everyone!
I have a serious problem with my code, and I don't know how to solve it.
The following codefragments search the Clients and the Client's addresses and sets transient fields with localized values. The localized (language versions) values are stored in the Reference entity. Varref is a sessionbean for Reference.
Code in StartPage.java backingbean:
| List<Client> cList = turulSessionBean.searchLocalizedClient(new String("TARSASHAZ KAZAN"), TurulLanguage.HUNGARIAN);
|
| List<ClientAddress> addrList = turulSessionBean.localizeClientAddressByClientId(cList.get(0).getClientId(), TurulLanguage.HUNGARIAN);
| for(ClientAddress addr : addrList)
| System.out.println("address localized: " + addr.getLocalCountry() + ", " + addr.getLocalTown());
|
Code in TurulSessionBean for client localization:
| public List<Client> searchLocalizedClient(String name, long language)
| {
| List<Client> clientList = em.createNamedQuery("Client.findByName").setParameter("name", name).getResultList();
| System.out.println("cList size: " + clientList.size());
| if( ! clientList.isEmpty() )
| localizeClients(clientList, language);
|
| return clientList;
| }
|
|
|
| private List<Client> localizeClients(List<Client> clientList, long language)
| {
| for(Client client : clientList)
| localizeClient(client, language);
|
| return clientList;
| }
|
| private void localizeClient(Client client, long language)
| {
| Reference ref;
|
| /* localize clientclass */
| ref = varref.getReference(TurulReference.CLIENT_CLASS, client.getClientClass(), language);
| client.setLocalClientClass(ref.getName());
|
| /* localize payingqualification */
| ref = varref.getReference(TurulReference.PAYING_QUALITY_DESIGNATIONS, client.getPayingQualification(), language);
| client.setLocalPayingQualification(ref.getName());
|
| /* localize usidtype */
| if(client.getClientClass().longValue() == 1)
| ref = varref.getReference(TurulReference.PERSONAL_ID_TYPE, client.getUsidType(), language);
| else
| ref = varref.getReference(TurulReference.ENTERPRISE_ID_TYPE, client.getUsidType(), language);
| client.setLocalUsidType(ref.getName());
|
| /* localize repidtype */
| ref = varref.getReference(TurulReference.PERSONAL_ID_TYPE, client.getRepidType(), language);
| client.setLocalRepidType(ref.getName());
|
| /* localize clienttype */
| ref = varref.getReference(TurulReference.CLIENT_TYPE, client.getClientType(), language);
| client.setLocalClientType(ref.getName());
| }
|
Code in TurulSessionBean for clientaddress localization:
| public List<ClientAddress> localizeClientAddressByClientId(Long clientId, long language) {
| List<ClientAddress> addrList = em.createNamedQuery("ClientAddress.findByClientId").setParameter("clientId", clientId).getResultList();
| if( !addrList.isEmpty() )
| localizeClientAddresses(addrList, language);
|
| return addrList;
| }
|
| private void localizeClientAddresses(List<ClientAddress> addrList, long language)
| {
| for(ClientAddress address : addrList)
| localizeClientAddress(address, language);
| }
|
| private void localizeClientAddress(ClientAddress address, long language)
| {
| Reference ref;
|
| /* localize locationtype */
| ref = varref.getReference(TurulReference.CONTACT_LOCATION_TYPE, address.getLocationType(), language);
| address.setLocalLocationType(ref.getName());
| System.out.println("locationtype: " + address.getLocalLocationType());
| System.out.println("----------- 1");
|
| /* localize addresstype */
| ref = varref.getReference(TurulReference.ADDRESS_TYPES, address.getAddressType(), language);
| System.out.println("----------- 2");
| address.setLocalAddressType(ref.getName());
| System.out.println("addresstype: " + address.getLocalAddressType());
| System.out.println("----------- 3");
|
| /* localize country */
| if( address.getAddrId() != null )
| {
| ref = varref.getReference(TurulReference.COUNTRIES, address.getAddrId().getCountry(), language);
| address.setLocalCountry(ref.getName());
| }
| else if ( address.getCountry() != null )
| {
| ref = varref.getReference(TurulReference.COUNTRIES, address.getCountry(), language);
| address.setLocalCountry(ref.getName());
| }
| System.out.println("country: " + address.getLocalCountry());
| System.out.println("----------- 4");
|
| /* localize county */
| if ( address.getCounty() != null )
| {
| ref = varref.getReference(TurulReference.COUNTIES, address.getCounty(), language);
| address.setLocalCounty(ref.getName());
| }
| System.out.println("----------- 5");
|
| /* localize town */
| if( address.getAddrId() != null )
| {
| ref = varref.getReference(TurulReference.TOWNS, address.getAddrId().getTown(), language);
| address.setLocalTown(ref.getName());
| }
| else if ( address.getTown() != null )
| {
| System.out.println("----------- 6");
|
The exception is thrown at this point.
| ref = varref.getReference(TurulReference.TOWNS, address.getTown(), language);
| System.out.println("----------- 7" + ref.getName());
| address.setLocalTown(ref.getName());
| System.out.println("town: " + address.getLocalTown());
| }
| System.out.println("----------- 8");
|
| /* localize placetype */
| if( address.getPlaceType() != null )
| {
| ref = varref.getReference(TurulReference.ADDRESS_LOCATION_TYPES, address.getPlaceType(), language);
| System.out.println("----------- 9");
| address.setLocalPlaceType(ref.getName());
| }
| }
Here you can see the log:
16:14:30,484 INFO [STDOUT] >>>>>>>>>>>>>>>>>>>>>>>lokalization starts
16:14:30,687 INFO [STDOUT] cList size: 2
16:14:30,703 WARN [loggerI18N] [com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.multipleWarning] [com.arjuna.ats.internal.jta.transacti
on.arjunacore.lastResource.multipleWarning] Multiple last resources have been added to the current transaction. This is transactionally unsafe and shoul
d not be relied upon. Current resource is org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource@14fa4a2
16:14:30,843 INFO [STDOUT] clientList.0: 117790, TARSASHAZ, SZELSOSEGESEN ROSSZ
16:14:30,843 INFO [STDOUT] >>> ADDRESSES:
16:14:30,875 WARN [loggerI18N] [com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.multipleWarning] [com.arjuna.ats.internal.jta.transacti
on.arjunacore.lastResource.multipleWarning] Multiple last resources have been added to the current transaction. This is transactionally unsafe and shoul
d not be relied upon. Current resource is org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource@14fa4a2
16:14:30,890 INFO [STDOUT] locationtype: SZEKHELY
16:14:30,890 INFO [STDOUT] ----------- 1
16:14:30,906 INFO [STDOUT] ----------- 2
16:14:30,906 INFO [STDOUT] addresstype: SZABADSZOVEGES CIM
16:14:30,906 INFO [STDOUT] ----------- 3
16:14:30,921 INFO [STDOUT] country: MAGYARORSZAG
16:14:30,921 INFO [STDOUT] ----------- 4
16:14:30,937 INFO [STDOUT] ----------- 5
16:14:30,945 INFO [STDOUT] ----------- 6
16:14:30,953 ERROR [TxPolicy] javax.ejb.EJBTransactionRolledbackException
16:14:31,000 INFO [STDOUT] StartPage: client find error:javax.ejb.EJBTransactionRolledbackException
I put printlines to trace the error and to follow up the state of the progress.
It seems - for me - that both transactions run well, but the second one calls a rollback at "6" and I don't know why.
Any suggestion could help.
Please let me know if you need further information.
Thanx Zoli
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4138386#4138386
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4138386
18 years, 1 month
[Messaging, JMS & JBossMQ] - Re: Logging level for
by svadu
Hi Adrian,
Thanks for replying again. I am not really interested in messages from DLQHandler, but because of the null id it dumps complete message content in the the log which makes it grow at extreme rates.
I've got a workaround with using JBoss DLQ and null id's by manually resending messages that have to be rolled back to the queue which forces Tibco EMS to assign proper id's (it's just some specifics of importing messages from TIB/RV). It has kind of 'maxResend + 1' effect.
So, after the message is resent and get's ID I would expect that DLQ handler to actually do it's job and it seems to be doing so...
But in my case DLQHandler 'spits' content of JMS messages into the server.log even if there is no rollback (with my current data load the log files reach 10+Gb in a few days). I had to put logging level to FATAL to avoid it but I may miss actually a lot of needed data in the log when the actual rollback happens.
Should I create a JIRA issue for that?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4138377#4138377
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4138377
18 years, 1 month