[JBoss AS 7 Development] - JBoss AS 7.1.1.Final custom login module for remoting and custom principal
by Sebastian Raue
Sebastian Raue [https://community.jboss.org/people/sraue] created the discussion
"JBoss AS 7.1.1.Final custom login module for remoting and custom principal"
To view the discussion, visit: https://community.jboss.org/message/726343#726343
--------------------------------------------------------------
For remoting we have made a custom login module which extends org.jboss.security.auth.spi.AbstractServerLoginModule.
The overwritten method getIdenttity() returns a custom principal - ApplicationPrincipal.
We can access the principal inside our ejbs via
@Resource
public SessionContext sessionContext;
....
Principal principal = sessionContext.getCallerPrincipal();
....
but we get a ClassCastException when we try to cast the returned Principal into ApplicationPrincipal.
On the other hand principal.getClass().getName() returns the expected class name.
The problem is that our login module is deployed as a jboss module (<jboss-home>/modules) - inside a jar which also
contains ApplicationPrincipal. The ear containing our ejb.jar which contains our ejbs also contains a copy of ApplicationPrincipal.
The problem is that our custom login module and the ApplicationPrincipal are loaded by one class loader and our
ejbs and the ApplicationPrincipal copy are loaded by another class loader. The ApplicationPrincipal from the login module which we get
by calling sessionContext.getCallerPrincipal() in the ejb is no ApplicationPrincipal known by the ejbs.
What can we do to solve this problem?
I have tried to put the custom login module code into our ear and adjusted the "module" attribute value of <login-module>
in our standalone.xml to deployment.<app-name>.ear.<ejb-jar-name>.jar but it did not work. Exception on the remote client was:
javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed
As a separate module and the respective <login-module> configuration in standalone.xml the authentication works fine with our login module
- we only have the described ClassCastException problem.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/726343#726343]
Start a new discussion in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 3 months
[JBoss AS 7 Development] - Error while deploying MDB(EJB2.1) in jboss as 7
by Amol Dongare
Amol Dongare [https://community.jboss.org/people/amol.p.dongare] created the discussion
"Error while deploying MDB(EJB2.1) in jboss as 7"
To view the discussion, visit: https://community.jboss.org/message/747697#747697
--------------------------------------------------------------
I am getting following error while deploying MDB in JBOSS7
my ejb-jar.xml
<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC
"-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
" http://java.sun.com/dtd/ejb-jar_2_0.dtd http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<enterprise-beans>
<message-driven>
<ejb-name>MDB</ejb-name>
<ejb-class>com.example.GreetingMessageDriverBean</ejb-class>
<transaction-type>Container</transaction-type>
<message-driven-destination>
<destination-type>javax.jms.Queue</destination-type>
</message-driven-destination>
</message-driven>
</enterprise-beans>
</ejb-jar>
And getting following Exception
4:44:59,884 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled ba
k. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"mdb.jar\".component.TextMDB.START" => "o
g.jboss.msc.service.StartException in service jboss.deployment.unit.\"mdb.jar\".component.TextMDB.START: Failed to start service"}}}}
4:50:30,020 INFO [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015876: Starting deployment of "mdb1.jar"
4:50:30,054 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC00001: Failed to start service jboss.deployment.unit."mdb1.jar".PARSE: org
jboss.msc.service.StartException in service jboss.deployment.unit."mdb1.jar".PARSE: Failed to process phase PARSE of deployment "mdb1.jar"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1
Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_26]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_26]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_26]
aused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: Exception while parsing ejb-jar.xml: /D:/JBoss/jboss-as-7.1.1.Final/bin/c
ntent/mdb1.jar/META-INF/ejb-jar.xml
at org.jboss.as.ejb3.deployment.processors.EjbJarParsingDeploymentUnitProcessor.parseEjbJarXml(EjbJarParsingDeploymentUnitProcessor.java:248)
at org.jboss.as.ejb3.deployment.processors.EjbJarParsingDeploymentUnitProcessor.deploy(EjbJarParsingDeploymentUnitProcessor.java:118)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1
Final]
... 5 more
aused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[14,7]
*essage: Unexpected element 'message-driven-destination' encountered*
at org.jboss.metadata.parser.util.MetaDataElementParser.unexpectedElement(MetaDataElementParser.java:108)
at org.jboss.metadata.ejb.parser.spec.AbstractMetaDataParser.processElement(AbstractMetaDataParser.java:53)
at org.jboss.metadata.ejb.parser.spec.AbstractNamedMetaDataWithDescriptionGroupParser.processElement(AbstractNamedMetaDataWithDescriptionGroup
arser.java:66)
at org.jboss.metadata.ejb.parser.spec.AbstractEnterpriseBeanMetaDataParser.processElement(AbstractEnterpriseBeanMetaDataParser.java:84)
at org.jboss.metadata.ejb.parser.spec.AbstractMessageDrivenBeanParser.processElement(AbstractMessageDrivenBeanParser.java:93)
at org.jboss.metadata.ejb.parser.spec.MessageDrivenBean31Parser.processElement(MessageDrivenBean31Parser.java:76)
at org.jboss.metadata.ejb.parser.spec.MessageDrivenBean31Parser.processElement(MessageDrivenBean31Parser.java:36)
at org.jboss.metadata.ejb.parser.spec.AbstractMetaDataParser.processElements(AbstractMetaDataParser.java:65)
at org.jboss.metadata.ejb.parser.spec.MessageDrivenBean31Parser.parse(MessageDrivenBean31Parser.java:43)
at org.jboss.metadata.ejb.parser.spec.EnterpriseBeansMetaDataParser.processElement(EnterpriseBeansMetaDataParser.java:98)
at org.jboss.metadata.ejb.parser.spec.EnterpriseBeansMetaDataParser.processElement(EnterpriseBeansMetaDataParser.java:38)
at org.jboss.metadata.ejb.parser.spec.AbstractMetaDataParser.processElements(AbstractMetaDataParser.java:65)
at org.jboss.metadata.ejb.parser.spec.EnterpriseBeansMetaDataParser.parse(EnterpriseBeansMetaDataParser.java:74)
at org.jboss.metadata.ejb.parser.spec.EnterpriseBeansMetaDataParser.parse(EnterpriseBeansMetaDataParser.java:66)
at org.jboss.metadata.ejb.parser.spec.AbstractEjbJarMetaDataParser.processElement(AbstractEjbJarMetaDataParser.java:111)
at org.jboss.metadata.ejb.parser.spec.AbstractEjbJarMetaDataParser.processElement(AbstractEjbJarMetaDataParser.java:38)
at org.jboss.metadata.ejb.parser.spec.AbstractMetaDataParser.processElements(AbstractMetaDataParser.java:65)
at org.jboss.metadata.ejb.parser.spec.EjbJarMetaDataParser.parseDocument(EjbJarMetaDataParser.java:109)
at org.jboss.metadata.ejb.parser.spec.EjbJarMetaDataParser.parse(EjbJarMetaDataParser.java:53)
at org.jboss.as.ejb3.deployment.processors.EjbJarParsingDeploymentUnitProcessor.parseEjbJarXml(EjbJarParsingDeploymentUnitProcessor.java:245)
... 7 more
4:50:30,115 INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS015870: Deploy of deployment "mdb1.jar" was rolled back with failure mess
ge {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"mdb1.jar\".PARSE" => "org.jboss.msc.service.StartException in service jboss.deployment
unit.\"mdb1.jar\".PARSE: Failed to process phase PARSE of deployment \"mdb1.jar\""}}
4:50:30,119 INFO [org.jboss.as.server.deployment] (MSC service thread 1-5) JBAS015877: Stopped deployment mdb1.jar in 4ms
4:50:30,122 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 1) JBAS014774: Service status report
BAS014777: Services which failed to start: service jboss.deployment.unit."mdb1.jar".PARSE: org.jboss.msc.service.StartException in service jbo
s.deployment.unit."mdb1.jar".PARSE: Failed to process phase PARSE of deployment "mdb1.jar"
4:50:30,128 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) {"JBAS014653: Composite operation failed and was rolled ba
k. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"mdb1.jar\".PARSE" => "org.jboss.msc.serv
ce.StartException in service jboss.deployment.unit.\"mdb1.jar\".PARSE: Failed to process phase PARSE of deployment \"mdb1.jar\""}}}}
Your help is highly anticipated.
-AMol
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/747697#747697]
Start a new discussion in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 4 months