[JBoss Seam] - Re: Seam & Maven2
by christian.bauer@jboss.com
That last statement is correct, shared libs in an EAR go into EAR/lib/ in Java EE 5.0.
However, in J2EE 1.4 and JBoss 4.0, you need to use a MANIFEST.MF in the ejb.jar and web.war archives, and reference the shared library by name in a Classpath: entry. Make sure that you have a new line after this, and that there is something in that new line (like a Created-By: entry). This is totally broken stuff in J2EE 1.4. I've lost a lot of hair until I figured that one out.
The way most Seam examples declare shared JARs in an EAR now, via a client module in application.xml, is not really correct and slower (these JARs are scanned by deployers), but seems to work.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3995733#3995733
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3995733
19 years, 4 months
[Installation, Configuration & Deployment] - Re: Sun Creator and JBoss
by nick.powers@att.com
Instead of trying to keep this document available, I'll just post what I have here. Also, at the advice of the nice people on the forum, I have switched to using NetBeans 5.5 and it integrates with JBoss very nicely.
JBoss And Sun Creator Idiosyncrasies
by Nick Powers
Reference
* JBoss Appliction Server - version 4.0.5.GA in the default configuration.
- I installed it using the JEMS installer.
* MySQL - version 4.1.22
* JConnection - version 3.0.17
Purpose
This document will list all of the funny configurations I have to do to setup the JBoss server.
Deploy a JSF project via Sun Creator
JBoss has components called JBossFaces that work like JFaces, but are not compatible with Sun Creator's version. There is an article that references these problems. The old way to replace the files and an Alternative Tomahawk option and Replacement option. I only got the Table and action components to work if I replaced the JSF jars with Sun's as described below.
* Delete the jsf-libs directory under the following: <jboss_home>\server\default\deploy\jbossweb-tomcat55.sar
* Add jstl.jar and standard.jar into following directory: <jboss_home>\server\default\deploy\jbossweb-tomcat55.sar
* Leave the sun JSF jars in the web/lib directory.
* Create a jboss-web.xml that has the following lines:
| <jboss-web>
| <resource-ref>
| <res-ref-name>jdbc/MySQLDS</res-ref-name>
| <jndi-name>java:/jdbc/MySQLDS</jndi-name>
| </resource-ref>
| </jboss-web>
|
- This defines the data source. Place it into the web\WEB-INF directory of the Creator project
* Enter the following lines to the web.xml of the Creator project:
| <listener><listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class></listener>
|
- You can not put this into the web.xml file in your Sun Creator project. It will not deploy.
- This will be placed in the WEB-INF directory.
* Remove the log4j jar from the WEB-INF/lib directory as it causes problems with the one defined in the JBoss Server.
Make jmx-console Work Again
* insert the following into the <jboss_home>\server\default\deploy\management\console-mgr.sar\web-console.war\WEB-INF\jboss-web.xml
file:
| <jboss-web>
| <!-- Uncomment the security-domain to enable security. You will
| need to edit the htmladaptor login configuration to setup the
| login modules used to authentication users.
| -->
| <security-domain>java:/jaas/jmx-console</security-domain>
| <depends>jboss.admin:service=PluginManager</depends>
| </jboss-web>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3995732#3995732
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3995732
19 years, 4 months
[JBoss AOP] - Field interception doesn't work........
by robotics80
I have three classes like these:
public class SqtpSkeleton{
| protected Log objLog=null;
| // and so on...
| }
|
| public class SqtpService extends SqtpSkeleton{
| //other fields and methods.....
| }
|
| public class MyService extends SqtpService{
| public void init(){
| objLog = new Log("c:/logFile.log",255);
| }
| public void execute(){
| objLog.write("START");
| //do something
| }
| }
Now I want to intercept the logObject of MyService class, because I want to use the same log object declared in MyService class, in a LogInterceptor. I want this behaviour because the LogInterceptor have to log operations in the same file that the class use for its own logging.
Initially I have created an aspect with two advices where the first advice intercept the FieldWriteInvocation to the object Log objLog in MyService class, and the second advice to intercept any other invocation such as MethodInvocation or ConstructorInvocation that uses the intercepted log object by the first advice.
Here is the example of the code for my Aspect:
public class LogAspect {
| private static final String className = "LogAspect";
| private static final String DBG_ERROR = "ERROR";
| private static final String DBG_WARNING = "WARNING";
| private static final String DBG_INFO = "INFO";
| private static final String DBG_TRACE = "TRACE";
| private String propertyFile;
| private Log log;
|
|
| public void setPropertyFile(String propertyFile) {
| this.propertyFile = propertyFile;
| }
|
| public void setLog(Log log) {
| this.log = log;
| }
|
| public String getName() {
| return "LogAspect";
| }
|
| public Object getLogger(Invocation invocation) throws Throwable{
| try{
| System.out.println("INGRESSO nel getLogger() for " + Thread.currentThread().getName());
| if (invocation instanceof FieldWriteInvocation) {
| FieldWriteInvocation fieldInvocation = (FieldWriteInvocation)invocation;
| setLog((Log)fieldInvocation.getValue());
| } else
| System.out.println("Unknown Invocation!!");
| return invocation.invokeNext();
| } finally {
| System.out.println("USCITA dal getLogger() for " + Thread.currentThread().getName());
| }
| }
|
| public Object trace(Invocation invocation) throws Throwable{
| String proc = className + ".trace()";
| long startTime = System.currentTimeMillis();
| logInfo(proc, "START");
| logTrace(proc, invocationTypeValue(invocation));
| Object response = null;
| try {
| response = invocation.invokeNext();
| return response;
| }catch(Throwable t) {
| long endTime = System.currentTimeMillis();
| long elapsedTime = endTime - startTime;
| logErr(proc, t.getMessage() + " - Tempo di esecuzione (ms): " + elapsedTime);
| throw t;
| }
| finally {
| long endTime = System.currentTimeMillis();
| long elapsedTime = endTime - startTime;
| logTrace(proc,dumpInvocationResponse(invocation, response) + " - Tempo di esecuzione (ms): " + elapsedTime);
| logInfo(proc, "END");
| }
| }
|
|
| /**
| * visualizza informazioni utili circa la risposta della chiamata
| * @param l'oggetto invocation, contenente il tipo di chiamata intercettatta dall'interceptor
| * @return la stringa indicante il valore di ritorno del metodo intercettato (se presente)
| */
| public String dumpInvocationResponse(Invocation invocation, Object response) {
|
| StringBuffer buffer = new StringBuffer();
| String genericName;
| String returnType;
| String modifier;
| if (invocation instanceof MethodInvocation) {
| MethodInvocation methodInvocation = (MethodInvocation)invocation;
| genericName = methodInvocation.getMethod().getName();
| returnType = methodInvocation.getMethod().getReturnType().getName();
| modifier = Modifier.toString(methodInvocation.getMethod().getModifiers());
| buffer.append(modifier + " ").append(returnType + " ").append(genericName).append("()");
| buffer.append(" ( return ");
| if (response == null)
| buffer.append("NULL");
| else
| buffer.append(response.getClass().getSimpleName()).append(":").append(response.toString());
| buffer.append(" )");
| }else if(invocation instanceof ConstructorInvocation) {
| ConstructorInvocation cInvocation = (ConstructorInvocation)invocation;
| genericName = cInvocation.getConstructor().getDeclaringClass().getSimpleName();
| modifier = Modifier.toString(cInvocation.getConstructor().getModifiers());
| buffer.append(modifier + " ").append(genericName).append("()");
| }
| return buffer.toString();
| }
|
| /**
| * Metodo che ritorna la stringa rappresentante la 'Signature' del metodo o del costruttore
| * wrappato dalla MethodInvocation o ConstructorInvocation.
| * La 'Signature' è composta dal nome del metodo / costruttore, preceduto da eventuali modificatori, e dalla lista di parametri
| * che lo compongono organizzata per 'tipo;valore', in cui il valore è l'informazione a runtime del suddetto parametro
| * @param Invocation l'oggetto per il tipo di invocazione
| * @return la stringa contenente la signature del metodo / costruttore invocato
| */
| private String invocationTypeValue (Invocation invocation) {
|
| String genericName;
| String returnType;
| String modifier;
| Object[] argumentsValue;
| Class[] argumentsType;
| //Class[] exception;
| StringBuffer buffer = new StringBuffer();
|
| if (invocation instanceof MethodInvocation) {
| MethodInvocation mi = (MethodInvocation)invocation;
| genericName = mi.getMethod().getName();
| returnType = mi.getMethod().getReturnType().getName();
| modifier = Modifier.toString(mi.getMethod().getModifiers());
| argumentsValue = mi.getArguments();
| argumentsType = mi.getMethod().getParameterTypes();
| //exception = mi.getMethod().getExceptionTypes();
| buffer.append(modifier + " ").append(returnType + " ").append(genericName);
| if (argumentsType == null || argumentsType.length == 0) {
| buffer.append("()");
| return buffer.toString();
| }
| } else if (invocation instanceof ConstructorInvocation) {
| ConstructorInvocation ci = (ConstructorInvocation)invocation;
| genericName = ci.getConstructor().getDeclaringClass().getSimpleName();
| modifier = Modifier.toString(ci.getConstructor().getModifiers());
| argumentsValue = ci.getArguments();
| argumentsType = ci.getConstructor().getParameterTypes();
| //exception = ci.getConstructor().getExceptionTypes();
| buffer.append(modifier + " ").append(genericName);
| if (argumentsType == null || argumentsType.length == 0) {
| buffer.append("()");
| return buffer.toString();
| }
| } else {
| return "Unknown " + invocation;
| }
|
| //buffer.append(genericName.substring(0, genericName.indexOf('(')));
| if (argumentsValue.length != argumentsType.length)
| System.out.println("Type");//throw new RuntimeException(" Type and Value mismatch");
| for (int i = 0; i < argumentsValue.length; i++) {
| if(i == 0)
| buffer.append(" (");
| if(argumentsType.isArray()){
| Object[] arrayArgument = (Object[])argumentsValue;
| buffer.append(argumentsType.getSimpleName()).append(":");
| if(arrayArgument.length > 20)
| buffer.append("Lenght = " + arrayArgument.length);
| else
| buffer.append(Arrays.toString(arrayArgument));
| }else
| buffer.append(argumentsType.getSimpleName()).append(":").append(argumentsValue.toString());
| if( i == argumentsValue.length - 1){
| buffer.append(")");
| break;
| }
| buffer.append(", ");
| }
| /*
| if(exception != null && exception.length > 0){
| buffer.append(" throws ");
| for (int i = 0; i < exception.length; i++) {
| buffer.append(exception.getName());
| if (i == exception.length-1)
| break;
| buffer.append(", ");
| }
| }*/
| return buffer.toString();
| }
|
| private void logErr(String proc, String message) {
| System.out.println(DBG_ERROR + ": " + message);
| if (log != null) {
| log.logWrite(log.DBG_ERROR, proc, message);
| }
| }
|
| private void logWarning(String proc, String message) {
| System.out.println(DBG_WARNING + ": " + message);
| if (log != null) {
| log.logWrite(log.DBG_WARNING, proc, message);
| }
| }
|
| private void logInfo(String proc, String message) {
| System.out.println(DBG_INFO + ": " + message);
| if (log != null) {
| log.logWrite(log.DBG_INFO, proc, message);
| }
| }
|
| private void logTrace(String proc, String message) {
| System.out.println(DBG_TRACE + ": " + message);
| if (log != null) {
| log.logWrite(log.DBG_TRACE, proc, message);
| }
| }
|
| }
Here is my jboss-aop.xml for binding aspect to pointucts:
<aop>
| <!-- Declarigng pointucs -->
| <pointcut name="logObject" expr="set(util.log.Log test.aop.MyService->objLog)"/>
| <pointcut name="logMethod" expr="execution(public * test.aop.MyService->*(..))"/>
|
| <pointcut name="logObject_2" expr="set(util.log.Log $instanceof{test.aop.SqtpSkeleton}->*)"/>
|
| <!-- Declaring Aspect -->
| <aspect name="LogAspect" class="test.aop.LogAspect" scope="PER_INSTANCE"/>
|
| <!-- Bind pountcuts to aspects -->
| <bind pointcut="logObject">
| <advice name="getLogger" aspect="LogAspect"/>
| </bind>
|
| <bind pointcut="logMethod">
| <advice name="trace" aspect="LogAspect"/>
| </bind>
|
| </aop>
The main problem is that the LogAspect doesn't intercept the FieldWriteInvocation on object objLog in MyService class, so I can't use this for logging operation in the trace() advice. If I use the second pointcut expression :
<pointcut name="logObject_2" expr="set(util.log.Log $instanceof{test.aop.SqtpSkeleton}->*)"/>
the Aspect intercept the invocation but, it only see the FieldWrite (objLog = null) in the SqtpSkeleton class, and not in its inherited classes so If call FieldWriteInvocation.getValue(), it returns null.
How can I solve this problem?
Do you have any suggestions or alternative strategy to avoid this problem?
Please help me!!!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3995729#3995729
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3995729
19 years, 4 months
[JBoss Seam] - Re: Seam & Maven2
by dviersel
A couple of weeks ago I started a small project using Seam. Since I don't like to include all-in-one jars to resolve dependencies, I went through the process of manually adding each and every dependency.
I don't use the jBPM stuff but the I have reviewed the other dependencies and arrived at a minimal set that allows me to compile my code which includes ajax4jsf, facelets, seam, ejb3, jpa and hibernate-annotations. I've tried to add information about whether the dependency is compile-time and/or run-time, whether it is provided by the container (JBoss), the version and related dependencies, etc. There still might be a lot missing though.
The EJB3 api is provided by the jboss-ejb3x.jar in the ${jboss.home}/server/default/deploy/ejb3.deployer directory. The JPA api is provided by the ejb3-persistence.jar in the ${jboss.home}/server/default/lib directory.
Of course, using the JSF 1.2 RI gives a little bit of a different set.
Finally, a little bit off topic but I believe that the EAR level dependencies (jboss-seam.jar, el-api.jar, el-ri.jar) should be packaged in a directory called 'lib' (can be overridden) within the EAR file and not be included through the in application.xml. This is intended for application-clients.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3995727#3995727
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3995727
19 years, 4 months
[Installation, Configuration & Deployment] - Re: Jboss Multiple java instance issue
by nikhighlander
If I do a ps -aef | grep nik. Here is a small output which I am getting. Out here if we do a wc -l, we are getting around 80 processes
jboss 8564 8492 0 14:40 pts/1 00:00:00 /usr/java/j2sdk1.4.2_05/bin/java -Xms512m -Xmx1024m -XX:MaxPermSize=64m -verbose:gc -Dprogram.name=run.sh -classpath /apps/jboss/bin/run.jar:/usr/java/j2sdk1.4.2_05/lib/tools.jar org.jboss.Main -c NIK
jboss 8565 8492 0 14:40 pts/1 00:00:00 /usr/java/j2sdk1.4.2_05/bin/java -Xms512m -Xmx1024m -XX:MaxPermSize=64m -verbose:gc -Dprogram.name=run.sh -classpath /apps/jboss/bin/run.jar:/usr/java/j2sdk1.4.2_05/lib/tools.jar org.jboss.Main -c NIK
jboss 8566 8492 0 14:40 pts/1 00:00:00 /usr/java/j2sdk1.4.2_05/bin/java -Xms512m -Xmx1024m -XX:MaxPermSize=64m -verbose:gc -Dprogram.name=run.sh -classpath /apps/jboss/bin/run.jar:/usr/java/j2sdk1.4.2_05/lib/tools.jar org.jboss.Main -c NIK
jboss 8567 8492 0 14:40 pts/1 00:00:00 /usr/java/j2sdk1.4.2_05/bin/java -Xms512m -Xmx1024m -XX:MaxPermSize=64m -verbose:gc -Dprogram.name=run.sh -classpath /apps/jboss/bin/run.jar:/usr/java/j2sdk1.4.2_05/lib/tools.jar org.jboss.Main -c NIK
jboss 8568 8492 0 14:40 pts/1 00:00:00 /usr/java/j2sdk1.4.2_05/bin/java -Xms512m -Xmx1024m -XX:MaxPermSize=64m -verbose:gc -Dprogram.name=run.sh -classpath /apps/jboss/bin/run.jar:/usr/java/j2sdk1.4.2_05/lib/tools.jar org.jboss.Main -c NIK
jboss 8569 8492 0 14:40 pts/1 00:00:00 /usr/java/j2sdk1.4.2_05/bin/java -Xms512m -Xmx1024m -XX:MaxPermSize=64m -verbose:gc -Dprogram.name=run.sh -classpath /apps/jboss/bin/run.jar:/usr/java/j2sdk1.4.2_05/lib/tools.jar org.jboss.Main -c NIK
jboss 8570 8492 0 14:40 pts/1 00:00:00 /usr/java/j2sdk1.4.2_05/bin/java -Xms512m -Xmx1024m -XX:MaxPermSize=64m -verbose:gc -Dprogram.name=run.sh -classpath /apps/jboss/bin/run.jar:/usr/java/j2sdk1.4.2_05/lib/tools.jar org.jboss.Main -c NIK
jboss 8571 8492 0 14:40 pts/1 00:00:00 /usr/java/j2sdk1.4.2_05/bin/java -Xms512m -Xmx1024m -XX:MaxPermSize=64m -verbose:gc -Dprogram.name=run.sh -classpath /apps/jboss/bin/run.jar:/usr/java/j2sdk1.4.2_05/lib/tools.jar org.jboss.Main -c NIK
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3995723#3995723
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3995723
19 years, 4 months