Reloading applet in opera throws NullPointerException in SunGraphics2D
i have an Applet, which checks for Sun JVM. If MS JVM, it aborts. If Sun JVM, it starts new JApplet.
Everything is working fine, until i tried to reload the html page with the applet tag in it.
On MS IE, it is working. The Applet is stopped and then restarted.
On Mozilla, it is working.
But on Opera, the following Exception is thrown after i have reloaded the page once.
After reloading, the Exception is also thrown everytime i scroll the page or reload the page.
java.lang.NullPointerException
at sun.java2d.SunGraphics2D.<init>(Unknown Source)
at sun.awt.image.SunVolatileImage.createGraphics(Unknown Source)
at java.awt.image.VolatileImage.getGraphics(Unknown Source)
at javax.swing.JComponent.paintWithOffscreenBuffer(Unknown Source)
at javax.swing.JComponent.paintDoubleBuffered(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source)
at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)
at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)
at java.awt.Container.paint(Unknown Source)
at sun.awt.RepaintArea.paint(Unknown Source)
at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
As said, i'm using an Applet class and an JApplet class. the Applet class has only AWT components,
the JApplet class has swing components (a list and a few JButtons).
i'm using a thread, but it is not started.
also, after the reload in opera, the whole applet is started again (as usual), and AFTER the last debug message,
this exception is thrown. so there is no code of myself after that last debug message.
i am using java 1.4.2-beta, but users told me they have the same problem with my applet on other computers with
other jvms.
i tried a beta-version of opera 7.20 and here are some source code line numbers visible:
perhaps someone can tell me now, what's happening there and give me a tipp how to solve this problem.
java.lang.NullPointerException
at sun.java2d.SunGraphics2D.<init>(SunGraphics2D.java:212)
at sun.awt.image.SunVolatileImage.createGraphics(SunVolatileImage.java:176)
at java.awt.image.VolatileImage.getGraphics(VolatileImage.java:223)
at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4768)
at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4748)
at javax.swing.JComponent.paint(JComponent.java:798)
at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:21)
at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:60)
at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:97)
at java.awt.Container.paint(Container.java:1312)
at sun.awt.RepaintArea.paint(RepaintArea.java:177)
at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:260)
at java.awt.Component.dispatchEventImpl(Component.java:3678)
at java.awt.Container.dispatchEventImpl(Container.java:1627)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
Similar Messages
-
I want to reload applet by the program. In the program, under some condition, I want to reload the applet. Please let me know how can I implement it.
Thanks & Regards,
Nasrin.NHey fuckwit!
Please stop multiposting every single question you have into three or four different forums.
Thank you for your co-operation in this matter. -
Problem while loading applet in opera- very urgent please
hi,
I am having problem while loading applet in opera browser. Showing "Applet loading " continuously. I am trying to use URLConnection to read information from applet's own host. I cant find the exact problem what is happening, Since there is no error message in browser Javaconsole.
If anybody have idea on this please help me. I am in great hurry.
Thanks in advance.
Rao. Vhi this is rao,
I inserted a lot of System.out statements throughout applet life cycle. But they are not displaying in java console. I think the problem is in Opera-java settings. Since i am new to the opera environment i cant get right solution.
Please help me if anybody having clear idea on this aspect.
thanks in advance -
Private Room throws NullPointerException
Hi,
I have created a private room and it was sucessfull. i am able to see the room without any problem. but when others(non-members) go to their rooms directory, it throws NullPointerException. This problem is only for private rooms only.
we are using SP 17
The exception is
java.lang.NullPointerException
at com.sap.ip.collaboration.roomui.api.util.properties.RoomResourceProperties.getPropertyValueAsString(RoomResourceProperties.java:53)
at com.sap.ip.collaboration.roomui.api.util.properties.RoomResourceProperties.getRoomPrivacy(RoomResourceProperties.java:33)
at com.sap.netweaver.coll.roomui.api.uicommands.UIRequestMembershipCommand.isExecutable(UIRequestMembershipCommand.java:67)
at com.sapportals.wcm.rendering.uicommand.UIGroupCommand.getResourceCommands(UIGroupCommand.java:78)
at ..............
can anyone reply what might be the reason be?
Thank you.
Saravana.
Edited by: Saravana Parthiban Palaniswamy on Feb 4, 2009 1:22 PM
Edited by: Saravana Parthiban Palaniswamy on Feb 4, 2009 1:26 PMHi,
If u goes to room directory in collaboration, there is a tab called Restricted Rooms. End of the room name there is context menu if u click that, it will show the menu there you can see the option called Request Membership. If you click that, corresponding room owner will receive the mail if he/she enabled the mail properties.
If the answer helps your Question, provide the points.
Regards,
Kathiresan R -
CreateEntityManagerFactory throws NullPointerException for ejb3 jse client
This question has been posted to the Toplink/jpa forum without any reply.
Dear experts!
I am trying to create a java standard edition client, to test outside the weblogic server, my ejb 3 entities, declared as shown in the following persistence.xml.
The java code follows also. I have read about some relevant bugs in eclipselink back in 2006, or 7 or 8 and mostly unanswered threads :
CreateEntityManagerFactory null pointer exception and
Returned null to createEntityManagerFactory about tomcat and oc4j.
Persistence.createEntityManagerFactory() throw NullPointerException in oc4j
I am using JDeveloper 11g Studio Edition Version 11.1.1.3.0, Build JDEVADF_11.1.1.3.PS2_GENERIC_100408.2356.5660.
Any helping hand available?
Thank you very much in advance!
NA
package chapter12javaseclient;
import actionbazaar.buslogic.BidException;
import actionbazaar.persistence.Bid;
import actionbazaar.persistence.Bidder;
import actionbazaar.persistence.Item;
import java.util.HashMap;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import org.eclipse.persistence.config.EntityManagerProperties;
public class PlaceBidBeanJavaSE {
private static EntityManagerFactory emf;
private static EntityManager em;
public static void main(String[] args) {
String userId= "idiot";
Long itemId = new Long (1);
Double bidPrice = 2001.50;
try {
if (emf == null){
emf = Persistence.createEntityManagerFactory("actionBazaar");
System.out.println("EntityManagerFactory created!");
getEntityManager();
System.out.println("EntityManager created!");
addBid(userId,itemId,bidPrice);
commitTransaction();
} finally {
// close the EntityManager when done
em.close();
emf.close();
private static void getEntityManager() {
HashMap emProps = new HashMap();
emProps.put(EntityManagerProperties.JDBC_USER, "ab");
emProps.put(EntityManagerProperties.JDBC_PASSWORD, "ab");
System.out.println("Creating entity manager");
em = emf.createEntityManager(emProps);
em.getTransaction().begin();
private static void commitTransaction() {
em.getTransaction().commit();
private static Long addBid(String userId, Long itemId, Double bidPrice) throws BidException {
Item item = em.find(Item.class,itemId);
if (item == null)
throw new BidException("Invalid Item Id");
Bidder bidder = em.find(Bidder.class,userId);
if (bidder == null)
throw new BidException("Invalid Bidder Id");
Bid bid = new Bid();
bid.setItem(item);
bid.setBidBidder(bidder);
bid.setBidPrice(bidPrice);
em.persist(bid);
return bid.getBidId();
<?xml version="1.0" encoding="UTF-8" ?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="actionBazaar" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>actionbazaar.persistence.Bid</class>
<class>actionbazaar.persistence.Item</class>
<class>actionbazaar.persistence.User</class>
<class>actionbazaar.persistence.Bidder</class>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.target-server" value="WebLogic_10"/>
<property name="eclipselink.target-database" value="Oracle11"/>
<property name="javax.persistence.jdbc.driver"
value="oracle.jdbc.OracleDriver"/>
<property name="javax.persistence.jdbc.password"
value="ab"/>
<property name="javax.persistence.jdbc.url"
value="jdbc:oracle:thin:@hera:1521:orcl"/>
<property name="javax.persistence.jdbc.user" value="ab"/>
<property name="eclipselink.logging.level" value="ALL"/>
</properties>
</persistence-unit>
</persistence>A solution might be found here:
Re: createEntityManagerFactory() throws NullPointerException for ejb jse client
Re: createEntityManagerFactory() throws NullPointerException for ejb jse client
NA
[http://nickaiva.blogspot.com/] -
CreateEntityManagerFactory() throws NullPointerException for ejb jse client
Dear experts!
I am trying to create a java standard edition client, to test outside the weblogic server, my ejb 3 entities, declared as shown in the following persistence.xml.
The java code, and stacktrace follows also. I have read about some relevant bugs in eclipselink back in 2006, or 7 or 8 and mostly unanswered threads :
CreateEntityManagerFactory null pointer exception and
Returned null to createEntityManagerFactory about tomcat and oc4j.
Persistence.createEntityManagerFactory() throw NullPointerException in oc4j
I am using JDeveloper 11g Studio Edition Version 11.1.1.3.0, Build JDEVADF_11.1.1.3.PS2_GENERIC_100408.2356.5660.
Any helping hand available?
Thank you very much in advance!
NA
package chapter12javaseclient;
import actionbazaar.buslogic.BidException;
import actionbazaar.persistence.Bid;
import actionbazaar.persistence.Bidder;
import actionbazaar.persistence.Item;
import java.util.HashMap;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import org.eclipse.persistence.config.EntityManagerProperties;
public class PlaceBidBeanJavaSE {
private static EntityManagerFactory emf;
private static EntityManager em;
public static void main(String[] args) {
String userId= "idiot";
Long itemId = new Long (1);
Double bidPrice = 2001.50;
try {
if (emf == null){
emf = Persistence.createEntityManagerFactory("actionBazaar");
System.out.println("EntityManagerFactory created!");
getEntityManager();
System.out.println("EntityManager created!");
addBid(userId,itemId,bidPrice);
commitTransaction();
} finally {
// close the EntityManager when done
em.close();
emf.close();
private static void getEntityManager() {
HashMap emProps = new HashMap();
emProps.put(EntityManagerProperties.JDBC_USER, "ab");
emProps.put(EntityManagerProperties.JDBC_PASSWORD, "ab");
System.out.println("Creating entity manager");
em = emf.createEntityManager(emProps);
em.getTransaction().begin();
private static void commitTransaction() {
em.getTransaction().commit();
private static Long addBid(String userId, Long itemId, Double bidPrice) throws BidException {
Item item = em.find(Item.class,itemId);
if (item == null)
throw new BidException("Invalid Item Id");
Bidder bidder = em.find(Bidder.class,userId);
if (bidder == null)
throw new BidException("Invalid Bidder Id");
Bid bid = new Bid();
bid.setItem(item);
bid.setBidBidder(bidder);
bid.setBidPrice(bidPrice);
em.persist(bid);
return bid.getBidId();
<?xml version="1.0" encoding="UTF-8" ?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="actionBazaar" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>actionbazaar.persistence.Bid</class>
<class>actionbazaar.persistence.Item</class>
<class>actionbazaar.persistence.User</class>
<class>actionbazaar.persistence.Bidder</class>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.target-server" value="WebLogic_10"/>
<property name="eclipselink.target-database" value="Oracle11"/>
<property name="javax.persistence.jdbc.driver"
value="oracle.jdbc.OracleDriver"/>
<property name="javax.persistence.jdbc.password"
value="ab"/>
<property name="javax.persistence.jdbc.url"
value="jdbc:oracle:thin:@hera:1521:orcl"/>
<property name="javax.persistence.jdbc.user" value="ab"/>
<property name="eclipselink.logging.level" value="ALL"/>
</properties>
</persistence-unit>
</persistence>
The log output follows:
C:\Oracle\Middleware\jdev_11gR1\jdk160_18\bin\javaw.exe -client -classpath C:\MyWork\11g\ejb3inaction\.adf;C:\MyWork\11g\ejb3inaction\Chapter12JavaSEClient\classes;C:\MyWork\11g\ejb3inaction\Chapter12\classes;C:\Oracle\Middleware\jdev_11gR1\modules\javax.ejb_3.0.1.jar;C:\Oracle\Middleware\jdev_11gR1\modules\com.oracle.toplink_1.0.0.0_11-1-1-3-0.jar;C:\Oracle\Middleware\jdev_11gR1\modules\org.eclipse.persistence_1.0.0.0_2-0.jar;C:\Oracle\Middleware\jdev_11gR1\modules\com.bea.core.antlr.runtime_2.7.7.jar;C:\Oracle\Middleware\jdev_11gR1\oracle_common\modules\oracle.toplink_11.1.1\javax.persistence_2.0_preview.jar;C:\Oracle\Middleware\jdev_11gR1\oracle_common\modules\oracle.xdk_11.1.0\xmlparserv2.jar;C:\Oracle\Middleware\jdev_11gR1\oracle_common\modules\oracle.xdk_11.1.0\xml.jar;C:\Oracle\Middleware\jdev_11gR1\modules\javax.jsf_1.0.0.0_1-2.jar;C:\Oracle\Middleware\jdev_11gR1\modules\javax.enterprise.deploy_1.2.jar;C:\Oracle\Middleware\jdev_11gR1\modules\javax.interceptor_1.0.jar;C:\Oracle\Middleware\jdev_11gR1\modules\javax.jms_1.1.1.jar;C:\Oracle\Middleware\jdev_11gR1\modules\javax.jsp_1.1.0.0_2-1.jar;C:\Oracle\Middleware\jdev_11gR1\modules\javax.jws_2.0.jar;C:\Oracle\Middleware\jdev_11gR1\modules\javax.activation_1.1.0.0_1-1.jar;C:\Oracle\Middleware\jdev_11gR1\modules\javax.mail_1.1.0.0_1-4-1.jar;C:\Oracle\Middleware\jdev_11gR1\modules\javax.xml.soap_1.3.1.0.jar;C:\Oracle\Middleware\jdev_11gR1\modules\javax.xml.rpc_1.2.1.jar;C:\Oracle\Middleware\jdev_11gR1\modules\javax.xml.ws_2.1.1.jar;C:\Oracle\Middleware\jdev_11gR1\modules\javax.management.j2ee_1.0.jar;C:\Oracle\Middleware\jdev_11gR1\modules\javax.resource_1.5.1.jar;C:\Oracle\Middleware\jdev_11gR1\modules\javax.servlet_1.0.0.0_2-5.jar;C:\Oracle\Middleware\jdev_11gR1\modules\javax.transaction_1.0.0.0_1-1.jar;C:\Oracle\Middleware\jdev_11gR1\modules\javax.xml.stream_1.1.1.0.jar;C:\Oracle\Middleware\jdev_11gR1\modules\javax.security.jacc_1.0.0.0_1-1.jar;C:\Oracle\Middleware\jdev_11gR1\modules\javax.xml.registry_1.0.0.0_1-0.jar;C:\Oracle\Middleware\jdev_11gR1\modules\javax.persistence_1.0.0.0_1-0-2.jar;C:\Oracle\Middleware\jdev_11gR1\wlserver_10.3\server\lib\weblogic.jar;C:\Oracle\Middleware\jdev_11gR1\wlserver_10.3\server\ext\jdbc\oracle\11g\ojdbc6.jar;C:\Oracle\Middleware\jdev_11gR1\oracle_common\modules\oracle.nlsrtl_11.1.0\orai18n-collation.jar;C:\Oracle\Middleware\jdev_11gR1\oracle_common\modules\oracle.nlsrtl_11.1.0\orai18n-lcsd.jar;C:\Oracle\Middleware\jdev_11gR1\oracle_common\modules\oracle.nlsrtl_11.1.0\orai18n-mapping.jar;C:\Oracle\Middleware\jdev_11gR1\oracle_common\modules\oracle.nlsrtl_11.1.0\orai18n-servlet.jar;C:\Oracle\Middleware\jdev_11gR1\oracle_common\modules\oracle.nlsrtl_11.1.0\orai18n-translation.jar;C:\Oracle\Middleware\jdev_11gR1\oracle_common\modules\oracle.nlsrtl_11.1.0\orai18n-utility.jar;C:\Oracle\Middleware\jdev_11gR1\oracle_common\modules\oracle.nlsrtl_11.1.0\orai18n.jar;C:\Oracle\Middleware\jdev_11gR1\oracle_common\modules\oracle.odl_11.1.1\ojdl.jar;C:\Oracle\Middleware\jdev_11gR1\oracle_common\modules\oracle.dms_11.1.1\dms.jar -Djavax.net.ssl.trustStore=C:\Oracle\Middleware\jdev_11gR1\wlserver_10.3\server\lib\DemoTrust.jks chapter12javaseclient.PlaceBidBeanJavaSE
[EL Finest]: 2010-06-25 09:23:10.495--ServerSession(229902)--Thread(Thread[main,5,main])--Begin predeploying Persistence Unit actionBazaar; session file:/C:/MyWork/11g/ejb3inaction/Chapter12JavaSEClient/classes/_actionBazaar; state Initial; factoryCount 0
[EL Finest]: 2010-06-25 09:23:10.518--ServerSession(229902)--Thread(Thread[main,5,main])--property=eclipselink.orm.throw.exceptions; default value=true
[EL Finer]: 2010-06-25 09:23:10.532--ServerSession(229902)--Thread(Thread[main,5,main])--Searching for default mapping file in file:/C:/MyWork/11g/ejb3inaction/Chapter12JavaSEClient/classes/
[EL Finer]: 2010-06-25 09:23:10.537--ServerSession(229902)--Thread(Thread[main,5,main])--Searching for default mapping file in file:/C:/MyWork/11g/ejb3inaction/Chapter12JavaSEClient/classes/
[EL Config]: 2010-06-25 09:23:10.652--ServerSession(229902)--Thread(Thread[main,5,main])--The access type for the persistent class [class actionbazaar.persistence.Item] is set to [PROPERTY].
[EL Config]: 2010-06-25 09:23:10.696--ServerSession(229902)--Thread(Thread[main,5,main])--The target entity (reference) class for the many to many mapping element [method getCategorySet] is being defaulted to: class actionbazaar.persistence.Category.
[EL Config]: 2010-06-25 09:23:10.702--ServerSession(229902)--Thread(Thread[main,5,main])--The target entity (reference) class for the one to many mapping element [method getBids] is being defaulted to: class actionbazaar.persistence.Bid.
[EL Config]: 2010-06-25 09:23:10.71--ServerSession(229902)--Thread(Thread[main,5,main])--The target entity (reference) class for the many to one mapping element [method getSeller] is being defaulted to: class actionbazaar.persistence.Seller.
[EL Config]: 2010-06-25 09:23:10.71--ServerSession(229902)--Thread(Thread[main,5,main])--The access type for the persistent class [class actionbazaar.persistence.User] is set to [PROPERTY].
[EL Config]: 2010-06-25 09:23:10.711--ServerSession(229902)--Thread(Thread[main,5,main])--The target entity (reference) class for the one to many mapping element [method getCategories] is being defaulted to: class actionbazaar.persistence.Category.
[EL Config]: 2010-06-25 09:23:10.716--ServerSession(229902)--Thread(Thread[main,5,main])--The target entity (reference) class for the one to one mapping element [method getBillingInfo] is being defaulted to: class actionbazaar.persistence.BillingInfo.
[EL Config]: 2010-06-25 09:23:10.717--ServerSession(229902)--Thread(Thread[main,5,main])--The target entity (reference) class for the one to one mapping element [method getContactInfo] is being defaulted to: class actionbazaar.persistence.ContactInfo.
[EL Config]: 2010-06-25 09:23:10.718--ServerSession(229902)--Thread(Thread[main,5,main])--The access type for the persistent class [class actionbazaar.persistence.Bidder] is set to [PROPERTY].
[EL Config]: 2010-06-25 09:23:10.72--ServerSession(229902)--Thread(Thread[main,5,main])--The target entity (reference) class for the one to many mapping element [method getBids] is being defaulted to: class actionbazaar.persistence.Bid.
[EL Config]: 2010-06-25 09:23:10.721--ServerSession(229902)--Thread(Thread[main,5,main])--The access type for the persistent class [class actionbazaar.persistence.Bid] is set to [PROPERTY].
[EL Config]: 2010-06-25 09:23:10.721--ServerSession(229902)--Thread(Thread[main,5,main])--The target entity (reference) class for the many to one mapping element [method getBidBidder] is being defaulted to: class actionbazaar.persistence.Bidder.
[EL Config]: 2010-06-25 09:23:10.721--ServerSession(229902)--Thread(Thread[main,5,main])--The target entity (reference) class for the many to one mapping element [method getItem] is being defaulted to: class actionbazaar.persistence.Item.
[EL Config]: 2010-06-25 09:23:10.722--ServerSession(229902)--Thread(Thread[main,5,main])--The alias name for the entity class [class actionbazaar.persistence.Item] is being defaulted to: Item.
[EL Config]: 2010-06-25 09:23:10.746--ServerSession(229902)--Thread(Thread[main,5,main])--The alias name for the entity class [class actionbazaar.persistence.Bidder] is being defaulted to: Bidder.
[EL Config]: 2010-06-25 09:23:10.746--ServerSession(229902)--Thread(Thread[main,5,main])--The alias name for the entity class [class actionbazaar.persistence.User] is being defaulted to: User.
[EL Config]: 2010-06-25 09:23:10.753--ServerSession(229902)--Thread(Thread[main,5,main])--The table name for entity [class actionbazaar.persistence.Bidder] is being defaulted to: USERS.
[EL Config]: 2010-06-25 09:23:10.753--ServerSession(229902)--Thread(Thread[main,5,main])--The discriminator column name for the root inheritance class [class actionbazaar.persistence.Bidder] is being defaulted to: DTYPE.
[EL Config]: 2010-06-25 09:23:10.755--ServerSession(229902)--Thread(Thread[main,5,main])--The primary key column name for the inheritance class [class actionbazaar.persistence.Bidder] is being defaulted to: USER_ID.
[EL Config]: 2010-06-25 09:23:10.755--ServerSession(229902)--Thread(Thread[main,5,main])--The foreign key column name for the inheritance class [class actionbazaar.persistence.Bidder] is being defaulted to: USER_ID.
[EL Config]: 2010-06-25 09:23:10.758--ServerSession(229902)--Thread(Thread[main,5,main])--The alias name for the entity class [class actionbazaar.persistence.Bid] is being defaulted to: Bid.
Exception in thread "main" java.lang.NullPointerException
at chapter12javaseclient.PlaceBidBeanJavaSE.main(PlaceBidBeanJavaSE.java:43)
Process exited with exit code 1.Thank you for your reply!
The client now works correctly. It seems that the line
em = emf.createEntityManager(emProps);//
throws an exception when no argument is given for em = emf.createEntityManager();// emProps missing!
There was also a warning in jdev editor, about the line you mentioned:
<property name="eclipselink.target-server" value="WebLogic 10"/>
Carry on with your good work!
The updated persistence.xml and java source code shown below:
<?xml version="1.0" encoding="UTF-8" ?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="actionBazaar" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>actionbazaar.persistence.Bid</class>
<class>actionbazaar.persistence.Item</class>
<class>actionbazaar.persistence.User</class>
<class>actionbazaar.persistence.Bidder</class>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.target-database" value="Oracle11"/>
<property name="javax.persistence.jdbc.driver"
value="oracle.jdbc.OracleDriver"/>
<property name="javax.persistence.jdbc.password"
value="29E8BD11B89A62E3862F19C4F84B7DB0"/>
<property name="javax.persistence.jdbc.user" value="ab"/>
<property name="eclipselink.logging.level" value="ALL"/>
<property name="eclipselink.orm.validate.schema" value="true"/>
<property name="javax.persistence.jdbc.url"
value="jdbc:oracle:thin:@hera:1521:orcl"/>
</properties>
</persistence-unit>
</persistence>
package chapter12javaseclient;
import actionbazaar.buslogic.BidException;
import actionbazaar.persistence.Bid;
import actionbazaar.persistence.Bidder;
import actionbazaar.persistence.Item;
import java.util.HashMap;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import org.eclipse.persistence.config.EntityManagerProperties;
public class PlaceBidBeanJavaSE {
private static EntityManagerFactory emf;
private static EntityManager em;
private static Hashtable emProps = new Hashtable();
public static void main(String[] args) {
String userId= "idiot";
Long itemId = new Long (2);
Double bidPrice = 2002.50;
try {
if (emf == null){
emf = Persistence.createEntityManagerFactory("actionBazaar");
System.out.println("EntityManagerFactory created!");
getEntityManager();
System.out.println("EntityManager created!");
addBid(userId,itemId,bidPrice);
commitTransaction();
} finally {
// close the EntityManager when done
em.close();
emf.close();
private static void getEntityManager() {
try {
System.out.println("Creating entity manager");
em = emf.createEntityManager(emProps);// if argument is missing exception is thrown!
em.getTransaction().begin();
} catch (Exception ne) {
// TODO: Add catch code
ne.printStackTrace();
private static void commitTransaction() {
em.getTransaction().commit();
private static Long addBid(String userId, Long itemId, Double bidPrice) throws BidException {
Item item = em.find(Item.class,itemId);
if (item == null)
throw new BidException("Invalid Item Id");
Bidder bidder = em.find(Bidder.class,userId);
if (bidder == null)
throw new BidException("Invalid Bidder Id");
Bid bid = new Bid();
bid.setItem(item);
bid.setBidBidder(bidder);
bid.setBidPrice(bidPrice);
em.persist(bid);
return bid.getBidId();
NA
[http://nickaiva.blogspot.com/] -
Can I uninstall Yosemite and reload my older operating system
can I uninstall Yosemite and reload my older operating system
I tried this method and erased my MC HD and restored my system, but the bad thing is once you install YOSEMITE it overrides your Recovery with yosemite and you lose Maverick. I called Apple support regarding this same issue. I have to take my Mac to apple to have it replaced with a new one that has maverick installed on it.
Yosemite is causing display glitches, wifi slow downs, dock disappears from one screen to the other or completely and cannot get it back. -
JDBC operation throws a NullPointerException
Hi all...
It seems that any attempt to perform a jdbc access from a deployed LCA (my process at this point only contains the JDBC 'query multiple to xml' operation) results in the following exception on the LC server (see below). The query and xml generation all seem to work ok from the Workbench. I can mail the lca upon request. Thanks.
[4/28/08 17:10:15:557 EDT] 00000059 SystemOut O [Flex] [ERROR] Root cause: java.lang.NullPointerException
at com.adobe.idp.dsc.jdbc.helper.SqlHelper.executeQuery(SqlHelper.java:85)
at com.adobe.idp.dsc.jdbc.JDBCService.queryMultipleToXml(JDBCService.java:391)
at sun.reflect.GeneratedMethodAccessor1517.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.adobe.idp.dsc.component.impl.DefaultPOJOInvokerImpl.invoke(DefaultPOJOInvokerImpl.jav a:181)
at com.adobe.idp.dsc.interceptor.impl.InvocationInterceptor.intercept(InvocationInterceptor. java:134)
at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:44)
at com.adobe.idp.dsc.transaction.interceptor.TransactionInterceptor$1.doInTransaction(Transa ctionInterceptor.java:74)
at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapterBean.execute(EjbTr ansactionCMTAdapterBean.java:336)
at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapterBean.doSupports(Ej bTransactionCMTAdapterBean.java:212)
at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EJSLocalStatelessEjbTransactionCMTAdapter_ caf58c4f.doSupports(Unknown Source)
at com.adobe.idp.dsc.transaction.impl.ejb.EjbTransactionProvider.execute(EjbTransactionProvi der.java:104)
at com.adobe.idp.dsc.transaction.interceptor.TransactionInterceptor.intercept(TransactionInt erceptor.java:72)
at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:44)
at com.adobe.idp.dsc.interceptor.impl.InvalidStateInterceptor.intercept(InvalidStateIntercep tor.java:37)
at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:44)
at com.adobe.idp.dsc.interceptor.impl.AuthorizationInterceptor.intercept(AuthorizationInterc eptor.java:88)
at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:44)
at com.adobe.idp.dsc.engine.impl.ServiceEngineImpl.invoke(ServiceEngineImpl.java:113)
at com.adobe.idp.dsc.routing.Router.routeRequest(Router.java:102)
at com.adobe.idp.dsc.provider.impl.base.AbstractMessageReceiver.routeMessage(AbstractMessage Receiver.java:88)
at com.adobe.idp.dsc.provider.impl.vm.VMMessageDispatcher.doSend(VMMessageDispatcher.java:21 0)
at com.adobe.idp.dsc.provider.impl.base.AbstractMessageDispatcher.send(AbstractMessageDispat cher.java:57)
at com.adobe.idp.dsc.clientsdk.ServiceClient.invoke(ServiceClient.java:208)
at com.adobe.idp.taskmanager.dsc.service.TaskManagerServiceImpl.renderForm(TaskManagerServic eImpl.java:3404)
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.adobe.idp.dsc.component.impl.DefaultPOJOInvokerImpl.invoke(DefaultPOJOInvokerImpl.jav a:181)
at com.adobe.idp.dsc.interceptor.impl.InvocationInterceptor.intercept(InvocationInterceptor. java:134)
at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:44)
at com.adobe.idp.dsc.transI don't see any blank values anywhere. I have a single 'Assign Task' operation with the following config. I can send an lca if you like.
Initial User = 'Assign to Process Creator'
Form Data Mappings => input form variable = /process_data/myXFAForm
output form var = /process_data/myXFAForm
myXFAForm has as its Render Service/Operation = JdbService/queryMultipleToXml with the following settings:
datasourceName(literal)= IDP_DS
sql_info(literal)= select FIRST_NAME, LAST_NAME, CONTACT_INFO, ORACLE_USERID from TVS_TVAS_USER where STATUS='ACTIVE'
xml_info (literal) = root: tvasUsers; element: User; mapping: [{element_name=firstname, column_index=1, column_name=FIRST_NAME}, {element_name=lastname, column_index=2, column_name=LAST_NAME}, {element_name=emailAddress, column_index=3, column_name=CONTACT_INFO}, {element_name=tvasUserID, column_index=4, column_name=ORACLE_USERID}]
service output settings:
document=task/Document -
Hi all!
I have been searching for a while for a code that would let me reload my Applet, but I haven't found anything really. Would anyone be able to tell me if there's a code that would allow that to happen.
It's just that I've created an Applet and there's a button whose event handler must restart the whole Applet but up to now it's not operating at all. I would be grateful if somebody could answer me this.
Yours,
SauloAll I need is to make the same graphics from the start of the Applet to be displayed once a certain button is clicked. I thought that by realoading the Applet the result would be the same... I tried to put reapeat the code I've written for the beginning on the instance where the button is but that caused me a series of errors. I wonder what that might be, as all I had were components of a paint method.
Regards,
Saulo -
TaskManagerQueryService / TaskSearchFilter throws NullPointerException
I am trying to run a task search using the TaskManagerQueryService and a TaskSearchFilter. I'm looking for active tasks assigned to groups that a user belongs to. Whenever I include the Conditions with the Connectives shown below, the query service throws a null pointer exception as shown in the stacktrace below. What I'm trying to do with the Connectives is effectively create the equivalent of
if (Correct status code && (in group 1 || in group 2 ... ) {return the task}
Anyone have a clue what I'm doing wrong?
The code looks like this:
final ServiceClientFactory myFactory = getServiceClientFactory(pAdobeServername, pUserId, pPassWord);
final TaskManager taskManager = TaskManagerClientFactory.getTaskManager(myFactory);
final TaskManagerQueryService queryManager = TaskManagerClientFactory.getQueryManager(myFactory);
LiveCycleUser retUser = getUserInfo(pAdobeServername, pUserId, pPassWord);
final TaskSearchFilter taskSearchFilter = new TaskSearchFilter();
Operator operator = new Operator("<");
Integer statusCode = new Integer(StatusFilter.completed);
taskSearchFilter.addCondition(TaskSearchingConstants.pSTATUS, operator, statusCode);
HashSet<Group> groups = retUser.getGroupMembership();
Iterator<Group> groupIter = groups.iterator();
operator = new Operator("=");
if (groupIter.hasNext()) {
Group grp = groupIter.next();
String grpName = grp.getCommonName();
taskSearchFilter.addCondition(TaskSearchingConstants.pASSIGNMENT_QUEUE_OWNER, operator, grpName, Connective.AND);
while (groupIter.hasNext()) {
Group grp = groupIter.next();
String grpName = grp.getCommonName();
taskSearchFilter.addCondition(TaskSearchingConstants.pASSIGNMENT_QUEUE_OWNER, operator, grpName, Connective.OR);
if (processName != null) {
taskSearchFilter.setServiceName(processName);
taskSearchFilter.setIgnoreAllAcls(true);
final List<TaskRow> taskRowList = queryManager.taskSearch(taskSearchFilter);
beanList = buildBeanList(taskRowList, queryManager, taskManager);
The stacktrace looks like this:
Running: testGetAllTasksForSpecificProcessAsBeans
java.lang.NullPointerException
at com.adobe.idp.taskmanager.dsc.queryservice.TaskManagerQueryServiceImpl.taskSearch(TaskMan agerQueryServiceImpl.java:467)
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:597)
at com.adobe.idp.dsc.component.impl.DefaultPOJOInvokerImpl.invoke(DefaultPOJOInvokerImpl.jav a:118)
at com.adobe.idp.dsc.interceptor.impl.InvocationInterceptor.intercept(InvocationInterceptor. java:140)
at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)
at com.adobe.idp.dsc.interceptor.impl.DocumentPassivationInterceptor.intercept(DocumentPassi vationInterceptor.java:53)
at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)
at com.adobe.idp.dsc.transaction.interceptor.TransactionInterceptor$1.doInTransaction(Transa ctionInterceptor.java:74)
at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapterBean.execute(EjbTr ansactionCMTAdapterBean.java:357)
at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapterBean.doSupports(Ej bTransactionCMTAdapterBean.java:227)
at sun.reflect.GeneratedMethodAccessor321.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionConta iner.java:237)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionI nterceptor.java:158)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstance Interceptor.java:169)
at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:378)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor. java:138)
at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
at org.jboss.ejb.Container.invoke(Container.java:960)
at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:430)
at org.jboss.ejb.plugins.local.StatelessSessionProxy.invoke(StatelessSessionProxy.java:103)
at $Proxy165.doSupports(Unknown Source)
at com.adobe.idp.dsc.transaction.impl.ejb.EjbTransactionProvider.execute(EjbTransactionProvi der.java:104)
at com.adobe.idp.dsc.transaction.interceptor.TransactionInterceptor.intercept(TransactionInt erceptor.java:72)
at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)
at com.adobe.idp.dsc.interceptor.impl.InvocationStrategyInterceptor.intercept(InvocationStra tegyInterceptor.java:55)
at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)
at com.adobe.idp.dsc.interceptor.impl.InvalidStateInterceptor.intercept(InvalidStateIntercep tor.java:37)
at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)
at com.adobe.idp.dsc.interceptor.impl.AuthorizationInterceptor.intercept(AuthorizationInterc eptor.java:165)
at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)
at com.adobe.idp.dsc.interceptor.impl.JMXInterceptor.intercept(JMXInterceptor.java:48)
at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)
at com.adobe.idp.dsc.engine.impl.ServiceEngineImpl.invoke(ServiceEngineImpl.java:115)
at com.adobe.idp.dsc.routing.Router.routeRequest(Router.java:129)
at com.adobe.idp.dsc.provider.impl.base.AbstractMessageReceiver.invoke(AbstractMessageReceiv er.java:329)
at com.adobe.idp.dsc.provider.impl.ejb.receiver.EjbReceiverBean.invoke(EjbReceiverBean.java: 158)
at sun.reflect.GeneratedMethodAccessor414.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionConta iner.java:237)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionI nterceptor.java:158)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstance Interceptor.java:169)
at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:378)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor. java:138)
at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
at org.jboss.ejb.Container.invoke(Container.java:960)
at sun.reflect.GeneratedMethodAccessor402.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.invocation.unified.server.UnifiedInvoker.invoke(UnifiedInvoker.java:231)
at sun.reflect.GeneratedMethodAccessor401.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:28 8)
at $Proxy16.invoke(Unknown Source)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:734)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:560)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:383)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:165)
Completed: testGetAllTasksForSpecificProcessAsBeansIt appears as though I have stumbled on the answer to my own question. In the task filter, I should be using TaskSearchingConstants.pCURRENT_ASSIGNMENT_QUEUE_OWNER instead of TaskSearchingConstants.pASSIGNMENT_QUEUE_OWNER.
-
Unifier Web Services - CreateBPRecord throws NullPOinterException
I am attempting to call the "createBPRecord" web service to add a "Vendor Log" entry, and am getting a NullPointerException. I followed the instructions in the documentation to first call getBORecord to obtain the proper structure. I did this, and with this structure I am able to call "updateBPRecord" and update a record I created through the UI. However, this same structure is throwing an error when call the "createBPRecord" service. Something strange is that the call works temporarily. Despite the error, I can perform a find for the "Vendor Log" entry and it is returned. After a brief period though, it disappears and it is no longer returned with the find operation.
Is anyone else having this, or a similar issue?Note: Following the same approach, I was able to create a "Vendor Evaluation" BP record. This problem seems to be specific to creating a BP record for the "Vendors" BP.
-
DefaultTreeModel.removeNodeFromParent throwing NullPointerException
I have an applet which involves editing data represented by a JTree. However, I'm getting this exception when I try to remove a node from the tree (to move it by subsequently inserting it at +/-1 position):
java.lang.NullPointerException
at javax.swing.plaf.basic.BasicTreeUI.completeEditing(Unknown Source)
at javax.swing.plaf.basic.BasicTreeUI.completeEditing(Unknown Source)
at javax.swing.plaf.basic.BasicTreeUI$TreeSelectionHandler.valueChanged(Unknown Source)
at javax.swing.tree.DefaultTreeSelectionModel.fireValueChanged(Unknown Source)
at javax.swing.tree.DefaultTreeSelectionModel.notifyPathChange(Unknown Source)
at javax.swing.tree.DefaultTreeSelectionModel.removeSelectionPaths(Unknown Source)
at javax.swing.JTree.removeDescendantSelectedPaths(Unknown Source)
at javax.swing.JTree.removeDescendantSelectedPaths(Unknown Source)
at javax.swing.JTree$TreeModelHandler.treeNodesRemoved(Unknown Source)
at javax.swing.tree.DefaultTreeModel.fireTreeNodesRemoved(Unknown Source)
at javax.swing.tree.DefaultTreeModel.nodesWereRemoved(Unknown Source)
at javax.swing.tree.DefaultTreeModel.removeNodeFromParent(Unknown Source)
at ...[my code from here]This is the code that moves the node:
DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode)myTree.getLastSelectedPathComponent();
factbookTree.setEnabled(false);
DefaultMutableTreeNode parent = (DefaultMutableTreeNode)selectedNode.getParent();
DefaultTreeModel treeModel = (DefaultTreeModel)factbookTree.getModel();
int oldIndex = treeModel.getIndexOfChild(parent,selectedNode);
int newIndex = oldIndex + move;
//throws exception here:
treeModel.removeNodeFromParent(selectedNode);
//This also causes exception:
//parent.remove(selectedNode);
//treeModel.nodesWereRemoved(parent, new int[] {oldIndex}, new Object[] {selectedNode});Any ideas as to what the problem is?
It started throwing this error when I changed my objects overriding JTree and TreeNode, but I'm not doing anything far out here, just getting the CellRenderer to include a JCheckBox and adding code to store the state of the JCheckBox. There is no multithreading that I'm adding. The node is being visibly removed from the applet before the exception. My only thought was that I needed to initialise the tree model somwhere myself - the tree is being constructed by passing it the root node.
I'm using JDK 1.4.1 as a JApplet with the Java Plug-In on W2K.
cheers,
AndyYeah, I checked that it wasn't null. I've hacked the code down and here's a complete listing which shows the problem, apologies for dodgy formatting. The code is modified from the JCheckTree implementation I found at http://www.fawcette.com/archives/premier/mgznarch/javapro/2001/01jan01/vc0101/vc0101.asp
// FactbookBrowser.java
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.net.*;
import javax.swing.*;
import javax.swing.tree.*;
import javax.swing.event.*;
public class FactbookBrowser extends JApplet implements ActionListener {
JButton upButton;
JButton downButton;
JCheckTree factbookTree;
public FactbookBrowser() {
//Set up the tree display
CheckTreeNode root = new CheckTreeNode("Root");
CheckTreeNode one = new CheckTreeNode("one");
CheckTreeNode two = new CheckTreeNode("two");
CheckTreeNode three = new CheckTreeNode("three");
root.add(one);
root.add(two);
root.add(three);
factbookTree = new JCheckTree(root);
factbookTree.getSelectionModel().setSelectionMode(
TreeSelectionModel.SINGLE_TREE_SELECTION
factbookTree.putClientProperty("JTree.lineStyle", "Angled");
JPanel moveButtons = new JPanel();
upButton = new JButton("up");
downButton = new JButton("down");
moveButtons.add(upButton);
moveButtons.add(downButton);
upButton.addActionListener(this);
downButton.addActionListener(this);
//Add everything to scrollpanes, split panes and this
JScrollPane treeScroll = new JScrollPane(factbookTree);
JPanel treePanel = new JPanel();
treePanel.setLayout(new BorderLayout());
treePanel.add(treeScroll, BorderLayout.CENTER);
treePanel.add(moveButtons, BorderLayout.SOUTH);
this.getContentPane().setLayout(new BorderLayout());
this.getContentPane().add(treePanel, BorderLayout.CENTER);
private void moveNode(int move) {
DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode)factbookTree.getLastSelectedPathComponent();
if ((move == -1) && (selectedNode.getPreviousSibling() == null)) {
System.out.println("Node already at start of section, can't move up");
return;
} else if ((move == 1) && (selectedNode.getNextSibling() == null)) {
System.out.println("Node already at end of section, can't move down");
return;
} else if ((move != 1) && (move != -1)) {
System.out.println("Can't move node more than one place");
return;
DefaultMutableTreeNode parent = (DefaultMutableTreeNode)selectedNode.getParent();
DefaultTreeModel treeModel = (DefaultTreeModel)factbookTree.getModel();
int oldIndex = treeModel.getIndexOfChild(parent,selectedNode);
int newIndex = oldIndex + move;
System.out.println("*** treeModel:"+treeModel+" selectedNode:"+selectedNode+" new index:"+newIndex);
//@todo Throwing exception here! WHY?
treeModel.removeNodeFromParent(selectedNode);
//parent.remove(selectedNode);
//treeModel.nodesWereRemoved(parent, new int[] {oldIndex}, new Object[] {selectedNode});
System.out.println("*** Removed node, inserting");
treeModel.insertNodeInto(selectedNode,parent,newIndex);
System.out.println("*** Inserted Node");
TreePath newPath = new TreePath(selectedNode.getPath());
factbookTree.scrollPathToVisible(newPath);
factbookTree.setSelectionPath(newPath);
factbookTree.repaint();
public void actionPerformed(ActionEvent ae) {
if (ae.getSource() == upButton) {
//Move the currently selected node up within its folder
moveNode(-1);
} else if (ae.getSource() == downButton) {
//Move the currently selected node up within its folder
moveNode(1);
public static void main(String[] args) {
FactbookBrowser browser = new FactbookBrowser();
// JCheckTree.java
import java.awt.*;
import javax.swing.*;
import javax.swing.tree.*;
public class JCheckTree extends JTree {
public JCheckTree(TreeNode root) {
super(root);
super.setCellRenderer(new CheckTreeCellRenderer(this));
setCellEditor(new CheckTreeCellEditor(this));
setEditable(true);
public void setCellRenderer(TreeCellRenderer renderer) {
super.setCellRenderer(new CheckTreeCellRenderer(this, renderer));
public void setEditorRenderer(TreeCellRenderer renderer) {
setCellEditor(new CheckTreeCellEditor(this, renderer));
// CheckTreeNode.java
import java.util.*;
import javax.swing.tree.*;
public class CheckTreeNode extends DefaultMutableTreeNode {
protected boolean selected, propagate;
public CheckTreeNode(Object data) {
this(data, false, true);
public CheckTreeNode(Object data, boolean selected) {
this(data, selected, true);
public CheckTreeNode(Object data, boolean selected, boolean propagate) {
super(data);
this.selected = selected;
this.propagate = propagate;
public boolean isSelected() {
return selected;
public void setSelected(boolean selected) {
this.selected = selected;
if (propagate)
propagateSelected(selected);
public void propagateSelected(boolean selected) {
Enumeration enum = children();
while (enum.hasMoreElements()) {
CheckTreeNode node = (CheckTreeNode)enum.nextElement();
node.setSelected(selected);
public void setUserObject(Object obj) {
if (obj == this) return;
super.setUserObject(obj);
// CheckTreeCellRenderer.java
import java.awt.*;
import java.util.*;
import javax.swing.*;
import javax.swing.tree.*;
public class CheckTreeCellRenderer extends JPanel implements TreeCellRenderer {
protected CheckTreeNode node;
protected TreeCellRenderer renderer;
protected JCheckBox check;
public CheckTreeCellRenderer(JTree tree) {
this(tree, new DefaultTreeCellRenderer());
public CheckTreeCellRenderer(JTree tree, TreeCellRenderer renderer) {
setLayout(new BorderLayout());
this.renderer = renderer;
add(BorderLayout.CENTER,
renderer.getTreeCellRendererComponent(tree, "", true, true, true, 0, true));
check = new JCheckBox();
add(BorderLayout.WEST, check);
public Component getTreeCellRendererComponent(JTree tree,
Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus) {
if (value instanceof CheckTreeNode) {
node = (CheckTreeNode)value;
check.setSelected(node.isSelected());
value = node.getUserObject();
renderer.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
return this;
// CheckTreeCellEditor.java
import java.awt.*;
import java.util.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.tree.*;
import javax.swing.event.*;
public class CheckTreeCellEditor extends CheckTreeCellRenderer implements TreeCellEditor, ActionListener {
protected CellEditorListener list;
public CheckTreeCellEditor(JTree tree)
this(tree, new DefaultTreeCellRenderer());
public CheckTreeCellEditor(JTree tree, TreeCellRenderer renderer)
super(tree, renderer);
check.addActionListener(this);
public Component getTreeCellEditorComponent(
JTree tree, Object value, boolean selected,
boolean expanded, boolean leaf, int row)
return getTreeCellRendererComponent(
tree, value, true, expanded, leaf, row, true);
public boolean stopCellEditing()
return true;
public Object getCellEditorValue()
node.setSelected(check.isSelected());
return node;
public boolean isCellEditable(EventObject event)
return true;
public boolean shouldSelectCell(EventObject event)
return true;
public void cancelCellEditing()
fireEditingCanceled();
HashSet listeners = new HashSet();
public void addCellEditorListener(CellEditorListener listener) {
listeners.add(listener);
public void removeCellEditorListener(CellEditorListener listener) {
listeners.remove(listener);
protected void fireEditingStopped() {
Iterator i = listeners.iterator();
while (i.hasNext()) {
((CellEditorListener)i.next()).editingStopped(new ChangeEvent(this));
protected void fireEditingCanceled() {
Iterator i = listeners.iterator();
while (i.hasNext()) {
((CellEditorListener)i.next()).editingCanceled(new ChangeEvent(this));
public void actionPerformed(ActionEvent event) {
fireEditingStopped();
} -
I'm using Tiger 10.4.11 and had to wipe my drive and reload my system from the install discs yesterday,
Now I'm running Itunes version 4! It won't let me access the store, I've tried everything on the help pages,
EVERYTHING, I need a older version of Itunes, but not as old as version 4, which, no, it will not upgrade
automatically for me, it says no upgrade available. Why does Mac not support older versions of
its operating systems, why do they make it so hard to find help for those system users other than
the money of course, but have you seen the stock lately? They got enough money.Yup, your question and Diane's answer helped me also. Tho' I had had problems before getting into the iTunes store I always managed to find a way. Today they had me blocked cold with the "Update to 10" advert no matter what I did. Other questioners are being told, incorrectly as it turns out, that they have to update their OS to accomodate iTunes 10 and upgrade to iTunes 10. I did the download which did not take up much more room on my crowded old hard drive and now I'm back in business.
-
Uploading large files from applet to servlet throws out of memory error
I have a java applet that needs to upload files from a client machine
to a web server using a servlet. the problem i am having is that in
the current scheme, files larger than 17-20MB throw an out of memory
error. is there any way we can get around this problem? i will post
the client and server side code for reference.
Client Side Code:
import java.io.*;
import java.net.*;
// this class is a client that enables transfer of files from client
// to server. This client connects to a servlet running on the server
// and transmits the file.
public class fileTransferClient
private static final String FILENAME_HEADER = "fileName";
private static final String FILELASTMOD_HEADER = "fileLastMod";
// this method transfers the prescribed file to the server.
// if the destination directory is "", it transfers the file to
"d:\\".
//11-21-02 Changes : This method now has a new parameter that
references the item
//that is being transferred in the import list.
public static String transferFile(String srcFileName, String
destFileName,
String destDir, int itemID)
if (destDir.equals(""))
destDir = "E:\\FTP\\incoming\\";
// get the fully qualified filename and the mere filename.
String fqfn = srcFileName;
String fname =
fqfn.substring(fqfn.lastIndexOf(File.separator)+1);
try
//importTable importer = jbInit.getImportTable();
// create the file to be uploaded and a connection to
servlet.
File fileToUpload = new File(fqfn);
long fileSize = fileToUpload.length();
// get last mod of this file.
// The last mod is sent to the servlet as a header.
long lastMod = fileToUpload.lastModified();
String strLastMod = String.valueOf(lastMod);
URL serverURL = new URL(webadminApplet.strServletURL);
URLConnection serverCon = serverURL.openConnection();
// a bunch of connection setup related things.
serverCon.setDoInput(true);
serverCon.setDoOutput(true);
// Don't use a cached version of URL connection.
serverCon.setUseCaches (false);
serverCon.setDefaultUseCaches (false);
// set headers and their values.
serverCon.setRequestProperty("Content-Type",
"application/octet-stream");
serverCon.setRequestProperty("Content-Length",
Long.toString(fileToUpload.length()));
serverCon.setRequestProperty(FILENAME_HEADER, destDir +
destFileName);
serverCon.setRequestProperty(FILELASTMOD_HEADER, strLastMod);
if (webadminApplet.DEBUG) System.out.println("Connection with
FTP server established");
// create file stream and write stream to write file data.
FileInputStream fis = new FileInputStream(fileToUpload);
OutputStream os = serverCon.getOutputStream();
try
// transfer the file in 4K chunks.
byte[] buffer = new byte[4096];
long byteCnt = 0;
//long percent = 0;
int newPercent = 0;
int oldPercent = 0;
while (true)
int bytes = fis.read(buffer);
byteCnt += bytes;
//11-21-02 :
//If itemID is greater than -1 this is an import file
transfer
//otherwise this is a header graphic file transfer.
if (itemID > -1)
newPercent = (int) ((double) byteCnt/ (double)
fileSize * 100.0);
int diff = newPercent - oldPercent;
if (newPercent == 0 || diff >= 20)
oldPercent = newPercent;
jbInit.getImportTable().displayFileTransferStatus
(itemID,
newPercent);
if (bytes < 0) break;
os.write(buffer, 0, bytes);
os.flush();
if (webadminApplet.DEBUG) System.out.println("No of bytes
sent: " + byteCnt);
finally
// close related streams.
os.close();
fis.close();
if (webadminApplet.DEBUG) System.out.println("File
Transmission complete");
// find out what the servlet has got to say in response.
BufferedReader reader = new BufferedReader(
new
InputStreamReader(serverCon.getInputStream()));
try
String line;
while ((line = reader.readLine()) != null)
if (webadminApplet.DEBUG) System.out.println(line);
finally
// close the reader stream from servlet.
reader.close();
} // end of the big try block.
catch (Exception e)
System.out.println("Exception during file transfer:\n" + e);
e.printStackTrace();
return("FTP failed. See Java Console for Errors.");
} // end of catch block.
return("File: " + fname + " successfully transferred.");
} // end of method transferFile().
} // end of class fileTransferClient
Server side code:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.net.*;
// This servlet class acts as an FTP server to enable transfer of
files
// from client side.
public class FtpServerServlet extends HttpServlet
String ftpDir = "D:\\pub\\FTP\\";
private static final String FILENAME_HEADER = "fileName";
private static final String FILELASTMOD_HEADER = "fileLastMod";
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException,
IOException
doPost(req, resp);
public void doPost(HttpServletRequest req, HttpServletResponse
resp)
throws ServletException,
IOException
// ### for now enable overwrite by default.
boolean overwrite = true;
// get the fileName for this transmission.
String fileName = req.getHeader(FILENAME_HEADER);
// also get the last mod of this file.
String strLastMod = req.getHeader(FILELASTMOD_HEADER);
String message = "Filename: " + fileName + " saved
successfully.";
int status = HttpServletResponse.SC_OK;
System.out.println("fileName from client: " + fileName);
// if filename is not specified, complain.
if (fileName == null)
message = "Filename not specified";
status = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
else
// open the file stream for the file about to be transferred.
File uploadedFile = new File(fileName);
// check if file already exists - and overwrite if necessary.
if (uploadedFile.exists())
if (overwrite)
// delete the file.
uploadedFile.delete();
// ensure the directory is writable - and a new file may be
created.
if (!uploadedFile.createNewFile())
message = "Unable to create file on server. FTP failed.";
status = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
else
// get the necessary streams for file creation.
FileOutputStream fos = new FileOutputStream(uploadedFile);
InputStream is = req.getInputStream();
try
// create a buffer. 4K!
byte[] buffer = new byte[4096];
// read from input stream and write to file stream.
int byteCnt = 0;
while (true)
int bytes = is.read(buffer);
if (bytes < 0) break;
byteCnt += bytes;
// System.out.println(buffer);
fos.write(buffer, 0, bytes);
// flush the stream.
fos.flush();
} // end of try block.
finally
is.close();
fos.close();
// set last mod date for this file.
uploadedFile.setLastModified((new
Long(strLastMod)).longValue());
} // end of finally block.
} // end - the new file may be created on server.
} // end - we have a valid filename.
// set response headers.
resp.setContentType("text/plain");
resp.setStatus(status);
if (status != HttpServletResponse.SC_OK)
getServletContext().log("ERROR: " + message);
// get output stream.
PrintWriter out = resp.getWriter();
out.println(message);
} // end of doPost().
} // end of class FtpServerServletOK - the problem you describe is definitely what's giving you grief.
The workaround is to use a socket connection and send your own request headers, with the content length filled in. You may have to multi-part mime encode the stream on its way out as well (I'm not about that...).
You can use the following:
http://porsche.cis.udel.edu:8080/cis479/lectures/slides-04/slide-02.html
on your server to get a feel for the format that the request headers need to take.
- Kevin
I get the out of Memory Error on the client side. I
was told that this might be a bug in the URLConnection
class implementation that basically it wont know the
content length until all the data has been written to
the output stream, so it uses an in memory buffer to
store the data which basically causes memory issues..
do you think there might be a workaround of any kind..
or maybe a way that the buffer might be flushed after
a certain size of file has been uploaded.. ?? do you
have any ideas? -
GetImage() throws nullpointerException in Netscape (but not IE)
1. Does getImage work on Netscape Navigator? When I load pictures to my applet, NN's java console doesn't say anything. After creating a new Panel that actually uses the Images, applet gives a nullPointerException because of the images. The same code works in Internet Explorer and appletviewer.
2. What ways do I have for loading Images to my applet? Is there an optional way other than getImage?
Thanks in advance,
Rakhi
Here's the code sample :
The commented areas are the various possiblities I have tried without success.
import java.awt.*;
import java.net.*;
import java.awt.image.*;
import java.applet.*;
public class ImageTrial extends Applet {
Image baseImage;
public void init() {
baseImage = getImage(getCodeBase(),"xxx.gif");
//baseImage = getImage(getDocumentBase(),"xxx.gif");
/*try {
URL u = new URL("http://localhost:8080/xxx.gif");
baseImage = getImage(u);
} catch (MalformedURLException m) {m.printStackTrace(); }
/*try {
URL u = new URL("http://127.00.00.01/xxx.gif");
baseImage = getImage(u);
} catch (MalformedURLException m) {m.printStackTrace(); }
/*try {
URL u = new URL(getDocumentBase(),"xxx.gif");
baseImage = getImage(u);
} catch (MalformedURLException m) {m.printStackTrace(); }
/*MediaTracker mt = new MediaTracker(this);
mt.addImage(baseImage,0);
try {
mt.waitForID(0);
catch (InterruptedException e) { e.printStackTrace(); }
if (baseImage == null)
System.out.println("image is null");
else
System.out.println("image is not null");
repaint();
public void paint(Graphics g) {
if (baseImage == null)
g.drawString("IMAGE DISPLAY ERROR:IMAGE IS NULL",10,10);
else
g.drawImage(baseImage,10,10,this);
The following is the HTML code:
<APPLET CODEBASE="/jsdk/webpages/NeGraphical" CODE="ImageTrial.class" WIDTH = 100 , HEIGHT = 100>
</APPLET>Hi !
I've tried this code and it works on both IE and Netscape:
import java.awt.*;
import java.net.*;
import java.awt.image.*;
import java.applet.*;
public class ImageTrial extends Applet
Image baseImage;
public void init()
URL imageURL;
Class cl = ((Applet)this).getClass();
imageURL = cl.getResource("java.gif");
baseImage = getImage(imageURL);
if(baseImage == null)
System.out.println("image is null");
else
System.out.println("image is not null");
repaint();
public void paint(Graphics g)
if(baseImage == null)
g.drawString("IMAGE DISPLAY ERROR: IMAGE IS NULL",10,10);
else
g.drawImage(baseImage,10,10,this);
}With this html code:
<HTML>
<HEAD>
<TITLE>Image Test</TITLE>
<BODY BGCOLOR="FFF3A8" text="00686D">
<CENTER>
<HR WIDTH=40% ALIGN=CENTER>
<B>Image Test</B>
<HR WIDTH=40% ALIGN=CENTER><BR>
<SCRIPT LANGUAGE="JavaScript">
<!--
var _info = navigator.userAgent;
var _ns = false;
var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
//-->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript1.1">
<!--
if(!_ie)
var _ns = (navigator.appName.indexOf("Netscape") >= 0
&& ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0
&& java.lang.System.getProperty("os.version").indexOf("3.5") < 0)
|| _info.indexOf("Sun") > 0));
//-->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!--
if(_ie == true)
document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" ' +
'WIDTH = 400 ' +
'HEIGHT = 200 ' +
'align = baseline ' +
'codebase = "/plugin/j2re1_3_0_win.exe"><NOEMBED><XMP>');
else if(_ns == true)
document.writeln('<EMBED ' +
'type="application/x-java-applet;version=1.3" ' +
'width=400 height=200 align=baseline ' +
'code="ImageTrial.class" ' +
'pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html" ' +
'frame="task"><NOEMBED><XMP>');
//-->
</SCRIPT>
<APPLET CODE="ImageTrial.class"
ALIGN="baseline"
WIDTH="400"
HEIGHT="200">
</XMP>
<PARAM NAME="java_code" VALUE="ImageTrial.class">
<PARAM NAME="java_type" VALUE="application/x-java-applet;version=1.3">
<PARAM NAME="scriptable" VALUE="true">
ALT = "Your browser understands the <APPLET> tag but isn't running the applet, for some reason."
<B>No JDK 1.3 support for APPLET!!</B>
</APPLET></NOEMBED></EMBED>
</OBJECT>
</CENTER>
</BODY>
</HTML>Hope it helps...let me know...
Maybe you are looking for
-
Time Machine not displaying backups of mounted /Users
Bottom Line: Time Machine 'Warp' GUI does not display available backups when using Finder to browser user directories stored on HDD, mounted on /Users in /etc/fstab, even though the backups exist and I can navigate to them from the Finder to the back
-
I get redirects always in current open page. If I click a link and say open in new tab or new window it does not redirect. I've noticed explorer is now advertising built in software to eliminate someone hijacking their browser. If I have to keep sear
-
Problem adding clips to Sceneline.
When I try to add clips to the sceneline, the programme places them under the first clip, so I cannot edit or use transitions.
-
TS3899 Unable to access web link within a received emails, how to correct?
Recently I am not able total on web links embedded within emails I receive. Can anyone help?
-
http://www.jordankrose.com/jkr_shortStories2.html EVA PRIM WRITES- CHOICES. ANARCHY. HYPOCRISY. this section (shorts3) has been a nightmare. The buyshorts3 div will not format correctly; it was going under the text below, so I moved it above the tex