[JBoss Cache] - OptionalDataException when retrieving cached session
by Dan Kane
Dan Kane [http://community.jboss.org/people/kanedk] created the discussion
"OptionalDataException when retrieving cached session"
To view the discussion, visit: http://community.jboss.org/message/591755#591755
--------------------------------------------------------------
JBoss AS 4.2.2, JBoss Cache 1.4.1sp5
My appserver uses DB2 as a backend for JBoss Cache to persist sessions. I can kill the appserver, restart it and continue my session just fine - proving that it is storing and retrieving the session correctly.
However, I would like to write a standalone java app that accesses the session data in the JBOSSCACHE table, to inspect/verify it.
I can use a JDBCCacheLoader to connect to the DB. I create a Fqn and can use it to iterate through its children (the session records). I can even retrieve the byte[] that is supposedly the serialized form of the session object.
However, when I try to use an ObjectInputStream to readObject(), I always get an OptionalDataException, which makes no sense.
Code snippet:
http://community.jboss.org/message/591755#591755 OptionalDataException when retrieving cached session
JDBCCacheLoader cl = new JDBCCacheLoader();
Properties props = new Properties();
props.setProperty("cache.jdbc.driver", "com.ibm.db2.jcc.DB2Driver");
props.setProperty("cache.jdbc.url", "jdbc:db2:-//host.domain.com");
props.setProperty("cache.jdbc.user", "username");
props.setProperty("cache.jdbc.password", "password");
cl.setConfig(props);
try
{
cl.create();
String[] path = new String[] { "JSESSION", "localhost", "ROOT" };
Fqn root = new Fqn(path);
Set children = cl.getChildrenNames(root);
int count = 5;
for (Object c : children)
{
if (count == 0)
{
break;
}
count--;
if (c instanceof String)
{
String cStr = root.toString() +"/"+ (String)c;
Map m = cl.get(Fqn.fromString(cStr));
Object obj = m.get(c);
if (obj != null)
{
InputStream is = new ByteArrayInputStream((byte[])obj);
try
{
ObjectInputStream ois = new ObjectInputStream(is);
Object sess = ois.readObject(); // ***OptionalDataException***
sess.hashCode();
}
catch (Exception ex)
{
//...
}
}
else
{
//...
}
}
}
}
catch (Exception ex)
{
Logger.getLogger(MainFrame.class.getName()).log(Level.ERROR, null, ex);
}
/code /code
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/591755#591755]
Start a new discussion in JBoss Cache at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years, 1 month
[JBoss Cache] - Replication not happening. Using wrong cache?
by jaysmith
jaysmith [http://community.jboss.org/people/jaysmith] created the discussion
"Replication not happening. Using wrong cache?"
To view the discussion, visit: http://community.jboss.org/message/591698#591698
--------------------------------------------------------------
Hi there,
apologies if this seems a noob question or has been answered a lot of times already but concise information is tough enough to come by.
we have a JBoss 3.2 cache set up on our cluster that contains 2 WebLogic 10.3 managed servers with replication enabled and I've noticed that simple name/value pairs seem to be replicated in the cache just fine but TO objects, even ones with 5 or so String member variables are not.
The cache we're using is a plain TreeCache and I'm wondering if the TO objects aren't replicating because the TreeCache isn't designed to and I should be using PojoCache instead?
With that in mind, I'm looking at ways to speed up an application I have and want to use HashMaps to store database reference data (that doesn't change) to do the lookups in the Java code instead of firing more SQL off to the database servers. I could use a singleton and HashMaps in the Java code but I'd like to move the lookup data into a cache outside of the app. Would a PojoCache be the suitable cache type for a HashMap? Is the memory overhead too much overkill just to store some reference data?
Thanks in advance for any replies
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/591698#591698]
Start a new discussion in JBoss Cache at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years, 1 month
[JBoss Web Services] - Editing an outbound soap message
by Branislav Milojkovic
Branislav Milojkovic [http://community.jboss.org/people/crazypenguin] created the discussion
"Editing an outbound soap message"
To view the discussion, visit: http://community.jboss.org/message/589872#589872
--------------------------------------------------------------
Hi all,
I have a need to intercept an outbound SOAPMessage and add some info to it (used to sign the request).
I am using JBoss version 4.2.3. I get the following exception
...
Caused by: org.jboss.util.NotImplementedException: setTextContent
at org.jboss.ws.core.soap.NodeImpl.setTextContent(NodeImpl.java:652)
...
When invoking the second line from this piece of code:
...
Element element = node.getOwnerDocument().createElement(elementName);
element.setTextContent(elementText);
node.appendChild(element);
...
Now, if i do this in a non-ejb project, the SOAPMessage instance is one from appache-commons and that works fine, since tracking down the node I need leads me to appache implementation of the Node interface, which happens to have the setTextContent method not throw an exception. :)
Now, two solutions that come to my mind is
1) There is another way to modify an outbound SOAPMessage that I am not aware of (*crosses fingers*)
2) Somehow disable SOAP handling from JBoss, which will hopefully result in appache handling it.
Ideas? Hope I'm not giving too few details, I just don't want this message to be any longer than it needs to. (:
Kind regards,
Branislav.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/589872#589872]
Start a new discussion in JBoss Web Services at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years, 1 month
[JBoss Web Services] - Jboss 6.0 WebService (Saaj) Client with SLL
by Fabiano Oss
Fabiano Oss [http://community.jboss.org/people/fabiano.oss] created the discussion
"Jboss 6.0 WebService (Saaj) Client with SLL"
To view the discussion, visit: http://community.jboss.org/message/591682#591682
--------------------------------------------------------------
Hi,
I'm testing my application in the Jboss 6.0.0.Final. This application, actualy works on jboss 4.2.3. The application call a web service with SSL, using this way:
System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");
System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
System.setProperty("https.proxySet", "true");
System.setProperty("https.proxyHost", "proxy's ip");
System.setProperty("https.proxyPort", "proxy's port");
Authenticator.setDefault(new ProxyAuthenticator("proxy's user", "proxy's password"));
System.setProperty("javax.net.ssl.trustStoreType", "JKS");
System.setProperty("javax.net.ssl.trustStore", "path of the trust");
System.setProperty("javax.net.ssl.trustStorePassword", "password");
System.setProperty("javax.net.ssl.keyStoreType", "PKCS12");
System.setProperty("javax.net.ssl.keyStore", "path of the .p12 file" );
System.setProperty("javax.net.ssl.keyStorePassword", "password");
....
MessageFactory factory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
....
SOAPConnection con = SOAPConnectionFactory.newInstance().createConnection();
SOAPMessage res = con.call(message, url);
When I execute my application on Jboss 6, the result is: "The page requires a client certificate". But I execute with Jboss 4.2.3 works fine.
How do I fix this?
Thank you.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/591682#591682]
Start a new discussion in JBoss Web Services at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years, 1 month
[JBoss Web Services] - java.lang.ClassCastException: com.sun.xml.messaging.saaj.soap.ver1_1.Envelope1_1Impl cannot be cast to org.jboss.ws.core.soap.SOAPElementImpl
by Anton Gavazuk
Anton Gavazuk [http://community.jboss.org/people/Faraon02] created the discussion
"java.lang.ClassCastException: com.sun.xml.messaging.saaj.soap.ver1_1.Envelope1_1Impl cannot be cast to org.jboss.ws.core.soap.SOAPElementImpl"
To view the discussion, visit: http://community.jboss.org/message/591681#591681
--------------------------------------------------------------
Hi all,
JDK 1.6
my env - JBoss EAP 5.0,
JBoss Web Services - Stack Native Core, v 3.1.2.SP3
I tried to introduce new WS proxy to my application (EAR), generated required artifacts with wsconsume, tested them in standalone mode (no problems) and packaged in the application - and during the call an ws proxy I get error:
Caused by: java.lang.ClassCastException: com.sun.xml.messaging.saaj.soap.ver1_1.Envelope1_1Impl cannot be cast to org.jboss.ws.core.soap.SOAPElementIm
pl
at org.jboss.ws.core.soap.SOAPEnvelopeImpl.<init>(SOAPEnvelopeImpl.java:57)
at org.jboss.ws.core.soap.EnvelopeBuilderDOM.build(EnvelopeBuilderDOM.java:136)
at org.jboss.ws.core.soap.EnvelopeBuilderDOM.build(EnvelopeBuilderDOM.java:96)
at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:294)
at org.jboss.ws.core.soap.SOAPMessageUnMarshallerHTTP.read(SOAPMessageUnMarshallerHTTP.java:82)
at org.jboss.remoting.transport.http.HTTPClientInvoker.readResponse(HTTPClientInvoker.java:584)
at org.jboss.remoting.transport.http.HTTPClientInvoker.useHttpURLConnection(HTTPClientInvoker.java:381)
at org.jboss.remoting.transport.http.HTTPClientInvoker.makeInvocation(HTTPClientInvoker.java:232)
... 90 more
My EAR doesnt contain any packaged jars, the content of my lib/endorsed is that:
activation.jar jaxb-api.jar jbossws-native-jaxws.jar jbossws-native-jaxws-ext.jar jbossws-native-saaj.jar resolver.jar serializer.jar stax-api.jar xalan.jar xercesImpl.jar
For the moment I'm stuck, tried to search and play in different ways, have no idea how to resolve it apart from migrating to another ws lib (Axis...)
Thanks!
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/591681#591681]
Start a new discussion in JBoss Web Services at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years, 1 month