[JBoss JIRA] (JASSIST-261) Issue with javassist on jdk 9b112
by Mandy Chung (JIRA)
[ https://issues.jboss.org/browse/JASSIST-261?page=com.atlassian.jira.plugi... ]
Mandy Chung commented on JASSIST-261:
-------------------------------------
See JASSIST-264. ModuleClassPath throws NoSuchMethodError in Project Jigsaw EA build.
> Issue with javassist on jdk 9b112
> ---------------------------------
>
> Key: JASSIST-261
> URL: https://issues.jboss.org/browse/JASSIST-261
> Project: Javassist
> Issue Type: Bug
> Affects Versions: 3.20.0-GA
> Environment: Javassist with jdk 9b112
> Reporter: Hoang Chuong Tran
> Assignee: Shigeru Chiba
> Fix For: 3.22.0-CR1
>
>
> I am migrating a project to java 9, which also uses javassist to generate runtime code.
> One test of mine fails on jdk 9b112 while it passes on jdk 8u77.
> {noformat}
> import static javassist.CtClass.voidType;
> import java.lang.reflect.Method;
> import java.lang.reflect.Modifier;
> import java.util.HashMap;
> import java.util.Map;
> import org.junit.Test;
> import javassist.ClassClassPath;
> import javassist.ClassPool;
> import javassist.CtClass;
> import javassist.CtField;
> import javassist.CtMethod;
> import javassist.CtNewMethod;
> public class MyTests {
> public static class MyObject {
> protected Object field;
> Object getField() {return field;}
> public void setField(Object field) {}
> }
> @Test
> public void test() throws InstantiationException, IllegalAccessException {
> Class<? extends MyObject> clazz = compile(MyObject.class);
> clazz.newInstance().setField(null);
> }
> /** Compile a transfer class */
> public static synchronized Class<? extends MyObject> compile(Class<?> targetClass) {
> // Determine class setters
> Map<String, Method> setters = extractSetters(targetClass);
> ClassPool classPool = ClassPool.getDefault();
> classPool.insertClassPath(new ClassClassPath(targetClass));
> try {
> // Compile a new transfer class on the fly
> CtClass baseClass = classPool.get(MyObject.class.getName());
> CtClass proxyClass = classPool.makeClass(targetClass.getName() + "_Modified", baseClass);
> for(Method originalSetter : setters.values()) {
> // Create a field to hold the attribute
> Class<?> fieldClass = originalSetter.getParameterTypes()[0];
> CtClass fieldType = classPool.get(fieldClass.getName());
> String fieldName = originalSetter.getName().substring(3);
> CtField field = new CtField(fieldType, fieldName, proxyClass);
> proxyClass.addField(field);
> // Create a setter method to set that field
> CtClass[] parameters = new CtClass[] { fieldType };
> String setterBody = "{ System.out.println(\"Hello World\"); }";
> CtMethod setter = CtNewMethod.make(voidType, originalSetter.getName(), parameters, new CtClass[0], setterBody, proxyClass);
> proxyClass.addMethod(setter);
> }
> Class<? extends MyObject> javaClass = proxyClass.toClass(targetClass.getClassLoader(), targetClass.getProtectionDomain());
> return javaClass;
> } catch(Exception e) {
> throw new RuntimeException("Failure during transfer compilation for " + targetClass, e);
> }
> }
> /** Extract setter methods from a class */
> public static Map<String, Method> extractSetters(Class<?> cls) {
> Map<String, Method> setters = new HashMap<String, Method>();
> for(Method method : cls.getMethods()) {
> // Lookup setter methods
> if(method.getName().startsWith("set")) {
> // Only public setters
> int modifiers = method.getModifiers();
> if(Modifier.isPublic(modifiers)) {
> Class<?>[] exceptions = method.getExceptionTypes();
> Class<?>[] parameters = method.getParameterTypes();
> Class<?> returnType = method.getReturnType();
> if(exceptions.length <= 0 && parameters.length == 1 && "void".equals(returnType.getName())) {
> setters.put(method.getName(), method);
> }
> }
> }
> }
> return setters;
> }
> }
> {noformat}
> On jdk 8u77, the {{compile()}} function returns with success and "Hello world" is printed to the console.
> On jdk 9b112, I got the following exception
> {noformat}
> java.lang.RuntimeException: Failure during transfer compilation for class MyTests$MyObject
> at MyTests.compile(MyTests.java:68)
> at MyTests.test(MyTests.java:29)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(java.base@9-ea/Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(java.base@9-ea/NativeMethodAccessorImpl.java:62)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(java.base@9-ea/DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(java.base@9-ea/Method.java:531)
> at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
> at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
> at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
> at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
> at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
> at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
> at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
> at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:670)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
> Caused by: javassist.NotFoundException: java.lang.Object
> at javassist.ClassPool.get(ClassPool.java:450)
> at MyTests.compile(MyTests.java:51)
> ... 24 more
> {noformat}
> I suspect that is due to the jigsaw integration into the jdk.
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
9 years, 8 months
[JBoss JIRA] (JASSIST-264) avassist.ModuleClassPath throws NoSuchMethodError when running on Jigsaw EA build
by Mandy Chung (JIRA)
Mandy Chung created JASSIST-264:
-----------------------------------
Summary: avassist.ModuleClassPath throws NoSuchMethodError when running on Jigsaw EA build
Key: JASSIST-264
URL: https://issues.jboss.org/browse/JASSIST-264
Project: Javassist
Issue Type: Bug
Reporter: Mandy Chung
Assignee: Shigeru Chiba
Project Jigsaw EA build is available for download at
http://openjdk.java.net/projects/jigsaw/ea
The Jigsaw EA build is the latest prototype implementation of JSR 376, the Java Platform Module System, that implements the proposals to resolve the JSR 376 open issues:
http://openjdk.java.net/projects/jigsaw/spec/issues/
java.lang.NoSuchMethodError: java.lang.reflect.Layer.parent()Ljava/util/Optional;
at javassist.ModuleClassPath.<init>(ModuleClassPath.java:53)
at javassist.ModuleClassPath.<init>(ModuleClassPath.java:39)
at javassist.ClassPoolTail.appendSystemPath(ClassPoolTail.java:249)
at javassist.ClassPool.appendSystemPath(ClassPool.java:944)
at javassist.ClassPool.<init>(ClassPool.java:179)
is calling java.lang.reflect.Layer::parent method. Layer::parent method is not present due to the solution #NonHierarchicalLayers issue.
Looks like ModuleClassPath class is added to resolved JASSIST-261 and unclear why Layer::parent is needed. But looks like this is related to #ClassFilesAsResources issue in JDK 9 that encapsulate .class file from access.
The Jigsaw EA build has resolved #ClassFilesAsResources to allow ClassLoader::getResource* methods to access .class files. Note that this is not in JDK 9 yet. Please subscribe to jigsaw-dev(a)openjdk.java.net for announcement.
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
9 years, 8 months
[JBoss JIRA] (WFLY-7501) Security domain can have itself in "trusted-security-domains"
by Jan Kalina (JIRA)
[ https://issues.jboss.org/browse/WFLY-7501?page=com.atlassian.jira.plugin.... ]
Jan Kalina edited comment on WFLY-7501 at 11/9/16 12:21 PM:
------------------------------------------------------------
I think the bug actually is that domain A can have A in trusted domains. (That A doesnt exist yet is not problem)
was (Author: honza889):
I think the bug actually is that domain A can have A in trusted domains.
> Security domain can have itself in "trusted-security-domains"
> -------------------------------------------------------------
>
> Key: WFLY-7501
> URL: https://issues.jboss.org/browse/WFLY-7501
> Project: WildFly
> Issue Type: Bug
> Components: Security
> Reporter: Hynek Švábek
> Assignee: Jan Kalina
>
> Security-domain trusted-security-domains attribute has confusing behaviour. I can define there security domain which doesn't exist yet (It is being created right now).
> *Steps to reproduce*
> {code}
> /subsystem=elytron/filesystem-realm=realm1:add(relative-to=jboss.server.config.dir, path=tmp.prop)
> {code}
> {code}
> /subsystem=elytron/security-domain=secDomain888:add(realms=[{realm=realm1}], default-realm=realm1, trusted-security-domains=[secDomain888])
> {code}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
9 years, 8 months
[JBoss JIRA] (WFLY-7501) Security domain can have itself in "trusted-security-domains"
by Jan Kalina (JIRA)
[ https://issues.jboss.org/browse/WFLY-7501?page=com.atlassian.jira.plugin.... ]
Jan Kalina updated WFLY-7501:
-----------------------------
Summary: Security domain can have itself in "trusted-security-domains" (was: I can define security domain which doesn't exists yet in SecurityDomain "trusted-security-domains" attribute.)
> Security domain can have itself in "trusted-security-domains"
> -------------------------------------------------------------
>
> Key: WFLY-7501
> URL: https://issues.jboss.org/browse/WFLY-7501
> Project: WildFly
> Issue Type: Bug
> Components: Security
> Reporter: Hynek Švábek
> Assignee: Jan Kalina
>
> Security-domain trusted-security-domains attribute has confusing behaviour. I can define there security domain which doesn't exist yet (It is being created right now).
> *Steps to reproduce*
> {code}
> /subsystem=elytron/filesystem-realm=realm1:add(relative-to=jboss.server.config.dir, path=tmp.prop)
> {code}
> {code}
> /subsystem=elytron/security-domain=secDomain888:add(realms=[{realm=realm1}], default-realm=realm1, trusted-security-domains=[secDomain888])
> {code}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
9 years, 8 months
[JBoss JIRA] (WFLY-7501) I can define security domain which doesn't exists yet in SecurityDomain "trusted-security-domains" attribute.
by Jan Kalina (JIRA)
[ https://issues.jboss.org/browse/WFLY-7501?page=com.atlassian.jira.plugin.... ]
Jan Kalina commented on WFLY-7501:
----------------------------------
I think the bug actually is that domain A can have A in trusted domains.
> I can define security domain which doesn't exists yet in SecurityDomain "trusted-security-domains" attribute.
> -------------------------------------------------------------------------------------------------------------
>
> Key: WFLY-7501
> URL: https://issues.jboss.org/browse/WFLY-7501
> Project: WildFly
> Issue Type: Bug
> Components: Security
> Reporter: Hynek Švábek
> Assignee: Jan Kalina
>
> Security-domain trusted-security-domains attribute has confusing behaviour. I can define there security domain which doesn't exist yet (It is being created right now).
> *Steps to reproduce*
> {code}
> /subsystem=elytron/filesystem-realm=realm1:add(relative-to=jboss.server.config.dir, path=tmp.prop)
> {code}
> {code}
> /subsystem=elytron/security-domain=secDomain888:add(realms=[{realm=realm1}], default-realm=realm1, trusted-security-domains=[secDomain888])
> {code}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
9 years, 8 months
[JBoss JIRA] (WFLY-7501) I can define security domain which doesn't exists yet in SecurityDomain "trusted-security-domains" attribute.
by Jan Kalina (JIRA)
[ https://issues.jboss.org/browse/WFLY-7501?page=com.atlassian.jira.plugin.... ]
Jan Kalina reassigned WFLY-7501:
--------------------------------
Assignee: Jan Kalina (was: Darran Lofthouse)
> I can define security domain which doesn't exists yet in SecurityDomain "trusted-security-domains" attribute.
> -------------------------------------------------------------------------------------------------------------
>
> Key: WFLY-7501
> URL: https://issues.jboss.org/browse/WFLY-7501
> Project: WildFly
> Issue Type: Bug
> Components: Security
> Reporter: Hynek Švábek
> Assignee: Jan Kalina
>
> Security-domain trusted-security-domains attribute has confusing behaviour. I can define there security domain which doesn't exist yet (It is being created right now).
> *Steps to reproduce*
> {code}
> /subsystem=elytron/filesystem-realm=realm1:add(relative-to=jboss.server.config.dir, path=tmp.prop)
> {code}
> {code}
> /subsystem=elytron/security-domain=secDomain888:add(realms=[{realm=realm1}], default-realm=realm1, trusted-security-domains=[secDomain888])
> {code}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
9 years, 8 months
[JBoss JIRA] (WFLY-7491) joiner attribute of concatenating-principal-decoder (Elytron subsystem) is marked as nillable but can not be
by Jan Kalina (JIRA)
[ https://issues.jboss.org/browse/WFLY-7491?page=com.atlassian.jira.plugin.... ]
Jan Kalina reassigned WFLY-7491:
--------------------------------
Assignee: Jan Kalina (was: Darran Lofthouse)
> joiner attribute of concatenating-principal-decoder (Elytron subsystem) is marked as nillable but can not be
> ------------------------------------------------------------------------------------------------------------
>
> Key: WFLY-7491
> URL: https://issues.jboss.org/browse/WFLY-7491
> Project: WildFly
> Issue Type: Bug
> Components: Security
> Affects Versions: 11.0.0.Alpha1
> Reporter: Ondrej Kotek
> Assignee: Jan Kalina
> Labels: user_experience
>
> *Issue description:*
> After having undefined the {{joiner}} attribute of {{concatenating-principal-decoder}} in Elytron subsystem, the server does not start. The {{joiner}} attribute is declared as {{"nillable" => true}} in CLI, but can not be -- see _Steps to Reproce_ that results in
> {noformat}
> 14:50:29,357 ERROR [org.jboss.as.controller] (Controller Boot Thread)
> OPVDX001: Validation error in standalone-elytron.xml ===========================
> 346: <permission class-name="org.wildfly.security.auth.permission.LoginPermission"/>
> 347: </constant-permission-mapper>
> 348: <concatenating-principal-decoder name="concatPrincDecoder">
> ^^^^ 'concatenating-principal-decoder' is missing one or more required attributes
> All of the following are required: joiner
> 349: <principal-decoder name="constPrincDecoder"/>
> 350: <principal-decoder name="constPrincDecoder"/>
> 351: </concatenating-principal-decoder>
> The underlying error message was:
> > ParseError at [row,col]:[348,17]
> > Message: WFLYCTL0133: Missing required attribute(s): joiner
> ================================================================================
> 14:50:29,357 ERROR [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0055: Caught exception during boot: org.jboss.as.controller.persistence.ConfigurationPersistenceException: WFLYCTL0085: Failed to parse configuration
> at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:143)
> at org.jboss.as.server.ServerService.boot(ServerService.java:355)
> at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:302)
> at java.lang.Thread.run(Thread.java:745)
> 14:50:29,358 FATAL [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0056: Server boot has failed in an unrecoverable manner; exiting. See previous messages for details.
> {noformat}
> The {{joiner}} attribute has {{use="required"}} in _wildfly-elytron_1_0.xsd_.
> *Suggestions for improvement:*
> In case it makes sense to have no joiner, the joiner should not be required. (There could be reasonable cases.) Otherwise, the CLI {{joiner}} attribute should be declared as {{"nillable" => false}}.
> The XSD {{joiner}} attribute should have defined {{default="."}}.
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
9 years, 8 months
[JBoss JIRA] (WFCORE-482) Add log4j2 support for WildFly
by Steve Cohen (JIRA)
[ https://issues.jboss.org/browse/WFCORE-482?page=com.atlassian.jira.plugin... ]
Steve Cohen edited comment on WFCORE-482 at 11/9/16 11:03 AM:
--------------------------------------------------------------
Coming over here after your post on [Stack Overflow|http://stackoverflow.com/questions/40476703/log4j2-logging-of-co...].
The answers to your questions are very much in flux. As I said on Stack Overflow:
{quote}I am doing the following: porting several legacy applications from WebLogic to JBoss EAP 7. Some of the components being ported are EJBs. Others are servlet apps that invoke these EJBs. These EJBs are deployed in ejb-jars. I know that I could wrap this whole thing into a big EAR file but we don't want to do that. The servlets and the EJB jars need to be separately deployable components.
Then there is the logging setup. We are using log4j2 and we want to keep independent of the JBoss logging setup. I have created a JBoss module that contains all the log4j2 jars with the proper dependencies, and logging works. The servlet runs and logs, invokes the EJBs and they work.
The only problem is how to configure the EJB's logging. In a Web App like the servlet, it's easy, just specify the log4j logging configuration file in web.xml. What's the analog for an ejb jar? I couldn't think of a way. {quote}
I had no idea I was so far out on the bleeding edge. If you can supply an example of successfully using the LoggerContextFactory I would love to see it. That section of log4j documentation is very weak.
was (Author: stevecoh4):
Coming over here after your post on[ Stack Overflow|http://stackoverflow.com/questions/40476703/log4j2-logging-of-co...].
The answers to your questions are very much in flux. As I said on Stack Overflow:
{quote}I am doing the following: porting several legacy applications from WebLogic to JBoss EAP 7. Some of the components being ported are EJBs. Others are servlet apps that invoke these EJBs. These EJBs are deployed in ejb-jars. I know that I could wrap this whole thing into a big EAR file but we don't want to do that. The servlets and the EJB jars need to be separately deployable components.
Then there is the logging setup. We are using log4j2 and we want to keep independent of the JBoss logging setup. I have created a JBoss module that contains all the log4j2 jars with the proper dependencies, and logging works. The servlet runs and logs, invokes the EJBs and they work.
The only problem is how to configure the EJB's logging. In a Web App like the servlet, it's easy, just specify the log4j logging configuration file in web.xml. What's the analog for an ejb jar? I couldn't think of a way. {quote}
I had no idea I was so far out on the bleeding edge. If you can supply an example of successfully using the LoggerContextFactory I would love to see it. That section of log4j documentation is very weak.
> Add log4j2 support for WildFly
> ------------------------------
>
> Key: WFCORE-482
> URL: https://issues.jboss.org/browse/WFCORE-482
> Project: WildFly Core
> Issue Type: Task
> Components: Logging
> Environment: Spring 3, Hibernate, Wicket, JBoss AS7
> Reporter: Amarkanth Ranganamayna
> Assignee: James Perkins
> Priority: Optional
>
> I am trying to use Flume Appender which comes with Log4j2 (log4j 1.x doesn't support flume appender) (AND) inorder to acheive this, I am looking at how to configure JBoss AS7 to use log4j2.
> Looks like Jboss AS7 by default use log4j 1.x
> Are you guys already working on using log4j2 ?
> If NOT, can you please suggest how to configure Jboss AS7 such that it picks up "log4j2.xml" file and doesn't use its own logging.
> Thanks,
> Amar
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
9 years, 8 months