[EJB/JBoss] - ClassCastException $Proxy0 from within Java Web Start
by kaiho
Hi,
I'm using JBoss 4.0.4 and Java 5 for writing an EJB 3-Client in Eclipse RCP 3.2.1, that is deployed via Java Web Start. I've got two plugins/JARs (1. RCP client/EJB remote interfaces and 2. JBoss/JEE libraries), that are bundled as a feature. When starting the Eclipse product everything is fine. But when the product is run via Web Start, there is a problem. Although the client starts, an exception is thrown when trying to communicate with an EJB. The last line of this code snippet javax.naming.Context c = new javax.naming.InitialContext();
| Object temp = c.lookup("ArtikelverwaltungBean/remote");
| avr = (ArtikelverwaltungRemote) temp;
| //avr = (ArtikelverwaltungRemote) PortableRemoteObject.narrow(temp, ArtikelverwaltungRemote.class);
throws this exception java.lang.ClassCastException: $Proxy0
| at client.editors.HerstellerEditorData.<init>(HerstellerEditorData.java:68)
| at client.editors.HerstellerEditorData.<init>(HerstellerEditorData.java:22)
| at client.actions.HerstellerEditorAction.run(HerstellerEditorAction.java:44)
| at org.eclipse.jface.action.Action.runWithEvent(Action.java:499)
| at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:539)
| at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
| at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:441)
| at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
| at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1085)
| at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3166)
| at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2842)
| at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914)
| at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
| at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419)
| at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
| at de.iwi.wws.client.ercp.main.Application.run(Application.java:24)
| at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
| at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
| at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
| at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
| at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
| at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
| at org.eclipse.core.launcher.WebStartMain.basicRun(WebStartMain.java:59)
| at org.eclipse.core.launcher.Main.run(Main.java:977)
| at org.eclipse.core.launcher.WebStartMain.main(WebStartMain.java:40)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at com.sun.javaws.Launcher.executeApplication(Launcher.java:1154)
| at com.sun.javaws.Launcher.executeMainClass(Launcher.java:1101)
| at com.sun.javaws.Launcher.continueLaunch(Launcher.java:944)
| at com.sun.javaws.Launcher.handleApplicationDesc(Launcher.java:515)
| at com.sun.javaws.Launcher.handleLaunchFile(Launcher.java:218)
| at com.sun.javaws.Launcher.run(Launcher.java:165)
| at java.lang.Thread.run(Thread.java:595)
and it makes no difference wheter I narrow the returned object or not.
In the JBoss forums can be read that this error (ClassCastException $Proxy0) is most likely a class loading problem. "The cast will only work if you are casting to a class/interface loaded with the same classloader." (http://www.jboss.com/index.html?module=bb&op=viewtopic&t=45871)
I'm not familiar with the interna of Web Start. Does anybody has an idea to overcome this problem?
By the way, this "trick" does not work: Thread.currentThread().setContextClassLoader(ArtikelverwaltungRemote.class.getClassLoader());
Thank you for your help!
Kai
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3987974#3987974
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3987974
19Â years, 5Â months
[Tomcat, HTTPD, Servlets & JSP] - IE 6 sending GET request instead of POST
by mstacey
Hi,
I have a form using POST when requests the generation of a PDF report. The target for the form allows the PDF to be displayed in a new window without interfering with the page the user clicked on the form. I'm JBoss 3.2.6 which generates the report and streams the report back with the correct content type via a servlet.
In Internet Explorer I'm seeing strange behaviour in that when the form is first submitted, the PDF report is generated correctly, but if I switch back to the original page and click the link again, the form is submitted using a GET request (with no parameters). I used to simply have a standard link to generate the report but wanted to avoid any side affects of pre-fetching as the reports can sometimes take a long time to generate, this standard link seemed to work without any problems.
Any ideas what could be causing this?
thanks
Mark
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3987972#3987972
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3987972
19Â years, 5Â months
[JCA/JBoss] - Re: Oracle 10g Fast Connection Failover
by weston.priceï¼ jboss.com
I am not sure what you are saying.
As far as the TAF and other Oracle specfic features are concerned, the reason that they are not available in JBoss is because they do not *exist* in JBoss. They require an Oracle specfic datasource as well as Oracle to manage the underlying pool of JDBC connections. JBoss provides a DataSource implementation that wraps the underlying JDBC connection. This is not an Oracle DataSource. As a result, the Oracle specific features are simply not available.
anonymous wrote :
| What I find strange is that whenever someone ask about this method, an
| excommunication is launched!
| Terrible things could happen using it! You go blind...
|
I am sorry you have had this experience. What we generally try to impart to people is warning that if you are using an API in an unintended manner or purposely try to thrwart an API then you should not be surprised when unforseen consequences occur.
anonymous wrote :
| So if you wrote this method, why you did not give us a way to notify the WrappedConnection that I want to close or destroy the underlying connection?
|
Because frankly, this makes no sense. The point of using connection pooling is to increase scalability and reduce the cost of using expensive resources in a managed environment. The getUnderlyingConnection() method was added for those *rare* instances that a client would need to access features of the underlying JDBC driver not provided by the JDBC API.
Now, you could very well call close on the underlying connection, but that would fall squarely in the realm of *not recommended* abuses of an API. I am not sure why you would ever want to completely destroy the underlying connection anyway. Could you explain why you would want to do this?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3987971#3987971
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3987971
19Â years, 5Â months
[JBossCache] - Pessimistic Locking strange behaviour with read-only pattern
by Oyabun
Hi!
Everytime I use a read-only pattern(get*) on my EntityBean, the pessimistic locking stops working (for other methods also)! It behaves just like optimistic locking. I experimented for a few days, I read the forums and the JBoss 4.0 Book, there is nothing on this behaviour.
some of the xdoclet tags (the ones that count):
| /**
| * Autogenerated EJB implementation class for SystemKontoEB
| *
| *
| *
| * @ejb.bean
| * generate = "true"
| * name = "SystemKontoEB"
| * type = "CMP"
| * cmp-version = "2.x"
| * view-type = "local"
| * local-jndi-name = "ejb/SystemKontoEB"
| * reentrant = "true"
| *
| * @jboss.container-configuration
| * name = "Standard CMP 2.x EntityBean Pessimistic"
| *
| * @jboss.cache-invalidation
| * value = "true"
| *
| * @jboss.cache-invalidation-config
| * invalidation-group-name = "SystemKontoEBGroup"
| *
| * @jboss.tuned-updates
| *
| * @jboss.entity-command
| * name = "no-select-before-insert"
| *
| * @jboss.read-ahead
| * strategy = "on-load"
| * page-size = "20"
| *
| * @ejb.util
| * generate = "physical"
| *
| * @ejb.transaction
| * type = "Required"
| *
| * @ejb.persistence
| * table-name = "SYSTEMKONTO"
| *
| * @jboss.method-attributes
| * pattern = "get*"
| * read-only = "true"
| */
|
"Standard CMP 2.x EntityBean Pessimistic" is the same as "Standard CMP 2.x EntityBean" only with the modifications below. I use my own invalidation methods, if you wonder why i do this.
| <locking-policy>org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock</locking-policy>
|
Any ideas why the read-only method tag (get*) would interfere with the pessimistic locking of other methods which don't match the get* pattern?
-> JBoss 4.0.2
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3987969#3987969
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3987969
19Â years, 5Â months