[Security & JAAS/JBoss] - jdbcRealm - ClassCastException when trying to log in
by mendret
hello, i'm currently migrating a webapp from tomcat 4.x to jboss 5.0.0.GA but if i try to login into the webapp i get the following error:
| java.lang.ClassCastException: org.apache.catalina.realm.GenericPrincipal cannot be cast to org.jboss.web.tomcat.security.JBossGenericPrincipal
| ...
|
i'm using jdbcRealm for the authentication and the context.xml looks like this:
| <Context path="/myApp"
| debug="0"
| privileged="true">
| <Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
| driverName="com.mysql.jdbc.Driver"
| connectionName="jdbc:mysql://localhost:3306/myapp?characterEncoding=utf-8&autoReconnect=true"
| connectionName="test"
| connectionPassword="***"
| userTable="LOGIN" userNameCol="LOGINNAME"
| userCredCol="PASSWORD"
| userRoleTable="ROLES" roleNameCol="PRINCIPAL"
| digest="MD5" />
| </Context>
|
when i login with a wrong name/pw i get to my errorpage so the connection seems to be alright.
has anyone a suggestion what might cause this error?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4212996#4212996
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4212996
17 years, 1 month
[JNDI/Naming/Network] - very slow connection from client to server
by blackwolff
Hi,
why does the client always needs so much time (about 5-10 seconds) to get a connection to the jboss server? Even if I try to connect to the server the second or third time.
The client runs on a Windows-System, the JBoss-Server on a Linux-System.
If I do the same things with JBoss on Windows all works fine.
| public class MyClass {
|
| public Object getSession() throws NamingException {
| Object theObject = MyCache.getInstance().getSessionWithKey(getSessionName());
| if(theObject == null) {
| theObject = getFromJNDI("MyEAR/" + getSessionName" + "/remote");
| MyCache.getInstance().setSessionWithKey(getSessionName(), theObject);
| }
|
| return theObject;
| }
|
| private String getSessionName() {
| return "MySession";
| }
|
| private Object getFromJNDI(String name) throws NamingException {
| Context ctx = null;
| Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
|
| try {
| ctx = getInitialContext();
| if (ctx == null)
| return null;
|
| return ctx.lookup(name);
| } catch (NamingException ne) {
| throw ne;
| }
| finally {
| try {
| ctx.close();
| } catch (NamingException ne1) {}
|
| }
| }
|
| private Context getInitialContext() throws NamingException {
| try {
| Properties properties = new Properties();
| properties.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
| properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
| properties.put(Context.PROVIDER_URL, "jnp://anIpAdress:1099");
|
| return new InitialContext(properties);
| } catch (NamingException namingexception) {
| throw namingexception;
| }
| }
|
| }
|
|
|
| public class MyCache
| {
| private static MyCache inst = null;
| private HashMap sessionCache = new HashMap();
|
| private MyCache() {
| super();
| }
|
| public static MyCache getInstance() {
| if(inst == null)
| inst = new MyCache();
| return inst;
| }
|
| public Object getSessionWithKey(String aName) {
| Object sessionObject = (Object)getSessionCache().get(aName);
| return sessionObject;
| }
|
| public void setSessionWithKey(String aName, Object anObject) {
| getSessionCache().put(aName, anObject);
| }
|
| public void clear() {
| setSessionCache(new HashMap());
| }
|
|
| public HashMap getSessionCache() {
| return sessionCache;
| }
|
|
| public void setSessionCache(HashMap sessionCache) {
| this.sessionCache = sessionCache;
| }
| }
|
|
|
| public interface MySession {
| public Collection doSomething();
| }
|
|
| @Stateless(mappedName = "MySession", name = "MySession")
| @Remote(MySession.class)
| @TransactionAttribute(TransactionAttributeType.REQUIRED)
| public class MySessionBean implements MySession {
|
| @PersistenceContext
| EntityManager em;
|
| public Collection doSomething() {
| return new ArrayList();
| }
|
| }
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4212986#4212986
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4212986
17 years, 1 month
[EJB/JBoss] - MDB with Oracle AQ via Sun Adapter
by ryandavid
I have integrated Oracle AQ with JBoss 4.0.2 using the rar of Sun Adapter. I can send messages to a queue but I have some problems in using an MDB that reads from a queue.
The MDB is BMT because the adapater doesn't support XA connections.
I used this ejb-jar.xml
Code:
<ejb-jar>
| <enterprise-beans>
|
| <message-driven>
| <ejb-name>TestJMSBean</ejb-name>
| <ejb-class>it.senato.testjms.TestJMSBean</ejb-class>
| <messaging-type>javax.jms.MessageListener</messaging-type>
| <transaction-type>Bean</transaction-type>
|
| <activation-config>
| <activation-config-property>
| <activation-config-property-name>destinationType</activation-config-property-name>
| <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
| </activation-config-property>
|
|
| <activation-config-property>
| <activation-config-property-name>destinationProperties</activation-config-property-name>
| <activation-config-property-value>owner=senaprod,name=FROM_QUEUE</activation-config-property-value>
| </activation-config-property>
| <activation-config-property>
| <activation-config-property-name>connectionFactoryProperties</activation-config-property-name>
| <activation-config-property-value>jdbc_connect_string=jdbc:oracle:thin:scott/mypass@myhost:1521:svil,host=senadbmssvil,user=scott,pass
| word=mypass,port=1521,sid=svil,driver=thin</activation-config-property-value>
| </activation-config-property>
|
| <activation-config-property>
| <activation-config-property-name>userName</activation-config-property-name>
| <activation-config-property-value>scott</activation-config-property-value>
| </activation-config-property>
| <activation-config-property>
| <activation-config-property-name>mypass</activation-config-property-name>
| <activation-config-property-value>svil</activation-config-property-value>
| </activation-config-property>
|
| </activation-config>
|
| </message-driven>
|
| </enterprise-beans>
|
| <assembly-descriptor>
| </assembly-descriptor>
|
| </ejb-jar>
|
|
this jboss.xml
Code:
<jboss>
| <enterprise-beans>
|
| <message-driven>
| <ejb-name>TestJMSBean</ejb-name>
|
| <invoker-bindings>
| <invoker>
| <invoker-proxy-binding-name>message-inflow-driven-bean</invoker-proxy-binding-name>
| </invoker>
| </invoker-bindings>
|
| <resource-adapter-name>oracleaq.rar</resource-adapter-name>
|
| </message-driven>
| </enterprise-beans>
| </jboss>
|
and finally this is the onMessage() method
Code:
public void onMessage(Message msg) {
| try {
| ctx.getUserTransaction().begin();
|
| logger.debug("onMessage...");
| // extract message
| TextMessage textMessage = null;
| try {
| textMessage = (TextMessage) msg;
|
| } catch (ClassCastException ce) {
| logger.warn("Received a non TextMessage");
| ctx.getUserTransaction().commit();
| return;
| }
|
| logger.info("Received a text message: " + textMessage.getText());
| msg.acknowledge();
| ctx.getUserTransaction().commit();
|
| } catch (NotSupportedException e) {
| logger.error(e.getMessage(),e);
| } catch (SystemException e) {
| logger.error(e.getMessage(),e);
| } catch (JMSException e) {
| logger.error(e.getMessage(),e);
| } catch (RollbackException e) {
| logger.error(e.getMessage(),e);
| } catch (HeuristicMixedException e) {
| logger.error(e.getMessage(),e);
| } catch (HeuristicRollbackException e) {
| logger.error(e.getMessage(),e);
| }
|
| }
|
When I deploy this MDB, it reads the first message that's in the queue and prints out the text.
The other messages are deleted from the queue but their texts aren't printed out.
In addition the sender send's a message but nothing happens: no message in the queue and no printing out.
It seems as the MDB is locking the queue.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4212985#4212985
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4212985
17 years, 1 month
[JCA/JBoss] - Re: Performance Cost of valid-connection-checker-class-name
by vaerssv
in fact we use a simple "select 1 from dual", this causes few load, but the problem is that our dba's see millions of hits on the db, this generate some load that we wants to limit (by executing this query only every x time for exemple)...
i see in the doc:
check-valid-connection-sql : This is a SQL statement that should be run on a connection before it is returned from the pool to test its validity to test for stale pool connections. An example statement could be: select count(*) from x
maybe i don't understand exactly when the querry will be executed, but i suppose it is for every connection to the db... what i would like to have is to use the check-valid-connection not for every connection, but one every 10 seconds, for exemple, that will validate that the db is still reachable and all connection are considered as ok...
don't know if it makes sense?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4212983#4212983
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4212983
17 years, 1 month
[Beginners Corner] - Help required in drools
by hari.manivannan
I am trying to come up with a commission calculation logic with Drools. I need some help in coming up with the best possible approach.
The commission is calculated based on the location. By location, I mean the city, country and region. Please see the examples below.
Data Setup:
Region,Country, City,CommissionApplicable
============================
Asia,,,10
Asia,Singapore,,20
,India,Chennai,25
(There are tables which maintain the relationships between region -> Country -> City)
Input=Kualalumpur, Output = 10
Input=Chennai, output = 25
Input=Mumbai, Output=10 and so on.
Can you please let me know how my rule file should look like. I went through a lot of examples but the hierarchial resolution is something that I am not able to implement. Please help.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4212972#4212972
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4212972
17 years, 1 month
[JBoss Tools (users)] - Re: WIP: XForms editor based on VPE
by kukeltje
"sdzmitrovich" wrote : It is necessary to use a pair <vpe:drag start-enable="yes" /> and <vpe:drop container="yes" />
|
| The first allows to drag specified element.
| The second allows to drop in specified element.
Yes, I have that and it sometimes works... I get the impression that it does not work if my cursor is over a child element. This should be ok since you are not allowed to drop on that element, still it is not always clear what area is the child and what not. E.g. a not really rendered item like a div (xforms:group -> xhtml:div) leaves no space to drop something. Reordering elements becomes almost impossible then. But using divs with padding and margins works nicer than desiging your form with tables although the latter makes it easier to drag/drop....
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4212970#4212970
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4212970
17 years, 1 month