ClassCastException in RTCModel.java
Hi,
I found a problem in the RTCModel class. When I call fetchItems(room, "default_SimpleChat", "history") to obtain the chat history, the RTCModel fails with an exception:
ClassCastException: Cannot cast java.lang.Double (id=3330) to java.lang.String
The problem is located in the addItem function within the Node inner class:
public void addItem(Map<String, Object> data)
String itemID = (String) data.get("itemID");
if (itemID == null)
itemID = "item";
items.put(itemID, new Item(data));
The String cast isn't checked and the itemId contains a Double 0.0.
The data returned by the service is:
[default_SimpleChat={
nodes={
history={
items={
0.0={publisherID=EXT-MYACCOUNT-3499,
body={color=0.0, role=10.0, displayName=Test User, msg=test1},
itemID=0.0,
timeStamp=1.282144187104E12,
associatedUserID=EXT-MYACCOUNT-3499,
nodeName=history,
collectionName=default_SimpleChat},
1.0={publisherID=EXT-MYACCOUNT-3499,
body={color=0.0, role=10.0, displayName=Test User, msg=test2},
itemID=1.0,
timeStamp=1.282144188111E12,
associatedUserID=EXT-MYACCOUNT-3499,
nodeName=history,
collectionName=default_SimpleChat}
To fix the problem, I changed the get to:
String itemID = String.valueOf(data.get("itemID"));
Does that make sense?
Thanks!
Thanks! We'll integrate your fix for next version.
Sent from my iPad
Similar Messages
-
Java.lang.ClassCastException in WebDynpro Java
Hi,
I am new to Adobe Interactive Forms.
I made the visual admin settings and binded both contexts (pdfsource and datasource).
But when i deploy the application i get an error.
java.lang.ClassCastException
at com.sap.tc.webdynpro.clientserver.uielib.adobe.impl.InteractiveForm.modifyDataType(InteractiveForm.java:861)
at com.sap.tc.webdynpro.clientserver.uielib.adobe.impl.InteractiveForm.afterHandleActionEvent(InteractiveForm.java:347)
at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.afterApplicationModification(ClientApplication.java:1132)
at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.afterApplicationModification(ClientComponent.java:887)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doRespond(WindowPhaseModel.java:573)
... 26 morehi,
This is the error if i bind it to a binary variable
com.sap.tc.webdynpro.services.exceptions.PDFDocumentCreationException: ../../local/interactiveforms/App_test/~wd_key0_1207308638688/Error+PDF.pdf;jsessionid=(J2EE3598700)ID1354246350DB01492923852963931389End;saplb_*=(J2EE3598700)3598750?sap-wd-download=1&sap-wd-dl_behaviour=1&sap-wd-cltwndid=8c066151023a11ddb5b8001a4dd89852&sap-wd-appwndid=8c066152023a11dd8709001a4dd89852&sap-wd-norefresh=X
at com.sap.tc.webdynpro.clientserver.uielib.adobe.impl.InteractiveForm.afterHandleActionEvent(InteractiveForm.java:383)
at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.afterApplicationModification(ClientApplication.java:1132)
at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.afterApplicationModification(ClientComponent.java:887)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doRespond(WindowPhaseModel.java:573)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:152)
... 25 more -
ClassCastException in Connector.java code
Hi All,
I understand what ClassCastException is. This is the code from one of the CLDC API's provided (Connector.java) which causes the exception :-
public static DataInputStream openDataInputStream(String name)
throws IOException {
InputConnection con =
(InputConnection)Connector.open(name, Connector.READ);
try {
return con.openDataInputStream();
} finally {
con.close();
Connector.open() is supposed to return a new Connection object. I am trying to cast it to Inputconnection which is a subinterface of Connection. With this error I am unable to create any network connection. The name string I am providing is "datagram://1.9.67.1:32767". When I printed the object returned by Connector.open(), I found this :-
com.sun.cldc.io.j2me.datagram.Protocol@1a4cfaaa
This does not appear to be the same as javax.microedition.io.Connection (which is an interface anyway). datagram.Protocol implements DatagramConnection.
Now can anyone help as to how to fix this problem? Or just show me sample code to open a simple datagram connection (UDP) and associate with InputStream object.
Thanks,
SM.I figured out what the problem is. InputStream can only be associated with a StreamConnection. That is possible only with "socket" protocol. So to use "datagram" protocol and also associate it with InputStream object, an intermediate layer has to be written which is not provided by CLDC API.
Cheers,
SM. -
ClassCastException while calling Java based Sca Service by another one
When a java based sca service is called by another java based sca service and the return
value of the service method is complex type there is allways a ClassCastException like the
following thrown:
weblogic.sca.api.ScaException: java.lang.ClassCastException: de.a.b.c.TransferObj cannot be cast to de.a.b.c.TransferObj
at weblogic.sca.engine.WlsScaService.handleServiceException(WlsScaService.java:145)
at weblogic.sca.engine.WlsScaService.invokeTargetBeanMethod(WlsScaService.java:132)
Same Soa Suite at the same server.
Even if the return type is not used by the lets say "serviceB" and so the type has not to be known
by the "serviceB" like this.
serviceA.anyMethod();
Anyone an idea?
Further findings: Meanwhile we found out that this only happens for local calls. But the decision
to use a remote or a local call is container managed and one of the main benefits of Sca. For remote
calls everything is working fine. A work around solution is to use a Mediator. But by the performance
point of view this is an overkill.
Is there nobody who has the ability to help us? Here quasi at the root?
Edited by: 794126 on 17.09.2010 07:06Delegate definition:
public xyz[] getCount(String accessType,long orgId,Date fromDate,Date toDate)
return lmsServiceImpl.getCount(accessType,orgId,fromDate,toDate);
Calling code in client:
xyz[] so = lmsDel.getCount("group",l,calendar,calendar);
Do i need to add anything to the wsdd file for the xyz bean type?? -
ClassCastException for java.lang.Integer in JSF
Hi,
I am a newbie, i am working on adding 2 numbers in jsf.
Where i have a addNumber.jsp:-
Number1:<h:inputText value"#{AddBean.num1)}"/>
Number2:<h:inputText value"#{AddBean.num2)}"/>
<h:commandButton value="Add" action="#{AddBean.sum}"/>
In AddBean.java
I have getters and setters for num1 & num2 property whose datatype is int.
public int sum(){
System.out.println("Inside sum");
return (num1+num2);
Here when i click the Add button the sum() is fired where it is printing "Inside sum" after that i am getting a "ClassCastException saying that java.lang.Integer". Which means i can only use Integer object for calculation rather than using primitive datatype(int)?
What is the problem here? Pls. do explain?
ThanksThe action method should be declared void or return a String. It is to be used for the navigation-case entries in the faces-config.xml. If you want a postback to the same page, just declare it void. It should not return the intented "result" of the action. Store the result somewhere as a bean property.
The following example should work:<h:form>
<h:inputText value="#{addBean.number1}" />
<h:inputText value="#{addBean.number2}" />
<h:commandButton value="Add" action="#{addBean.sum}" />
<h:outputText value="#{addBean.result}" />
</h:form>AddBeanprivate int number1; // + getter + setter
private int number2; // + getter + setter
private int result; // + getter only
public void sum() {
result = number1 + number2;
}And I'd rather to use Integer instead of int, but that's more a design choice. -
Does the Number type in Oracle always map to the Java BigDecimal object
We have noticed that whenever we create a column in a table of type smallint, integer, real, etc. that the type in sqlplus always shows up as number(x). Our problem is that this type always seems to map to java.math.BigDecimal through JDBC. Is this a bug in the JDBC drivers???
Put another way when I create a column of type smallint I expect that after performing a query I should be able to call the getShort method on the result set in order to get the value from the afore mentioned column. But instead I get a ClassCastException because the Java type for the column is actually a java.math.BigDecimal.
Thanks,
Keith
[email protected]<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Keith Nielsen:
We have noticed that whenever we create a column in a table of type smallint, integer, real, etc. that the type in sqlplus always shows up as number(x). Our problem is that this type always seems to map to java.math.BigDecimal through JDBC. Is this a bug in the JDBC drivers???
Put another way when I create a column of type smallint I expect that after performing a query I should be able to call the getShort method on the result set in order to get the value from the afore mentioned column. But instead I get a ClassCastException because the Java type for the column is actually a java.math.BigDecimal.
Thanks,
Keith
[email protected]<HR></BLOCKQUOTE>
~~~
The possible Java types to which SQL NUMBER type can be materialized to include
oracle.sql.NUMBER
java.lang.Byte
java.lang.Short
java.lang.Integer
java.lang.Long
java.lang.Float
java.lang.Double
java.math.BigDecimal
byte,short, int, long, float, double
For a complete listing for all datatypes mappings refer the Oracle8i JDBC Developer's guide and reference. -
Getting ClassCastException if the QueryResultsCachePolicy is set
hi,
the code down below is executed without any problem if the line:
query.setQueryResultsCachePolicy(....)
is commented out.
ReadAllQuery query = new ReadAllQuery(exampleObject.getClass());
query.useMapClass(TreeMap.class, propertyName);
query.setExampleObject(exampleObject);
query.setQueryByExamplePolicy(policy);
==> query.setQueryResultsCachePolicy(new QueryResultsCachePolicy(new TimeToLiveCacheInvalidationPolicy(60000)));
TreeMap<Serializable, T> result = (TreeMap<Serializable, T>) persistence.getSession().executeQuery(query);
return result;
Uncommenting the same line result ClassCastException:
Caused by: java.lang.ClassCastException: java.util.TreeMap
at oracle.toplink.queryframework.ReadAllQuery.cacheResult(ReadAllQuery.java:213)
at oracle.toplink.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:441)
at oracle.toplink.internal.descriptors.ObjectBuilder.buildObjectsInto(ObjectBuilder.java:746)
at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.buildObjectsFromRows(DatabaseQueryMechanism.java:170)
at oracle.toplink.queryframework.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:477)
at oracle.toplink.queryframework.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:874)
at oracle.toplink.queryframework.DatabaseQuery.execute(DatabaseQuery.java:671)
at oracle.toplink.queryframework.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:835)
at oracle.toplink.queryframework.ReadAllQuery.execute(ReadAllQuery.java:445)
at oracle.toplink.internal.sessions.AbstractSession.internalExecuteQuery(AbstractSession.java:2293)
at oracle.toplink.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1107)
at oracle.toplink.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1091)
at oracle.toplink.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1050)
I'm using:
TopLink, version: Oracle TopLink - 11g Technology Preview 3 (11.1.1.0.0) (Build 071214)
Could you please tell me what I'm doing wrong
reagrds,Nope, they are free to do a factory restore, sorry :/
Also most thieves are very clever so will easily find a way around the passcode or will find some way of getting access to the phone. -
ClassCastException at DataSouces?!
Hi everybody
I'm trying to make a JBoss Datasource (mssql)
this is the configuration file:
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>mssqlDS</jndi-name>
<connection-url>jdbc:microsoft:sqlserver://localhost:1433;Database=teste;selectMethod=cursor</connection-url>
<driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-class>
<user-name>sa</user-name>
<password></password>
<min-pool-size>5</min-pool-size>
<max-pool-size>20</max-pool-size>
<use-java-context>false</use-java-context>
<idle-timeout-minutes>0</idle-timeout-minutes>
<track-statements/>
</local-tx-datasource>
</datasources>And this is my program to access this DataSource:
public static void main(String[] args) throws Exception {
Properties pt = new Properties();
//pt.put( Context.INITIAL_CONTEXT_FACTORY, "com.sun.enterprise.naming.SerialInitContextFactory" );
pt.put( Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory" );
pt.put( Context.PROVIDER_URL, "localhost" );
Context tx = new InitialContext( pt );
javax.sql.DataSource ds = ( javax.sql.DataSource ) tx.lookup( "mssqlDS" ); //ClassCastException here!
java.sql.Connection con = ds.getConnection();
System.out.println( "Ya?!" ); LOL I don't undestand why this line throws a ClassCastException
If I print the object (without cast to datasource) it prints:
Reference Class Name: javax.sql.DataSource
Address Type: ProxyData
AddressContents: ffffffac ffffffed 0 5 73 7d 0 0 0 1 0 14 6a 61 76 61 78 2e 73 71 6c 2e 44 61 74 61 53 6f 75 72 63 65 ...
Address Type: VMID
AddressContents: ffffffac ffffffed 0 5 73 72 0 13 6a 61 76 61 2e 72 6d 69 2e 73 65 72 76 65 72 2e 55 49 44 f 12 70 d ffffffbf ...
Type: JndiName
Content: mssqlDS
I really don't know what to do
plz, somebody help me =[Hello!
about your questions:
1- jasrs (like drivers and jboss-j2ee, jboss-comon-client, jnp-client) are already in project Classpath (in eclipse), ops, the drivers are in "lib" of server's folder, but I think, javax.sql.DataSource are from default package (rt.jar) and not for jboss-j2ee.jar (it have a javax.sql.DataSource class too with other methods)
I'm trying to invoke the jboss datasource but I think I cannot get't.
2- provider url is correct I think, if I put a port number (like "localhost:1099") it throw the same error and if I put port number like :1098 it does nothing -
Exception in thread "main" java.lang.ClassCastException: Card
at java.util.Arrays.mergeSort(Arrays.java:1044)
at java.util.Arrays.sort(Arrays.java:997)
at CardPlayer.sortHand(CardPlayer.java:91)
at Game.main(Game.java:75)
i get this error message after I call a sort method using the java.util.Array
does anyone know why, or do u need more code?
thanksThe Card object needs to implement the Comparable interface if an array of them is to be sorted. The ClassCastException occurs when the sorting code attempts to assign a Card Object to a Comparable variable. The API documentation refers to this problem like this:
Throws:
ClassCastException - if the array contains elements that are not mutually comparable (for example, strings and integers). -
J2SDK 1.3 on Linux RH 7.1
Hi... does anyone can give a hand installing J2SDK 1.3. on Linux RH 7.1?
I've already installed Java using the rpm file and it seems to have no problems...
everything looks fine...I've got no error messages...
but when I try to run: java -version
there is not answer!..just nothing!
this is the second installation and I don't know what else to do...
what I'm missing?
I hope anyone can help me!
Thanks in advance!
ciao!
JC.i got the same problem too.
not only is there no output from java -version, but also the command hangs there, never exits.
the following is the output of java -verbose
[Opened /usr/java/jdk1.3/jre/lib/rt.jar]
[Opened /usr/java/jdk1.3/jre/lib/i18n.jar]
[Opened /usr/java/jdk1.3/jre/lib/sunrsasign.jar]
[Loaded java.lang.Object from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.io.Serializable from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.Comparable from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.String from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.Class from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.Cloneable from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.ClassLoader from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.Throwable from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.Error from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.ThreadDeath from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.Exception from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.RuntimeException from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.security.ProtectionDomain from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.security.AccessControlContext from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.ClassNotFoundException from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.LinkageError from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.NoClassDefFoundError from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.ClassCastException from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.ArrayStoreException from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.VirtualMachineError from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.OutOfMemoryError from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.StackOverflowError from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.ref.Reference from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.ref.SoftReference from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.ref.WeakReference from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.ref.FinalReference from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.ref.PhantomReference from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.ref.Finalizer from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.Runnable from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.Thread from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.ThreadGroup from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.util.Dictionary from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.util.Map from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.util.Hashtable from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.util.Properties from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.reflect.AccessibleObject from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.reflect.Member from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.reflect.Method from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.reflect.Constructor from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.util.Collection from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.util.AbstractCollection from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.util.List from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.util.AbstractList from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.util.Vector from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.StringBuffer from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.Boolean from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.Character from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.Number from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.Float from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.Double from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.Byte from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.Short from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.Integer from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.Long from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.NullPointerException from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.ArithmeticException from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.Shutdown from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.StrictMath from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.io.ObjectStreamField from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.util.Comparator from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.String$CaseInsensitiveComparator from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.System from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.security.AccessController from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.util.Collections from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.util.Random from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.util.Set from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.util.AbstractSet from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.util.Collections$EmptySet from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.util.Collections$EmptyList from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.util.AbstractMap from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.util.Collections$EmptyMap from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.util.Collections$ReverseComparator from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.ThreadLocal from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.InheritableThreadLocal from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.security.Guard from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.security.Permission from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.security.BasicPermission from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.reflect.ReflectPermission from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.ref.Reference$Lock from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.ref.Reference$ReferenceHandler from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.ref.ReferenceQueue from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.ref.ReferenceQueue$Null from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.ref.ReferenceQueue$Lock from /usr/java/jdk1.3/jre/lib/rt.jar]
[Loaded java.lang.ref.Finalizer$FinalizerThread from /usr/java/jdk1.3/jre/lib/rt.jar]
then the output stops, and the command hangs here. -
How to get remote ejb client working with Weblogic 8.1?
I have Weblogic 8.1 running on a WinXP box behind my firewall. Port 7001 is open to WL and remote browsers can access the console.
I have a client machine running WinXP on a different network that is remote to the WL server. It can ping the WL server machine.
I use JVM 1.4.2_08 on all machines.
If I put my client machine on the LAN with the WL server, then my EJB test client works fine. If I put the client machine on the remote network then the test client fails with a ClassCastException when trying to do a PortableRemoteObject.narrow on the bean home.
I had this running fine on JBoss 3.22 using RMI over HTTP. I added an HTTP invoker service to my jboss.xml file. I don't know if something similar is needed on the Weblogic side - any ideas on that? All I've done on the WL side is turn on Tunneling - which obviously works because the remote client gets a correct home object when doing a lookup on the bean - based on the IOR string of the home obj.
Below I include my client code, exception, ejb-jar.xml and my weblogic-ejb-jar.xml.
Any ideas on what else needs to be done so that a remote client can do a PortableRemoteObject.narrow? My client.jar has all of the EJB classes, and runs fine when run from LAN.
Thanks,
--BobC
Client Code
Properties p = new Properties();
p.put("java.naming.factory.initial", "weblogic.jndi.WLInitialContextFactory");
p.put("java.naming.provider.url", "http://66.114.140.213:7001");
InitialContext ic = new InitialContext(p);
// Test register bean
Object homeObj = ic.lookup("tacplanner/register");
RegisterHome home = (RegisterHome) PortableRemoteObject.narrow(homeObj, RegisterHome.class); // <<< ClassCastException here
Exception
java.lang.ClassCastException
at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:293)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
at com.nimblus.tacplanner.test.TestUtils.<init>(TestUtils.java:60)
at com.nimblus.tacplanner.test.TestUtils.main(TestUtils.java:196)
ejb-jar.xml
<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN' 'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>
<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>register</ejb-name>
<home> com.nimblus.tacplanner.server.ejb.stateless.RegisterHome</home>
<remote> com.nimblus.tacplanner.server.ejb.stateless.Register</remote>
<ejb-class>com.nimblus.tacplanner.server.ejb.stateless.RegisterSession</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<resource-ref>
<description>The Oracle Datasource</description>
<res-ref-name>java:/OracleDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</session>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>register</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</ejb-jar>
weblogic-ejb-jar.xml
<?xml version="1.0"?>
<!DOCTYPE weblogic-ejb-jar PUBLIC
'-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB//EN'
'http://www.bea.com/servers/wls810/dtd/weblogic-ejb-jar.dtd'>
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>register</ejb-name>
<stateless-session-descriptor>
<pool>
<max-beans-in-free-pool>100</max-beans-in-free-pool>
</pool>
</stateless-session-descriptor>
<reference-descriptor>
<resource-description>
<res-ref-name>jdbc/OracleDS</res-ref-name>
<jndi-name>OracleDS</jndi-name>
</resource-description>
</reference-descriptor>
<enable-call-by-reference>True</enable-call-by-reference>
<jndi-name>tacplanner/register</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
--------------------Problem solved.
For remote clients you need to generate and use the stub classes for EJB interfaces using Weblogic's appc utility.
See: "http://e-docs.bea.com/wls/docs81/ejb/appc_ejbc.html#1151900"
--BobC -
Weblogic Startup not properly: ConfigurationException
Hello, i hope someone can help me. i suppose it is a kind of newbie question, cause
thats what i am, a newbie in weblogic. The server throws the following error when
starting up with my specific project, maybe someone knows what it means: (Thanx
in advance!)
The WebLogic Server did not start up properly.
Exception raised: 'weblogic.management.configuration.ConfigurationException:
with nested exception:
[java.lang.ClassCastException]'
Reason: weblogic.management.configuration.ConfigurationException: - with nested
exception:
[java.lang.ClassCastException]pravalika wrote:
java.io.InvalidClassException: javax.management.MBeanAttributeInfo; local class incompatible: stream classdesc serialVersionUID = 7043855487133450673, local class serialVersionUID = 8644704819898565848]][http://www.google.com/search?q=%22java.io.InvalidClassException%3A+javax.management.MBeanAttributeInfo%3B+local+class+incompatible%22]
Look like you're not the only one who encountered this specific problem. There are several solutions mentioned, under each downgrading to Java SE 1.4 or upgrading to Weblogic 9. -
Help, please.
I'm running WebLogic 5.1.0, sp3 on NT.
I haven't tried all the examples, but the beanmanaged client and the ListAll
class seem to work fine.
The problem is with my own client program that is VERY similar to the
ListAll, i.e. it does a listBindings("") and then walks through an
enumeration of Bindings, printing a few details.
ListAll works fine, but mine fails on the first nextElement() call with this
exception:
weblogic.rmi.extensions.RemoteRuntimeException
and this msg:
Undeclared checked exception
Not much help, nothing interesting in the log...so what does it mean?
Thanks,
Rod Burgett
webMethods, Inc.Thank you, I think this is a step in the right direction...the nested
exception is weblogic.rjvm.PeerGoneException; no message.
Does this mean that somewhere between my calls to
NamingEnumeration.hasMoreElements() and NamingEnumeration.nextElement() that
some peer disappears?
It would appear that a ClassCastException is buried in here somewhere as
well:
MyConnection.collectBindingElements - Oops, RemoteRuntimeException contained
this: type(weblogic.rjvm.PeerGoneException), msg()
java.lang.ClassCastException
at
weblogic.utils.classloaders.GenericClassLoader.reallyLoadClass(GenericClassL
oader.java, Compiled Code)
at
weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.
java:172)
at
weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.
java:146)
at weblogic.rjvm.MsgAbbrev.read(MsgAbbrev.java, Compiled Code)
at
weblogic.socket.JVMAbbrevSocket.readMsgAbbrevs(JVMAbbrevSocket.java:505)
at
weblogic.rjvm.MsgAbbrevInputStream.prime(MsgAbbrevInputStream.java:134)
at weblogic.rjvm.RJVMImpl.dispatch(RJVMImpl.java:610)
at
weblogic.rjvm.ConnectionManagerClient.handleRJVM(ConnectionManagerClient.jav
a:34)
at
weblogic.rjvm.ConnectionManager.dispatch(ConnectionManager.java:630)
at
weblogic.socket.JVMAbbrevSocket.dispatch(JVMAbbrevSocket.java:393)
at weblogic.socket.JVMSocketT3.dispatch(JVMSocketT3.java, Compiled
Code)
at
weblogic.socket.JavaSocketMuxer.processSockets(JavaSocketMuxer.java,Compiled
Code)
at
weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:23)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
Code)
--------------- nested within: ------------------
weblogic.rjvm.PeerGoneException:
- with nested exception:
[java.lang.ClassCastException]
at
weblogic.rmi.extensions.AbstractRequest.sendReceive(AbstractRequest.java:76)
at
weblogic.utils.enumerations.BatchingEnumerationBase_WLStub.nextBatch(Batchin
gEnumerationBase_WLStub.java:141)
at
weblogic.utils.enumerations.BatchingEnumerationStub.nextBatch(BatchingEnumer
ationStub.java:87)
at
weblogic.jndi.toolkit.NamingEnumerationStub.nextBatch(NamingEnumerationStub.
java:71)
at
weblogic.utils.enumerations.BatchingEnumerationStub.nextElement(BatchingEnum
erationStub.java:81)
at
com.wm.pkg.ejbim.MyConnection.collectBindingElements(MyConnection.java,
Compiled Code)
at
com.wm.pkg.ejbim.MyConnection.collectBindingElements(MyConnection.java,
Compiled Code)
at
com.wm.pkg.ejbim.MyConnection.listHomeBeans(MyConnection.java:226)
at
com.wm.pkg.ejbim.EJBServerBrowser.listHomeBeans(EJBServerBrowser.java,
Compiled Code)
at com.wm.pkg.ejbim.EJBServerBrowser.main(EJBServerBrowser.java:358)
MyConnection.collectBindingElements - Oops, PeerGoneException contained
this: type java.lang.ClassCastException), msg(null)
java.lang.ClassCastException
at
weblogic.utils.classloaders.GenericClassLoader.reallyLoadClass(GenericClassL
oader.java, Compiled Code)
at
weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.
java:172)
at
weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.
java:146)
at weblogic.rjvm.MsgAbbrev.read(MsgAbbrev.java, Compiled Code)
at
weblogic.socket.JVMAbbrevSocket.readMsgAbbrevs(JVMAbbrevSocket.java:505)
at
weblogic.rjvm.MsgAbbrevInputStream.prime(MsgAbbrevInputStream.java:134)
at weblogic.rjvm.RJVMImpl.dispatch(RJVMImpl.java:610)
at
weblogic.rjvm.ConnectionManagerClient.handleRJVM(ConnectionManagerClient.jav
a:34)
at
weblogic.rjvm.ConnectionManager.dispatch(ConnectionManager.java:630)
at
weblogic.socket.JVMAbbrevSocket.dispatch(JVMAbbrevSocket.java:393)
at weblogic.socket.JVMSocketT3.dispatch(JVMSocketT3.java, Compiled
Code)
at
weblogic.socket.JavaSocketMuxer.processSockets(JavaSocketMuxer.java,Compiled
Code)
at
weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:23)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
Code)
So the peer left because it had trouble casting? The code is real simple:
NamingEnumeration nameEnum = ctx.listBindings( "" );
while ( nameEnum.hasMoreElements() )
Binding aBind = (Binding) nameEnum.nextElement();
...give or take some try...catch code
Rod
Bryan O'Sullivan <[email protected]> wrote in message
news:[email protected]...
r> weblogic.rmi.extensions.RemoteRuntimeException
r> and this msg:
r> Undeclared checked exception
The RemoteRuntimeException contains a nested exception. Check that to
see what's really wrong.
<b
Let us pray:
What a Great System.
Please Do Not Crash.
^G^IP@P6 -
Class cast exception while casting FTPConnectionFactory object
Hi
I have SOA Suite Advanced installation - 10.1.3.4 MLR#5.
I have developed a BPEL which polls an FTP site using a JCA FTPConnectionFactory registered in JNDI - eis/Ftp/My_Ftp.
If file is present, then BPEL doesnt fetchs it... instead calls a java program through WSIF binding.
In java program i am retrieving the JNDI object - eis/Ftp/My_Ftp.. casting it to oracle.tip.adapter.ftp.FTPConnectionFactory and get the FTP host and credentials.
Now using those details i mannually create an FTP Connection and retieve the file.
This program worked for sure... but recently when i tried the same i got the ClassCastException while casting java.lang.Object got from JNDI to oracle.tip.adapter.ftp.FTPConnectionFactory. I havnt changed any thing on server since... could not understand why this issue has cropped now.
After lot of research the issue seems due to different Classloaders. JNDI object was loaded by ClassLoaderA and in my java program it is being loaded by ClassLoaderB.
And these two classloaders dont share classes with each other.
This is the code:
InitialContext ctx = new InitialContext();
Object jndiFTPObj = ctx.lookup("eis/Ftp/My_Ftp");
System.out.println("Got Object from JNDI is: "+jndiFTPObj+" ClassLoader - "+jndiFTPObj.getClass().getClassLoader());
// it prints -- Got Object from JNDI is: oracle.tip.adapter.ftp.FTPConnectionFactory@1aa3bbc ClassLoader - FtpAdapter:0.0.0
FTPConnectionFactory ftpConF = (oracle.tip.adapter.ftp.FTPConnectionFactory)jndiFTPObj;
// here i get error -- java.lang.ClassCastException: oracle.tip.adapter.ftp.FTPConnectionFactory
Thinking of RMI/IIOP i even tried:
FTPConnectionFactory ftpConF = (FTPConnectionFactory)PortableRemoteObject.narrow(ctx.lookup("eis/Ftp/My_Ftp"), FTPConnectionFactory.class);
it didnt solve the error.
I tried loading the class using the same loader as:
Class.forName("oracle.tip.adapter.ftp.FTPConnectionFactory",true,jndiFTPObj.getClass().getClassLoader());
even that didnt solve the error.
If any body has some idea... pls help
Thanks
InderIssue was due to ClassLoaders... tried to use the same classloader... but couldnt.
Eventually solved it by using Java Reflection.
Thx -
Help me get my class to add to PriorityQueue
Hi, I have a class called Edge:
class Edge <AnyType extends Comparable<? super AnyType>>
int node1;
int node2;
int weight;
public Edge(int a, int b, int w)
node1 = a;
node2 = b;
weight = w;
int getWeight()
return weight;
int compareTo(Edge b)
if (this.weight < b.weight)
return -1;
else if (this.weight == b.weight)
return 0;
else if (this.weight > b.weight)
return 1;
return 0;
}I want to add a LinkedList of Edges to a PriorityQueue using
PriorityQueue<Edge> pq = new PriorityQueue<Edge>( getEdges( ) );The getEdges() method returns a LinkedList of Edges. The error I get is ClassCastException: Edge (in java.util.PriorityQueue).
Any Ideas? Thanks for any help!Not me :(
I think the problem may be with my class' header:class Edge <AnyType extends Comparable><? super AnyType>>Are you sure that something with that header should be able to be added to a PiorityQueue?
Maybe you are looking for
-
Links and destinations problems - page view
Hi there, I'm working on a large PDF in Adobe Acrobat 9 Pro. This PDF has a LOT of internal links, and I want to link to a page view, and inherit zoom. Not only do I have to manually change the zoom to "inherit zoom" after I create a link, but Acroba
-
I have just downloaded and install Photoshop CC but I am unable to open a file from Lightroom. I can open files from 'Pictures' no problem. If I go to Open/Applications and scroll down the Lightroom tab is not illuminated and not able to open! What d
-
Output device - printing in unix file - where do I define the UNIX path?
Hi, We use an special Output Device to print spool requests directly in Unix. These Output Devices are defined as Local Unix File. When those spool requests are printed, a file is created in certain path in UNIX. The question is where this link is de
-
My ipod makes a pretty loud mosquito noise!
it *****!you can hear the noise even if the headphones are unplugged! Tell me people, what do I do????????? I treat it like a baby... Even I have reset-it it .....still acts up on me.... Toshiba Windows XP Pro
-
Many Quicktime-Videos in one Session
Hi, how can I import several QT-videos in one logicsession. Or can I only integrate one video per session? Thanks! Adrian