[JBoss Messaging] - Re: XA datasource with JBM problem
by perisb
I am on 4.0.2
Here is the Interceptor:
package test;
import org.jboss.invocation.Invocation;
import org.jboss.ejb.Interceptor;
import org.jboss.ejb.Container;
import org.jboss.ejb.EntityContainer;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.jms.*;
import javax.ejb.EJBObject;
import javax.transaction.TransactionManager;
import java.lang.reflect.Method;
import java.util.Arrays;
public
class TestInterceptor implements Interceptor {
public
void setNext(Interceptor next) {
this.next = next;
}
public
Interceptor getNext() {
return next;
}
public
void setContainer(Container container) {
this.container = (EntityContainer)container;
}
public
void create() throws Exception {
name = container.getBeanMetaData().getEjbName();
if (!name.equals("Foo")) // only operate on entity Foo
return;
Context ctx = new InitialContext();
QueueConnectionFactory qcf = (QueueConnectionFactory)ctx.lookup("java:/JmsXA");
conn = qcf.createQueueConnection();
queue = (Queue)ctx.lookup("queue/DDSListenerQ");
session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
conn.start();
}
public
Object invokeHome(Invocation invocation) throws Exception {
Object returnValue = getNext().invokeHome(invocation);
return returnValue;
}
public
Object invoke(Invocation invocation) throws Exception {
Object returnValue = getNext().invoke(invocation);
if (!name.equals("Foo"))
return returnValue;
Method method = invocation.getMethod();
if (method != null) {
String mname = method.getName();
if (mname.startsWith("set")) {
QueueSender sender = session.createSender(queue);
TextMessage tm = session.createTextMessage(invocation.getId()+",mname.substring(3),"+invocation.getArguments()[0]);
sender.send(tm);
sender.close();
}
}
return returnValue;
}
public
void start() throws Exception {
}
public
void stop() {
}
public
void destroy() {
//session.close();
//conn.close();
}
private Interceptor next;
private EntityContainer container;
private String name;
private QueueConnection conn;
private QueueSession session;
private Queue queue;
}
Here is the remote client test driver snippet: (there is an EJB wrapper framework in place; the Context object wraps UserTransaction, FooHomeRemote, etc.)
Context ctx = ContextRemoteImpl.instance();
ctx.begin();
Foo foo = ctx.FooFactory().findByOID(333l);
foo.setBar("Bat");
ctx.rollback();
Finally, here is an MDB that listens to the Queue, and receives a message, even though the client rolls back:
package test;
import javax.ejb.MessageDrivenBean;
import javax.ejb.MessageDrivenContext;
import javax.ejb.EJBException;
import javax.jms.MessageListener;
import javax.jms.Message;
public
class TestMDBImpl implements MessageDrivenBean, MessageListener {
public
void ejbCreate() {
}
public
void setMessageDrivenContext(MessageDrivenContext mdc) {
}
public
void onMessage(Message message) {
System.err.println("GOT MESSAGE:"+message);
}
public
void ejbRemove() throws EJBException {\
}
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4171330#4171330
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4171330
17 years, 10 months
[JBossWS] - Re: Providing your own wsdl instead of the generated one.
by JBossWS_NewBee
Yes, I do..I updated the wsrunclient.bat script to include all the relevant jars:
Here's the list of jars:
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/jboss-xml-binding.jar
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/activation.jar
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/javassist.jar
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/getopt.jar
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/jaxb-api.jar
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/jaxb-impl.jar
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/jbossall-client.jar
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/stax-api.jar
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/wstx.jar
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/jboss-j2ee.jar
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/jboss-saaj.jar
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/jboss-jaxws.jar
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/jboss-jaxrpc.jar
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/jbossws-client.jar
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/log4j.jar
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/mail.jar
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/wsdl4j.jar
Here's the EchoClient class:
| package echo;
|
| public class EchoClient {
|
| /**
| * @param args
| */
| public static void main(String[] args) {
| if (args.length != 1) {
| System.err.println("usage: EchoClient <message>");
| System.exit(1);
| }
| EchoService service = new EchoService();
| Echo echo = service.getEchoPort();
| System.out.println("Server said: " + echo.echo(args[0]));
| }
|
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4171325#4171325
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4171325
17 years, 10 months
[Installation, Configuration & DEPLOYMENT] - NoClassDefFoundError and ClassNotFoundException errors durin
by naguilar
I have an application that I'm trying to deploy to JBossAS 4.2.3, but can't because I keep getting both java.lang.NoClassDefFoundError and java.lang.ClassNotFoundException. Please note that this application was previously deployed on JBoss 3.2.8 without any problems.
My application is organized as follows:
The EAR file contains the EJB's and some utility classes that are packaged in a jar file (i.e. utility.jar) under the \lib folder.
My WAR file is being deployed outside of the EAR file, but it references some of the utility classes found in the utility.jar file that is packaged in the EAR and it does not contain the utility.jar in its WEB-INF\lib folder.
I've read the JBoss Wiki on the ClassLoaderConfiguration and it seems that JBoss 4.2.3 has the concept a scoped class loader while JBoss 3.2.8 had a shared class loader. I looked ear-deployer.xml file and the isolation levels seem to be turned off, which I assume means that its using a shared class loader. Here is what I have in my JBoss 4.2.3 ear-deployer.xml:
false
false
true
I also checked all my jboss-service.xml and jboss-web.xml file and I had no references to the <loader-repository> tags, except in the console-mgr-.sar\META-INF\jboss-service.xml file.
Is there any other way to make my server instance use a shared class loader or is there anything else I can check or change to resolve this?
Any help is greatly appreciated.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4171321#4171321
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4171321
17 years, 10 months