[JBoss Transactions Development] - Remote Tx Inflow: Proxying a transaction as an XAResource issue
by Tom Jenkinson
Tom Jenkinson [http://community.jboss.org/people/tomjenkinson] created the discussion
"Remote Tx Inflow: Proxying a transaction as an XAResource issue"
To view the discussion, visit: http://community.jboss.org/message/629876#629876
--------------------------------------------------------------
I have started to implement ( https://svn.jboss.org/repos/labs/labs/jbosstm/branches/JBOSSTS_4_15_0_Fin... https://svn.jboss.org/repos/labs/labs/jbosstm/branches/JBOSSTS_4_15_0_Fin...) the planned approach to facilitiate remoting being able to flow a transaction between servers but have come up against the following issue.
Basically, the plan is to get the transport to register an javax.transaction.xa.XAResource that can intercept calls to javax.transaction.Transaction lifecycle management calls such as commit/rollback and relay those over to the remote transaction manager.
This is all looking good until you realise that the signature for XAResource permits fewer exception types than the corresponding Transaction signature, resulting in a loss of prescision in the proxy code. As such as I tried to map the javax.transaction.Transaction exception types for commit/rollback using the available XA error codes.
Just wondered if people can see any issues with the mappings I have done or can spot more appropriate ones:
try {
remoteManager.commit(xid);
} catch (SecurityException e) {
// This should never happen really as the root TM should have detected this
throw new XAException(XAException.XAER_OUTSIDE);
} catch (RollbackException e) {
throw new XAException(XAException.XA_RBPROTO);
} catch (HeuristicMixedException e) {
throw new XAException(XAException.XA_HEURMIX);
} catch (HeuristicRollbackException e) {
throw new XAException(XAException.XA_HEURRB);
} catch (SystemException e) {
throw new XAException(XAException.XAER_PROTO);
}
try {
remoteManager.rollback(xid);
} catch (IllegalStateException e) {
throw new XAException(XAException.XAER_NOTA);
} catch (SystemException e) {
throw new XAException(XAException.XAER_PROTO);
}
Comments/suggestions?
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/629876#629876]
Start a new discussion in JBoss Transactions Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 3 months
[JBoss AS7 Development] - Logging Id's
by James Perkins
James Perkins [http://community.jboss.org/people/jamezp] modified the document:
"Logging Id's"
To view the document, visit: http://community.jboss.org/docs/DOC-16810
--------------------------------------------------------------
These are ranges used for JBoss AS logging ids.
|| *Range* || *Subsystem
* ||
| *10100 - 10199* | *Transaction* |
| *10200 - 10399
* | *Clustering**
* |
| *10400 - 10499* | *Connector**
* |
| *10500 - 10599* | *Controller**
* |
| *10600 - 10699* | *Controller Client* |
| *10700 - 10799* | *Deployment Repository* |
| *10800 - 10899* | *JPA* |
| *10900 - 10999* | *Deployment Scanner* |
| *11000 - 11099* | *EE* |
| *11100 - 11199* | *Embedded* |
| *11200 - 11299* | *JAXRS* |
| *11300 - 11399* | *JMX* |
| *11400 - 11499* | *JPA* |
| *11500 - 11599* | *Logging* |
| *11600 - 11699* | *Messaging* |
| *11700 - 11799* | *mod_cluster* |
| *11800 - 11899* | *Naming* |
| *11900 - 11999* | *OSGi (as plugin 00-10; service 11-99)* |
| *12000 - 12099* | *Process Controller* |
| *12100 - 12199* | *Protocol* |
| *13100 - 13199* | *Security* |
--------------------------------------------------------------
Comment by going to Community
[http://community.jboss.org/docs/DOC-16810]
Create a new document in JBoss AS7 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=102&co...]
13 years, 3 months
[JBoss Tools Development] - New Plugin: no class org/jboss/forge/project/facets/BaseFacet
by Mario Antollini
Mario Antollini [http://community.jboss.org/people/antollinim] created the discussion
"New Plugin: no class org/jboss/forge/project/facets/BaseFacet"
To view the discussion, visit: http://community.jboss.org/message/631599#631599
--------------------------------------------------------------
Hello,
I am part of the Switchyard community. We had a set of plugins working for Forge1.0.0.Alpha4 and we now need to move forward to Forge1.0.0.Beta3.
In Alpha4 were were installing the plugins just copying the jars in the libs dir. Now, to test the plugins, we need to instruct forge to install them itself. When I execute the command "forge source-plugin <puglin_src_dir>" everything works OK: the plugin gets compiled and installed in my .forge dir inside my home dir.
However, after the installation, when I run forge, it does not start and throws the following error:
log4j:ERROR A "org.apache.log4j.xml.DOMConfigurator" object is not assignable to a "org.apache.log4j.spi.Configurator" variable.
log4j:ERROR The class "org.apache.log4j.spi.Configurator" was loaded by
log4j:ERROR [ModuleClassLoader for Module "org.jboss.forge:main" from local module loader @335856a5 (roots: D:\tools\forge-1.0.0.Beta3\modules,C:\User
s\mario\.forge\plugins)] whereas object of type
log4j:ERROR "org.apache.log4j.xml.DOMConfigurator" was loaded by [ModuleClassLoader for Module "org.switchyard.switchyard-forge-plugin.dependencies:0.
3.0-SNAPSHOT-bee75bd4-471b-49c3-9cd2-d1ca8b531098" from local module loader @335856a5 (roots: D:\tools\forge-1.0.0.Beta3\modules,C:\Users\mario\.forge
\plugins)].
log4j:ERROR Could not instantiate configurator [org.apache.log4j.xml.DOMConfigurator].
log4j:WARN No appenders could be found for logger (org.jboss.weld.Version).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "Thread-2" java.lang.LinkageError: Failed to link org/switchyard/tools/forge/AbstractFacet (Module "org.switchyard.switchyard-forg
e-plugin.dependencies:0.3.0-SNAPSHOT-bee75bd4-471b-49c3-9cd2-d1ca8b531098" from local module loader @335856a5 (roots: D:\tools\forge-1.0.0.Beta3\modul
es,C:\Users\mario\.forge\plugins))
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:401)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:261)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:76)
at org.jboss.modules.Module.loadModuleClass(Module.java:590)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:183)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:361)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:333)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:310)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:103)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:397)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:261)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:76)
at org.jboss.modules.Module.loadModuleClass(Module.java:590)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:183)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:361)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:310)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:115)
at org.jboss.forge.shell.CompositeClassLoader.findClass(CompositeClassLoader.java:72)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:361)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:310)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:103)
at org.jboss.weld.environment.se.discovery.url.WeldSEResourceLoader.classForName(WeldSEResourceLoader.java:44)
at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:82)
at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:134)
at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:191)
at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:368)
at org.jboss.weld.environment.se.Weld.initialize(Weld.java:92)
at org.jboss.forge.shell.Bootstrap$1.run(Bootstrap.java:82)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NoClassDefFoundError: org/jboss/forge/project/facets/BaseFacet
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:397)
... 32 more
Caused by: java.lang.ClassNotFoundException: org.jboss.forge.project.facets.BaseFacet from [Module "org.switchyard.switchyard-forge-plugin.dependencie
s:0.3.0-SNAPSHOT-bee75bd4-471b-49c3-9cd2-d1ca8b531098" from local module loader @335856a5 (roots: D:\tools\forge-1.0.0.Beta3\modules,C:\Users\mario\.f
orge\plugins)]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:361)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:333)
My plugin depends on forge-shell.jar:
<dependency>
<groupId>org.jboss.forge</groupId>
<artifactId>forge-shell</artifactId>
<version>1.0.0.Beta3</version>
<scope>provided</scope>
</dependency>
So, I see the problem is that org/jboss/forge/project/facets/BaseFacet is not being found during Forge startup. But why is that? I can see forge-shell-api.jar (the jar containing the required class) is in the <forge-1.0.0.Beta3>\modules\org\jboss\forge\shell-api\main dir.
I would appreciate any good tip!
Thanks in advance
Mario
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/631599#631599]
Start a new discussion in JBoss Tools Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 3 months
[JBoss Tools Development] - Asking for feedback about problem management in Java WorkingCopy
by Xavier Coulon
Xavier Coulon [http://community.jboss.org/people/xcoulon] created the discussion
"Asking for feedback about problem management in Java WorkingCopy"
To view the discussion, visit: http://community.jboss.org/message/632025#632025
--------------------------------------------------------------
Hello,
I'm currently refactoring a large part of the JAX-RS plugin to support JavaElementChanges instead of ResourceChanges, in order to fix some issues and eventually provide faster computation and feedbacks to the user. So far, it's going not too bad, but I'm facing a problem with Eclipse's Problem management in Java Working copies (what an irony).
Let me give you an example:
package org.jboss.samples.rs.webservices;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
@HttpMethod("FOO")
public @interface FooHttpMethod {
}
when a user adds the @HttpMethod("FOO") annotation to the FooHttpMethod Type, a set of JavaElementChanges is triggered, but at that particular time the 'import javax.ws.rs.HttpMethod' statement is missing, and so there are 2 problems in the CompilationUnit (one for the unknown annotation type and one for the unknown annotation 'value' attribute).
In the code, I can do the following method call while scanning the event delta hierarchy:
final IProblem[] problems = compilationUnitAST.getProblems();
This gives me the *current* problems in the working copy. Using a map in a singleton, I can compare those new problems with the one that were reported before the change, compute a diff and find those that were actually fixed. Yet, I can't really use these fixed problems to apply changes to the JAX-RS metamodel, because the fixed problems refer to portions of the source code that may have moved ! In the current example, adding the required import statement moves the @HttpMethod annotation declaration down, and the problem's startLocation is now somewhere around the @Retention annotation declaration :-/
So my question is : how do you usually address this kind of issue ? Ie, how can I know that the @HttpMethod problems are now fixed ? Or that the @HttpMethod annotation was removed from the source code ?
(I'd like to keep the JavaElementChanges support that I refactored and not move back to the ResourceChange support)
Also, do you know why the method:
compilationUnit.getElementAt(solvedProblem.getSourceStart())
returns the SourceType and not the Annotation (even if it is the wrong one) ?
Thank you in advance
/Xavier
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/632025#632025]
Start a new discussion in JBoss Tools Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 3 months
[JBoss Portal Development] - Re: JBOSS Portal Security
by saber zaier
saber zaier [http://community.jboss.org/people/spring] created the discussion
"Re: JBOSS Portal Security"
To view the discussion, visit: http://community.jboss.org/message/631968#631968
--------------------------------------------------------------
I have resolved this pb in 2009, the answer was :
In authentifiction module :
---------------------------------------
String WEB_REQUEST_KEY = "javax.servlet.http.HttpServletRequest";
HttpServletRequest request;
String j_role = null;
String j_user = null;
String j_password = null;
try {
request = (HttpServletRequest) PolicyContext.getContext(WEB_REQUEST_KEY);
j_role = request.getParameter("j_role");
j_user = request.getParameter("j_username");
j_password = request.getParameter("j_password");
this.callbackHandler = new customCallbackHandler(j_user, j_password, j_role);
} catch (PolicyContextException e) {
throw new FailedLoginException("Technical Error");
}
In the customCallbackHandler class :
------------------------------------------------------
public class customCallbackHandler implements CallbackHandler {
...............;
@Override
public void handle(Callback[] callbacks) throws IOException,
UnsupportedCallbackException {
for (int i = 0; i < callbacks.length; i++) {
if (callbacks[i] instanceof TextOutputCallback) {
// display the message according to the specified type
TextOutputCallback toc = (TextOutputCallback) callbacks[i];
switch (toc.getMessageType()) {
case TextOutputCallback.INFORMATION:
System.out.println(toc.getMessage());
break;
case TextOutputCallback.ERROR:
System.out.println("ERROR: " + toc.getMessage());
break;
case TextOutputCallback.WARNING:
System.out.println("WARNING: " + toc.getMessage());
break;
default:
throw new IOException("Unsupported message type: "
+ toc.getMessageType());
}
} else if (callbacks[i] instanceof TextInputCallback) {
// prompt the text imput for a role
TextInputCallback tic = (TextInputCallback) callbacks[i];
tic.setText(role);
} else if (callbacks[i] instanceof NameCallback) {
// prompt the user for a username
NameCallback nc = (NameCallback) callbacks[i];
nc.setName(username);
} else if (callbacks[i] instanceof PasswordCallback) {
// prompt the user for sensitive information
PasswordCallback pc = (PasswordCallback) callbacks[i];
pc.setPassword(password.toCharArray());
} else {
throw new UnsupportedCallbackException(callbacks[i],
"Unrecognized Callback");
}
}
}
In the view class :
--------------------------
public boolean isUserInRoleAdministrator() {
FacesContext ctx = FacesContext.getCurrentInstance();
Object request = ctx.getExternalContext().getRequest();
if (request instanceof RenderRequest) {
List<String> roles = (List<String>) ((RenderRequest) request).getPortletSession(false).getAttribute("roles");
if (null != roles)
return roles.contains(ADMINISTRATOR);
} else if (request instanceof HttpServletRequest) {
List<String> roles = (List<String>) ((HttpServletRequest) request).getSession(false).getAttribute(ATTRIBUTE_ROLES);
if (null != roles)
return roles.contains(ADMINISTRATOR);
} else if (request instanceof ResourceRequest) {
List<String> roles = (List<String>) ((ResourceRequest) request).getPortletSession().getAttribute("roles");
if (null != roles)
return roles.contains(ADMINISTRATOR);
}
public String getUserConnected() {
if (null != FacesContext.getCurrentInstance().getExternalContext() && null != FacesContext.getCurrentInstance().getExternalContext().getUserPrincipal())
return FacesContext.getCurrentInstance().getExternalContext().getUserPrincipal().getName();
else
return null;
}
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/631968#631968]
Start a new discussion in JBoss Portal Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 3 months
[PicketBox Development] - JBoss AS7 Security Auditing
by Anil Saldhana
Anil Saldhana [http://community.jboss.org/people/anil.saldhana] created the document:
"JBoss AS7 Security Auditing"
To view the document, visit: http://community.jboss.org/docs/DOC-17277
--------------------------------------------------------------
*WARN*: This article is work in progress. Please do not complain until this WARN exists. :)
h2.
h2. Configure the Domain Model Logging Subsystem
<subsystem xmlns="urn:jboss:domain:logging:1.1">
<console-handler name="CONSOLE" autoflush="true">
<level name="INFO"/>
<formatter>
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
</formatter>
</console-handler>
<periodic-rotating-file-handler name="FILE" autoflush="true">
<level name="INFO"/>
<formatter>
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
</formatter>
<file relative-to="jboss.server.log.dir" path="server.log"/>
<suffix value=".yyyy-MM-dd"/>
<append value="true"/>
</periodic-rotating-file-handler>
<periodic-rotating-file-handler name="AUDIT" autoflush="true">
<level name="TRACE"/>
<formatter>
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
</formatter>
<file relative-to="jboss.server.log.dir" path="audit.log"/>
<suffix value=".yyyy-MM-dd"/>
<append value="true"/>
</periodic-rotating-file-handler>
<logger category="com.arjuna">
<level name="WARN"/>
</logger>
<logger category="org.apache.tomcat.util.modeler">
<level name="WARN"/>
</logger>
<logger category="sun.rmi">
<level name="WARN"/>
</logger>
<logger category="org.jboss.security.audit.providers.LogAuditProvider">
<level name="TRACE"/>
<handlers>
<handler name="AUDIT"/>
</handlers>
</logger>
<root-logger>
<level name="INFO"/>
<handlers>
<handler name="CONSOLE"/>
<handler name="FILE"/>
</handlers>
</root-logger>
</subsystem>
The key changes to the logging subsystem are:
* A new logger category for "org.jboss.security.audit.providers.LogAuditProvider" is defined.
* A periodic rotating file handler called "AUDIT" is defined.
h2. Web Applications
By default, the web container will send security events during authentication/authorization to the PicketBox audit framework. The audit framework has controls to check whether the audit in logging settings has been enabled. If auditing settings are enabled, then audit log is written.
To disable auditing in your web applications, please configure your jboss-web.xml for your web archive. This is TBD.
--------------------------------------------------------------
Comment by going to Community
[http://community.jboss.org/docs/DOC-17277]
Create a new document in PicketBox Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=102&co...]
13 years, 3 months
[JBoss AS7 Development] - Re: JMX-based monitoring the jbossAS7 database connection pool
by duan xz
duan xz [http://community.jboss.org/people/duanxz] created the discussion
"Re: JMX-based monitoring the jbossAS7 database connection pool"
To view the discussion, visit: http://community.jboss.org/message/631472#631472
--------------------------------------------------------------
Hi Braun,
Thanks a lot for your help and tips.
I want to read All datasources,according to your advice, my code is as follows, but I have trouble converting the CLI to Java code:
================================================
===CLI command:
[standalone@192.0.0.204:9999 subsystem=datasources] :read-children-resources(child-type=data-source)
{
"outcome" => "success",
"result" => {
"abc" => {
....
....
===java code:
ModelControllerClient.Factory factory = new ModelControllerClient.Factory();
ModelControllerClient client = factory.create(InetAddress.getByName("192.0.0.204"), 9999);
+ModelNode op = new ModelNode();+
+op.get("operation").set("read-children-resources");+
+op.get("recursive").set(true);+
+op.get("operations").set(true);+
+ModelNode address = op.get("address");+
+address.add("subsystem", "datasources");+
+address.add("datasource", "jndi-name");+
System.out.println(op);
try {
ModelNode returnVal = client.execute(op);
System.out.println(returnVal);
} catch (IOException ie) {
// TODO Auto-generated catch block
ie.printStackTrace();
}
================================================
error trace:
------------------------------------------------
{
"outcome" => "failed",
"failure-description" => "No handler for operation read-child ren-resources at address [
(\"subsystem\" => \"datasources\"),
(\"datasource\" => \"jndi-name\")
]",
"rolled-back" => true
}
-------------------------------------------------
I don't know with the ModelNode parameter Usage.
Could you please help me with this one?
Thanks a lot,
duanxz
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/631472#631472]
Start a new discussion in JBoss AS7 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 3 months