[JBoss ESB Development] - Exception handling between actions and ftp-listener
by Phillip Schulte
Phillip Schulte [http://community.jboss.org/people/phillip.schulte] created the discussion
"Exception handling between actions and ftp-listener"
To view the discussion, visit: http://community.jboss.org/message/564097#564097
--------------------------------------------------------------
Hello.
Thats one service in my jboss-esb.xml
<service category="de.eskalon.kn.garuda.invoice.HistoricalExchangeRates" name="HistoricalExchangeRateImporter" description="Imports historical exchange rates from ftp directory files" invmScope="GLOBAL">
<service category="de.eskalon.kn.garuda.invoice.HistoricalExchangeRates" name="HistoricalExchangeRateImporter" description="Imports historical exchange rates from ftp directory files" invmScope="GLOBAL">
<listeners>
<ftp-listener busidref="currency-ftp-in" is-gateway="true" maxThreads="2" name="ftp-listener-gateway" scheduleidref="everyminute" />
</listeners>
<actions mep="OneWay">
<action name="transform" class="org.jboss.soa.esb.actions.converters.ByteArrayToString">
<property name="encoding" value="UTF-8" />
</action>
<action name="properties" class="de.eskalon.kn.garuda.esb.GetPropertiesFromMessage"> </action>
<action class="org.jboss.soa.esb.actions.EJBProcessor" name="callPersist">
<property name="ejb3" value="true" />
<property name="jndi-name" value="garuda-invoicing/HistoricalExchangeRatesManagerBean/remote" />
<property name="initial-context-factory" value="org.jnp.interfaces.NamingContextFactory" />
<property name="provider-url" value="localhost:1099" />
<property name="method" value="persistRate" />
<property name="ejb-params">
<arg0 type="java.lang.String">FILE_NAME</arg0>
<arg1 type="java.lang.String">org.jboss.soa.esb.message.defaultEntry</arg1>
</property>
</action>
</actions>
</service>
<listeners>
And here my ftp-provider
<ftp-provider hostname="${currency.ftp.host}" name="currency-provider">
<ftp-bus busid="currency-ftp-in">
<ftp-message-filter directory="${currency.ftp.directory}" error-delete="false" error-suffix=".HAS_ERROR"
input-suffix=".csv"
passive="true" password="${currency.ftp.password}" post-delete="false" post-rename="true"
post-suffix=".COMPLETE" username="${currency.ftp.username}" work-suffix=".garudaWorking" />
</ftp-bus>
</ftp-provider>
So its possible tthat something goes wrong in my persistRate method. But in any case the ftp-listener will rename the file to <filename>.COMPLETE independently of throwing an exception in my method. So my question is how do I handle this correctly. What I want to have is, if anything goes wrong rename the file to <filename>.HAS_ERROR
Best regards
Phillip
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/564097#564097]
Start a new discussion in JBoss ESB Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 1 month
[JBoss Messaging Development] - Failed to write property - java.lang.NullPointerException - infinity messages
by Alexei J
Alexei J [http://community.jboss.org/people/a_subscriber] created the discussion
"Failed to write property - java.lang.NullPointerException - infinity messages"
To view the discussion, visit: http://community.jboss.org/message/565750#565750
--------------------------------------------------------------
JBoss AS 5.1 - success started
I have a simple jms application
private void run(String customerName) throws Exception {
try {
Context initial = new InitialContext();
ConnectionFactory cf = (ConnectionFactory) initial.lookup("/ConnectionFactory");
Destination notifyTopic = (Destination) initial.lookup("topic/testTopic");
Destination requestTopic = (Destination) initial.lookup("topic/testDurableTopic");
logger.trace("Creating Connection...");
connection = cf.createConnection();
connection.setClientID(customerName);
logger.trace("Creating Session...");
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
logger.trace("Creating MessageProducer to send messages to the specified destination. ...");
producer = session.createProducer(requestTopic);
logger.trace("Creating a MessageConsumer for the specified destination. ...");
consumer = session.createConsumer(notifyTopic);
logger.trace("Starts (or restarts) a connection's delivery of incoming messages...");
connection.start();
for (;;) {
listen(customerName);
}
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
} finally {
if (connection != null)
connection.close();
}
}
jndi.properties file:
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.provider.url=jnp://localhost:1099
I create jar and deploy it to the %JBOSS_HOME%/server/default/messaging/myapplication/customers/Xavier/
run application on the jboss:
java -cp myproject.jar;%JBOSS_HOME%/client/jbossall-client.jar com.mycompany.myproject.Customer Xavier
and I get infinity the next messages:
[11 ieo 2010 12:03:00.963] com.mycompany.myproject.Customer.main(Customer.java:123) TRACE:
Start customer
[11 ieo 2010 12:03:01.041] org.jboss.logging.Logger.debug(Logger.java:228) DEBUG:
createSocket, hostAddr: localhost/127.0.0.1, port: 1099, localAddr: null, localPort: 0, timeout: 0
[11 ieo 2010 12:03:01.713] org.jboss.logging.Logger.trace(Logger.java:160) TRACE:
org.jboss.aop.classpool.AOPClassPool@1389188011 [class path: sun.misc.Launcher$AppClassLoader@3326b249;] - dcl:sun.misc.Launcher$AppClassLoader@3326b249 creating pool for loader sun.misc.Launcher$AppClassLoader@3326b249 searchStrategy:org.jboss.aop.classpool.AOPClassPool$SearchAllRegisteredLoadersSearchStrategy@26302a05 isTemp:false
[11 ieo 2010 12:03:01.776] com.mycompany.myproject.Customer.run(Customer.java:69) TRACE:
Creating Connection...
[11 ieo 2010 12:03:01.807] org.jboss.logging.Logger.debug(Logger.java:228) DEBUG:
Remoting version: 2.5.3.SP1 (Flounder)
[11 ieo 2010 12:03:01.822] org.jboss.logging.Logger.debug(Logger.java:228) DEBUG:
Client[1699270891:5c4o56o-d5cpbk-gf547yym-1-gf547yym-2].connect(null)
[11 ieo 2010 12:03:01.822] org.jboss.logging.Logger.trace(Logger.java:160) TRACE:
Client[1699270891:5c4o56o-d5cpbk-gf547yym-1-gf547yym-2]: metadata = null
[11 ieo 2010 12:03:01.885] org.jboss.logging.Logger.trace(Logger.java:160) TRACE:
Mapping properties for bean: SocketClientInvoker[2afa14cb, bisocket://127.0.0.1:4457]
[11 ieo 2010 12:03:01.885] org.jboss.logging.Logger.trace(Logger.java:160) TRACE:
Property editor found for: marshaller, editor: java.beans.PropertyDescriptor@40f7af00, setter: public void org.jboss.remoting.MicroRemoteClientInvoker.setMarshaller(org.jboss.remoting.marshal.Marshaller)
[11 ieo 2010 12:03:01.901] org.jboss.logging.Logger.trace(Logger.java:160) TRACE:
Failed to find property editor for: marshaller
[11 ieo 2010 12:03:01.901] org.jboss.logging.Logger.trace(Logger.java:171) TRACE:
Failed to write property
java.lang.NullPointerException
at org.jboss.util.propertyeditor.PropertyEditors.mapJavaBeanProperties(PropertyEditors.java:377)
at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.mapJavaBeanProperties(MicroSocketClientInvoker.java:1359)
at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.setup(MicroSocketClientInvoker.java:533)
at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.<init>(MicroSocketClientInvoker.java:292)
at org.jboss.remoting.transport.socket.SocketClientInvoker.<init>(SocketClientInvoker.java:78)
at org.jboss.remoting.transport.bisocket.BisocketClientInvoker.<init>(BisocketClientInvoker.java:166)
at org.jboss.remoting.transport.bisocket.TransportClientFactory.createClientInvoker(TransportClientFactory.java:44)
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:597)
at org.jboss.remoting.InvokerRegistry.loadClientInvoker(InvokerRegistry.java:460)
at org.jboss.remoting.InvokerRegistry.createClientInvoker(InvokerRegistry.java:359)
at org.jboss.remoting.Client$6.run(Client.java:724)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.remoting.Client.connect(Client.java:720)
at org.jboss.remoting.Client.connect(Client.java:668)
at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.createClient(ClientConnectionFactoryDelegate.java:343)
at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.org$jboss$jms$client$delegate$ClientConnectionFactoryDelegate$getClientAOPStack$aop(ClientConnectionFactoryDelegate.java:246)
at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.getClientAOPStack(ClientConnectionFactoryDelegate.java)
at org.jboss.jms.client.ClientAOPStackLoader.load(ClientAOPStackLoader.java:75)
at org.jboss.jms.client.JBossConnectionFactory.createConnectionInternal(JBossConnectionFactory.java:192)
at org.jboss.jms.client.JBossConnectionFactory.createConnection(JBossConnectionFactory.java:87)
at org.jboss.jms.client.JBossConnectionFactory.createConnection(JBossConnectionFactory.java:82)
at com.mycompany.myproject.Customer.run(Customer.java:70)
at com.mycompany.myproject.Customer.main(Customer.java:127)
[11 ieo 2010 12:03:01.901] org.jboss.logging.Logger.trace(Logger.java:160) TRACE:
Property editor found for: timeout, editor: java.beans.PropertyDescriptor@5f20829f, setter: null
[11 ieo 2010 12:03:01.901] org.jboss.logging.Logger.debug(Logger.java:228) DEBUG:
SocketClientInvoker[2afa14cb, bisocket://127.0.0.1:4457] setting client socket wrapper class name to org.jboss.jms.client.remoting.ClientSocketWrapper
[11 ieo 2010 12:03:01.901] org.jboss.logging.Logger.debug(Logger.java:228) DEBUG:
SocketClientInvoker[2afa14cb, bisocket://127.0.0.1:4457] setting shouldCheckConnection to false
[11 ieo 2010 12:03:01.901] org.jboss.logging.Logger.debug(Logger.java:228) DEBUG:
SocketClientInvoker[2afa14cb, bisocket://127.0.0.1:4457] setting timeout to 300000
[11 ieo 2010 12:03:01.901] org.jboss.logging.Logger.debug(Logger.java:228) DEBUG:
SocketClientInvoker[2afa14cb, bisocket://127.0.0.1:4457] constructed
[11 ieo 2010 12:03:01.916] org.jboss.logging.Logger.debug(Logger.java:228) DEBUG:
SocketClientInvoker[2afa14cb, bisocket://127.0.0.1:4457] setting client socket wrapper class name to org.jboss.jms.client.remoting.ClientSocketWrapper
[11 ieo 2010 12:03:01.916] org.jboss.logging.Logger.debug(Logger.java:228) DEBUG:
SocketClientInvoker[2afa14cb, bisocket://127.0.0.1:4457] setting shouldCheckConnection to false
[11 ieo 2010 12:03:01.916] org.jboss.logging.Logger.debug(Logger.java:228) DEBUG:
SocketClientInvoker[2afa14cb, bisocket://127.0.0.1:4457] setting timeout to 300000
[11 ieo 2010 12:03:01.916] org.jboss.logging.Logger.debug(Logger.java:228) DEBUG:
SocketClientInvoker[2afa14cb, bisocket://127.0.0.1:4457] connecting
[11 ieo 2010 12:03:01.916] org.jboss.logging.Logger.debug(Logger.java:228) DEBUG:
Creating semaphore with size 50
[11 ieo 2010 12:03:01.932] org.jboss.logging.Logger.trace(Logger.java:160) TRACE:
SocketClientInvoker[2afa14cb, bisocket://127.0.0.1:4457] added new pool ([]) as ServerAddress[127.0.0.1:4457, NO enableTcpNoDelay timeout 300000 ms, maxPoolSize=50]
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/565750#565750]
Start a new discussion in JBoss Messaging Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 2 months
[JBoss Transactions Development] - org.jboss.messaging.core.impl.tx.TransactionException: Cannot find entry forxid:MessagingXid
by prahlad reddy
prahlad reddy [http://community.jboss.org/people/prahlads] created the discussion
"org.jboss.messaging.core.impl.tx.TransactionException: Cannot find entry forxid:MessagingXid"
To view the discussion, visit: http://community.jboss.org/message/579465#579465
--------------------------------------------------------------
In production server we have encountered this exception, Needmore information
Exception Stack Trace ::
[2010-07-21 06:02:10,139] [ERROR][org.jboss.messaging.util.ExceptionUtil]ConnectionEndpoint[au-s6wk5vbg-1-3add5vbg-sqfpjn-v10t2a] sendTransaction[v8f-zi7d
nvbg-1-3add5vbg-sqfpjn-v10t2a]
org.jboss.messaging.core.impl.tx.TransactionException: Cannot find entry forxid:MessagingXid (36214490bq:97.54.53.48.48.52.51.58.101.98.49.53.58.52.99.52.5
3.102.98.50.102.58.97.50.57.99.57 formatID:131075gtxid:103.98.115.108.105.118.101.49.45.97.54.53.48.48.52.51.58.101.98.49.53.58.52.99.52.53.102.98.50.102.58
.97.50.56.48.48
atorg.jboss.messaging.core.impl.tx.TransactionRepository.getPreparedTx(TransactionRepository.java:223)
atorg.jboss.jms.server.endpoint.ServerConnectionEndpoint.sendTransaction(ServerConnectionEndpoint.java:526)
atorg.jboss.jms.server.endpoint.advised.ConnectionAdvised.org$jboss$jms$server$endpoint$advised$ConnectionAdvised$sendTransaction$aop(ConnectionAdvi
sed.java:101)
at org.jboss.jms.server.endpoint.advised.ConnectionAdvised$sendTransaction_N3268650789275322226.invokeNext(ConnectionAdvised$sendTransaction_N3268650
789275322226.java)
>From googling I have get the snippet of code for TransactoinRepository.java for Jboss application server
Snippet of code of TransactoinRepository.java from jboss::
public Transaction getPreparedTx(Xid xid) throws Exception
218 {
219 Transaction tx =(Transaction)map.get(xid);
220
221 if (tx == null)
222 {
223 throw newTransactionException("Cannot find entry for xid:" + xid);
224 }
225 if (tx.getState() !=Transaction.STATE_PREPARED)
226 {
227 throw newTransactionException("Transaction with xid " + xid + " is not inprepared state");
228 }
229 return tx;
230 }
Exception happened at 223 line no , my question in above code Transaction object getting from map with xid
Transactiontx = (Transaction)map.get(xid);
Object returned from map as null for the same reason above exception encountered in my case .
What are the possible for occurring this kind of exception, need more information about the exception.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/579465#579465]
Start a new discussion in JBoss Transactions Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 6 months
[JBoss AS7 Development] - Re: Plan for jboss-as-web extension points in AS7
by Jason Greene
Jason Greene [http://community.jboss.org/people/jason.greene%40jboss.com] created the discussion
"Re: Plan for jboss-as-web extension points in AS7"
To view the discussion, visit: http://community.jboss.org/message/585565#585565
--------------------------------------------------------------
Hello Vladimir and Jean,
In addition to avoiding class references, we also have a requirement that the user configuration only reflect user settings (and not our internal wiring like in the past). The configuration is extensible though, so a user can add new "subsystems" to their domain.xml by specifying the extension that adds it.
A subsystem provides its own custom schema for its section (with a goal of being friendly and type safe) and it also maintains a detyped representation which is used for all of the vairous management interfaces. So in a nutshell, anything that integrates with AS7 via a subsystem is fully manageable (and consistent with the configuration).
A subsystem is also responsible for acting upon the management operations (note that configuration when parsed generates the very same management operations) to make the appropriate changes in the runtime state of the server (if not possible it tells the system a restart is in order). This is where you would create new services, launch tasks etc.
So for mobicents I would recommend a subsystem (although you can have more than one if you want) that uses JBossWeb SPIs to launch your SIP server. This should give you essentially the same reuse you had before. It would also make sure the SPIs best represent what you are wanting to achieve. Lastly, it would provide a really nice easy to use configuration that would immediately be available in all of our managment interfaces (java remote protocols, HTTP/JSON protocol, embedded console, JON, etc).
One thing though I should warn you about is that we are currently making the transition to the detyped model (which was done to make life easier for jbosstools and JON and the console), but that work is in a special detyped branch on Brians tree. We hope to migrate it as fast as humanly possible, however you may want to either base your work on that, or to instead wait until we formally merge it upstream. If you go with the latter you could probably initially focus on working with Remy on the JBossWeb SPI contracts that you currently have and need.
Thanks!
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/585565#585565]
Start a new discussion in JBoss AS7 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 7 months
[JMX Development] - Help with MDB getting "Security Context is null" error when accessing the JMX RMI Adaptor
by Alexandre Santoro
Alexandre Santoro [http://community.jboss.org/people/santoro63] created the discussion
"Help with MDB getting "Security Context is null" error when accessing the JMX RMI Adaptor"
To view the discussion, visit: http://community.jboss.org/message/586821#586821
--------------------------------------------------------------
I am at my wit's end and would appreciate some help with this problem. Here's what's happening.
I am running JBoss AS 5.1.0.GA and have created an mdb with an onMessage() method that looks like this:
public void onMessage(Message m) {
processMessage(m);
LOG.info("finished processing " + m");
}
The processMessage method eventually gets the RMIAdaptor from jndi and makes a call to it.
When the code runs, it prints the LOG.info message in the log file suggesting it has finished processing, but after that fails with the following stack trace:
16:56:47,994 ERROR [JmsServerSession] Unexpected error delivering message delegator->JBossMessage[21256369076322305]:PERSISTENT, deliveryId=0
javax.ejb.EJBException: RuntimeException
at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:417)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:209)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
at org.jboss.ejb.MessageDrivenContainer.internalInvoke(MessageDrivenContainer.java:415)
at org.jboss.ejb.Container.invoke(Container.java:1029)
at sun.reflect.GeneratedMethodAccessor376.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:209)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:195)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
at org.jboss.ejb.plugins.inflow.MessageEndpointInterceptor.delivery(MessageEndpointInterceptor.java:249)
at org.jboss.ejb.plugins.inflow.MessageEndpointInterceptor.invoke(MessageEndpointInterceptor.java:128)
at org.jboss.proxy.ClientMethodInterceptor.invoke(ClientMethodInterceptor.java:74)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:101)
at $Proxy293.onMessage(Unknown Source)
at org.jboss.resource.adapter.jms.inflow.JmsServerSession.onMessage(JmsServerSession.java:178)
at org.jboss.jms.client.container.ClientConsumer.callOnMessageStatic(ClientConsumer.java:160)
at org.jboss.jms.client.container.SessionAspect.handleRun(SessionAspect.java:831)
at org.jboss.aop.advice.org.jboss.jms.client.container.SessionAspect_z_handleRun_494204024.invoke(SessionAspect_z_handleRun_494204024.java)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.jms.client.container.ClosedInterceptor.invoke(ClosedInterceptor.java:170)
at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:86)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.jms.client.delegate.ClientSessionDelegate.run(ClientSessionDelegate.java)
at org.jboss.jms.client.JBossSession.run(JBossSession.java:199)
at org.jboss.resource.adapter.jms.inflow.JmsServerSession.run(JmsServerSession.java:234)
at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:205)
at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:260)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.IllegalStateException: Security Context is null
at org.jboss.ejb.plugins.SecurityActions$RunAsIdentityActions$2.pop(SecurityActions.java:143)
at org.jboss.ejb.plugins.SecurityActions.popRunAsIdentity(SecurityActions.java:244)
at org.jboss.ejb.plugins.RunAsSecurityInterceptor.process(RunAsSecurityInterceptor.java:139)
at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:103)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
I have tried setting the unauthenticatedIdentity property in the <application-context name="other"> element, as well as
including the <run-as> element in the ejb-jar.xml descriptor for this bean. No matter what I do I get the same error.
Does anyone what is it that causes this stack trace to happen AFTER the method uses the RMIAdaptor and exits? Am I missing some RMI configuration I am not aware of?
Thanks for your help in advance,
- Alex
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/586821#586821]
Start a new discussion in JMX Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 8 months
[JBoss Web Development] - Authorization issue while implementing login module with DatabaseServerLoginModule
by sidd deo
sidd deo [http://community.jboss.org/people/c-ddhesh] created the discussion
"Authorization issue while implementing login module with DatabaseServerLoginModule"
To view the discussion, visit: http://community.jboss.org/message/586633#586633
--------------------------------------------------------------
Hi all
I am new to jboss. I am trying to implement form based authentication using DatabaseServerLoginModule using jboss (http://www.coderanch.com/forums/f-63/JBoss) 6.0
By referring guides and several tutorials I implemented and configured it. My application is working till authentication phase.
Authorization fails giving following errors in logs. Here are my logs
11:18:53,240 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] Obtained user password
11:18:53,240 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] resumeAnyTransaction
11:18:53,240 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] User'sidd' authenticated, loginOk=true
11:18:53,240 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] commit, loginOk=true
11:18:53,240 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] getRoleSets
using rolesQuery: SELECT Role, RoleGroup FROM Roles WHERE PrincipalID=?,username: sidd
11:18:53,256 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] suspendAnyTransaction
11:18:53,256 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] Excuting query:
SELECT Role, RoleGroup FROM Roles WHERE PrincipalID=?, with username: sidd
11:18:53,256 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] Assign user to role WebAppUser
11:18:53,256 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] resumeAnyTransaction
11:18:53,256 TRACE [org.jboss.security.plugins.auth.JaasSecurityManagerBase.my-web] defaultLogin,
lc=javax.security.auth.login.LoginContext@1b7a59c, subject=Sub
ject(21185284).principals=org.jboss.security.SimplePrincipal(a)15004845(sidd)org.j
boss.security.SimpleGroup@24878804(WebAppUser(members:WebAppUser))
11:18:53,256 TRACE [org.jboss.security.plugins.auth.JaasSecurityManagerBase.my-w
eb] updateCache, inputSubject=Subject(21185284).principals=org.jboss.security.Si
mplePrincipal@15004845(sidd)org.jboss.security.SimpleGroup(a)24878804(WebAppUser(m
embers:WebAppUser)), cacheSubject=Subject(16292112).principals=org.jboss.securit
y.SimplePrincipal@15004845(sidd)org.jboss.security.SimpleGroup(a)24878804(WebAppUs
er(members:WebAppUser))
11:18:53,256 TRACE [org.jboss.security.plugins.auth.JaasSecurityManagerBase.my-w
eb] Inserted cache info: org.jboss.security.plugins.auth.JaasSecurityManagerBase
$DomainInfo(a)10908b5[Subject(16292112).principals=org.jboss.security.SimplePrinci
pal@15004845(sidd)org.jboss.security.SimpleGroup@24878804(WebAppUser(members:Web
AppUser)),credential.class=java.lang.String@13809944,expirationTime=129731868574
1]
11:18:53,256 TRACE [org.jboss.security.plugins.auth.JaasSecurityManagerBase.my-w
eb] End isValid, true
11:18:53,256 TRACE [org.jboss.security.plugins.auth.JaasSecurityManagerBase.my-w
eb] getPrincipal, cache info: org.jboss.security.plugins.auth.JaasSecurityManage
rBase$DomainInfo(a)10908b5[Subject(16292112).principals=org.jboss.security.SimpleP
rincipal@15004845(sidd)org.jboss.security.SimpleGroup(a)24878804(WebAppUser(member
s:WebAppUser)),credential.class=java.lang.String@13809944,expirationTime=1297318
685741]
11:18:53,272 TRACE [org.jboss.security.SecurityRolesAssociation] Setting threadl
ocal:null
11:18:53,272 TRACE [org.jboss.security.SecurityRolesAssociation] Setting threadl
ocal:{}
11:18:53,272 TRACE [org.jboss.security.plugins.authorization.JBossAuthorizationC
ontext] Control flag for entry:org.jboss.security.authorization.config.Authoriza
tionModuleEntry{org.jboss.security.authorization.modules.DelegatingAuthorization
Module:{}REQUIRED}is:[REQUIRED]
11:18:53,287 TRACE [org.jboss.security.SecurityRolesAssociation] Setting threadl
ocal:null
Here is my Databse called book having following structure
CREATE TABLE IF NOT EXISTS Principals (
PrincipalID varchar(30) NOT NULL PRIMARY KEY,
Password varchar(50) NOT NULL
) ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS Roles (
PrincipalID varchar(30) NOT NULL,
INDEX (PrincipalID),
Role varchar(50) NOT NULL,
RoleGroup varchar(50) NULL,
PRIMARY KEY(PrincipalID, Role),
CONSTRAINT Roles_Principal_FK FOREIGN KEY (PrincipalID)
REFERENCES Principals (PrincipalID) ON DELETE CASCADE
) ENGINE=INNODB;
values of "PrincipalID" and "Password" are "sidd" and "pass".
values "PrincipalID" "Role" "RoleGroup" are "sidd" "WebAppUser" "WebAppUser"
My web.xml is as follows
<?xml version="1.0"?>
<web-app>
<description>A test app for security</description>
<security-constraint>
<web-resource-collection>
<web-resource-name>All resources</web-resource-name>
<description>Protects all resources</description>
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>WebAppUser</role-name>
</auth-constraint>
</security-constraint>
<security-role>
<role-name>WebAppUser</role-name>
</security-role>
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/login.html</form-login-page>
<form-error-page>/errors.html</form-error-page>
</form-login-config>
</login-config>
</web-app>
login-config.xml has following entry
<application-policy name="my-web">
<authentication>
<login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule"
flag="required">
<module-option name="dsJndiName">java:/MySqlDS</module-option>
<module-option name="principalsQuery">SELECT Password FROM Principals WHERE PrincipalID=?</module-option>
<module-option name="rolesQuery">SELECT Role, RoleGroup FROM Roles WHERE PrincipalID=?</module-option>
</login-module>
</authentication>
<authorization>
<policy-module code="org.jboss.security.authorization.modules.DelegatingAuthorizationModule" flag="required"/>
</authorization>
</application-policy>
jboss-web.xml has following text
<?xml version='1.0' encoding='UTF-8' ?>
<jboss-web>
<security-domain>java:/jaas/my-web</security-domain>
</jboss-web>
Even if I remove
<authorization>
<policy-module code="org.jboss.security.authorization.modules.DelegatingAuthorizationModule" flag="required"/>
</authorization>
from login-config.xml, I get the same error.
As per the logs, user "sidd" is getting authenticated successfully. But on GUI i see
HTTP Status 403 - Access to the requested resource has been denied
type Status report
message Access to the requested resource has been denied
description Access to the specified resource (Access to the requested resource has been denied) has been forbidden.
Am i missing on any flag or any configuration ?
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/586633#586633]
Start a new discussion in JBoss Web Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 8 months