[EJB/JBoss] - java.io.StreamCorruptedException: invalid stream header
by nimrodr
After Jboss was running for several days, we received the following errors several times.
The errors appeared for about 2 minutes and then stopped. After that it seems that all MDB handling was stopped.
There are several variants of the stack trace, I listed an example of each one.
We are using Jboss 3.2.8 SP1 on Linux
00:28:18,448 ERROR [ServerThread] Failed to initialize
java.io.StreamCorruptedException: invalid stream header
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:753)
at java.io.ObjectInputStream.(ObjectInputStream.java:268)
at org.jboss.invocation.pooled.interfaces.OptimizedObjectInputStream.(OptimizedObjectInputStream.java:119)
at org.jboss.invocation.pooled.server.ServerThread.dorun(ServerThread.java:258)
at org.jboss.invocation.pooled.server.ServerThread.run(ServerThread.java:152)
00:28:33,460 ERROR [ServerThread] Failed to initialize
java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2232)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2698)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:750)
at java.io.ObjectInputStream.(ObjectInputStream.java:268)
at org.jboss.invocation.pooled.interfaces.OptimizedObjectInputStream.(OptimizedObjectInputStream.java:119)
at org.jboss.invocation.pooled.server.ServerThread.dorun(ServerThread.java:258)
at org.jboss.invocation.pooled.server.ServerThread.run(ServerThread.java:152)
00:30:08,093 ERROR [ServerThread] Failed to initialize
java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:256)
at java.io.BufferedInputStream.read(BufferedInputStream.java:313)
at java.io.ObjectInputStream$PeekInputStream.read(ObjectInputStream.java:2217)
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2230)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2698)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:750)
at java.io.ObjectInputStream.(ObjectInputStream.java:268)
at org.jboss.invocation.pooled.interfaces.OptimizedObjectInputStream.(OptimizedObjectInputStream.java:119)
at org.jboss.invocation.pooled.server.ServerThread.dorun(ServerThread.java:258)
at org.jboss.invocation.pooled.server.ServerThread.run(ServerThread.java:152)
00:30:29,108 ERROR [ServerThread] Failed to initialize
java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2232)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2698)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:750)
at java.io.ObjectInputStream.(ObjectInputStream.java:268)
at org.jboss.invocation.pooled.interfaces.OptimizedObjectInputStream.(OptimizedObjectInputStream.java:119)
at org.jboss.invocation.pooled.server.ServerThread.dorun(ServerThread.java:258)
at org.jboss.invocation.pooled.server.ServerThread.run(ServerThread.java:152)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4005715#4005715
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4005715
19 years, 3 months
[JBoss Seam] - Re: s:link
by agori
"gavin.king(a)jboss.com" wrote : No, you can't put this stuff in form fields, because there is no form! s:link if for GET requests. These parameters only appear when they are needed. In simple cases, they aren't there at all.
What do you think about using alias names instead of action method encoded in the URL?
<s:link alias="item">Select Item</s:link>
and in some action-association.xml
#{item.selectItem}
or much better a new annotation.
This is also an improvement abuot security (you are not exposing the action method name to the client, but I am not sure what seam actualliy is exposing so I could be wrong).
I did a link component + JSF phase-listener to make work this idea some time ago. The result is that you get prettier URL and maybe good security, but you still have to config the association between alias and action in some XML (but Seam could use an annotation).
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4005714#4005714
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4005714
19 years, 3 months
[Messaging, JMS & JBossMQ] - Re: MDB and connection to a remote queue with transaction
by hoigh
Thanks for the answer. I don't know if the article actually helps. However, I have found my own solution. If you want to send a message in a container managed transaction to a remote destination, the nuts and bolts is to care about the XAConnection, i.e., the usage of XA classes is mandatory.
This is some code exctracted from my application that works fine now:
| public void sendMessage(Message message, String providerUrl, String queueName, String user, String password) {
| Context context = null;
|
| XAQueueConnectionFactory remoteQueueFactoryXA = null;
| XAQueueConnection connectionXA = null;
|
| Queue queue = null;
| QueueSession session = null;
| QueueSender sender = null;
|
| try {
| Properties env = new Properties();
| env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
| env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
| env.put(Context.PROVIDER_URL, providerUrl);
| context = new InitialContext(env);
|
| remoteQueueFactoryXA = (XAQueueConnectionFactory)context.lookup("XAConnectionFactory");
| connectionXA = remoteQueueFactoryXA.createXAQueueConnection(user, password);
| session = connectionXA.createQueueSession(true, -1);
| queue = (Queue)context.lookup(queueName);
| sender = session.createSender(queue);
| sender.send(queue, message);
| }
| catch(Exception excep) {
| ...
| }
| finally {
| if(sender != null) {
| try {
| sender.close();
| } catch(Exception excep) {
| ...
| }
| }
| if(session != null) {
| try {
| session.close();
| } catch(Exception excep) {
| ...
| }
| }
| if(connectionXA != null) {
| try {
| connectionXA.close();
| } catch(Exception excep) {
| ...
| }
| }
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4005708#4005708
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4005708
19 years, 3 months
[EJB 3.0] - Re: RuntimeExceptions caught, wrapped in EJBException
by jc7442
For me it looks like this:
| package fr.toto.interceptor;
|
| import java.lang.reflect.Method;
| import java.lang.reflect.UndeclaredThrowableException;
| import java.util.logging.Level;
| import java.util.logging.Logger;
|
| import org.jboss.aop.advice.Interceptor;
| import org.jboss.aop.joinpoint.Invocation;
| import org.jboss.aop.joinpoint.MethodInvocation;
|
| /**
| * Interceptor in charge to log unexpected exception.
| *
| * @author jean-cedricwalmetz
| *
| */
| public class ExceptionHanlderInterceptor implements Interceptor {
| /**
| * Version number
| */
| private final Logger LOGGER = Logger
| .getLogger(ExceptionHanlderInterceptor.class.getName());
|
| /**
| * Log unexpected exception and thows an UndeclaredThrowableException
| */
| public Object invoke(Invocation invocation) throws Throwable {
| try {
| return invocation.invokeNext();
| } catch (Throwable t) {
| MethodInvocation methodInvocation = (MethodInvocation) invocation;
| Method m = methodInvocation.getMethod();
| Class<?>[] exceptions = m.getExceptionTypes();
| // Exception is an EJBException.
| Class<?> clazz = (t.getCause() == null ? t.getClass() : t.getCause()
| .getClass());// /*.getCause()*/.getClass();
| for (Class<?> c : exceptions) {
| if (c.isAssignableFrom(clazz)) {
| throw t;
| }
| }
| long time = System.currentTimeMillis();
| LOGGER.log(Level.SEVERE, "Unexpected exception " + time + ":", t);
| // UndeclaredThrowableException is not perfect since I need to
| // provide null as parameter to the constructor. But excpetion
| // thrown has to be a runtime and must be in classpath on client
| // side.
| Throwable newException = new UndeclaredThrowableException(null,
| "Chained exception has been logged on server with reference " + time
| + " !\nMessage was " + t.getMessage());
| throw newException;
| }
| }
|
| /**
| * Return the name of the interceptor
| */
| public String getName() {
| return ExceptionHanlderInterceptor.class.getName();
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4005704#4005704
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4005704
19 years, 3 months