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,
Andy

Yeah, 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();
}

Similar Messages

  • 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 PM

    Hi,
    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/]

  • Weblogic throws NullPointerException when using ServiceControl.setTimeout

    We are invoking a SOAP service via a com.bea.control.ServiceControl that was generated from a WSDL (right click WSDL, Generate Service Control) using Weblogic 8.1.6.
    SOAP service execution is successful using an http and https endpoint. However, when setting a timeout via ServiceControl.setTimeout(int millisecods) method, the Weblogic API is throwing a NullPointerException when using an https endpoint. When using an http endpoint with the setTimeout method execution is successful.
    DEBUG com.bea.wlw.runtime.jws.call.SoapHttpCall [ExecuteThread: '10' for queue: 'weblogic.kernel.Default']: opening connection to https://[... edit removed ...]
    DEBUG com.bea.wlw.runtime.jws.call.SoapHttpCall [ExecuteThread: '10' for queue: 'weblogic.kernel.Default']: Response generation exception
    Throwable: java.lang.NullPointerException
    Stack Trace:
    java.lang.NullPointerException
         at weblogic.net.http.HttpsClient.openWrappedSSLSocket(HttpsClient.java:455)
         at weblogic.net.http.HttpsClient.openServer(HttpsClient.java:235)
         at weblogic.net.http.HttpsClient.openServer(HttpsClient.java:389)
         at weblogic.net.http.HttpsClient.<init>(HttpsClient.java:209)
         at weblogic.net.http.HttpClient.New(HttpClient.java:228)
         at weblogic.net.http.HttpsURLConnection.getHttpClient(HttpsURLConnection.java:246)
         at weblogic.net.http.HttpsURLConnection.connect(HttpsURLConnection.java:217)
         at weblogic.net.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:189)
         at com.bea.wlw.runtime.jws.call.SoapHttpCall.invoke(SoapHttpCall.java:179)
         at com.bea.wlw.runtime.jws.call.SoapHttpCall.invoke(SoapHttpCall.java:80)
         at com.bea.wlw.runtime.core.control.ServiceControlImpl.invoke(ServiceControlImpl.jcs:1288)
         at com.bea.wlw.runtime.core.control.ServiceControlImpl.invoke(ServiceControlImpl.jcs:1155)
         at com.bea.wlw.runtime.core.dispatcher.DispMethod.invoke(DispMethod.java:377)
         at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:433)
         at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:406)
         at com.bea.wlw.runtime.jcs.container.JcsProxy.invoke(JcsProxy.java:388)
    DEBUG com.bea.wlw.runtime.jws.call.SoapFault [ExecuteThread: '10' for queue: 'weblogic.kernel.Default']: SoapFault exception throwable e
    DEBUG com.bea.wlw.runtime.jws.call.SoapHttpCall [ExecuteThread: '10' for queue: 'weblogic.kernel.Default']: response code=0, responseMsg=null
    DEBUG com.bea.wlw.runtime.jws.call.SoapHttpCall [ExecuteThread: '10' for queue: 'weblogic.kernel.Default']: closed connection to https://[... edit removed ...]
    WARN WLW.INVOKE.[... edit removed ...] [ExecuteThread: '10' for queue: 'weblogic.kernel.Default']: Id=[... edit removed id ...] Method=[... edit removed method ...]; Failure=com.bea.control.ServiceControlException: SERVICE FAULT:
    Code:java.lang.NullPointerException
    String:null
    Detail:
    END SERVICE FAULT
    ERROR [... edit removed ...]
    [ExecuteThread: '10' for queue: 'weblogic.kernel.Default']: ServiceControlException
    com.bea.control.ServiceControlException: SERVICE FAULT:
    Code:java.lang.NullPointerException
    String:null
    Detail:
    END SERVICE FAULT
         at com.bea.wlw.runtime.core.control.ServiceControlImpl.invoke(ServiceControlImpl.jcs:1268)
         at com.bea.wlw.runtime.core.dispatcher.DispMethod.invoke(DispMethod.java:377)
         at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:433)
         at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:406)
         at com.bea.wlw.runtime.jcs.container.JcsProxy.invoke(JcsProxy.java:388)

    Thanks for the suggestion. But with -DUseSunHttpHandler=true the Weblogic API is throwing a ClassCastException with or without the timeout value set.
    Failure=com.bea.control.ServiceControlException: SERVICE FAULT:
    Code:java.lang.ClassCastException
    String:null
    Detail:
    END SERVICE FAULT
    ERROR: ServiceControlException
    com.bea.control.ServiceControlException: SERVICE FAULT:
    Code:java.lang.ClassCastException
    String:null
    Detail:
    END SERVICE FAULT
         at com.bea.wlw.runtime.core.control.ServiceControlImpl.invoke(ServiceControlImpl.jcs:1268)
         at com.bea.wlw.runtime.core.dispatcher.DispMethod.invoke(DispMethod.java:377)
         at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:433)
         at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:406)
         at com.bea.wlw.runtime.jcs.container.JcsProxy.invoke(JcsProxy.java:388)

  • Af:inputListOfValues without values throws NullPointerException

    Hello!
    In some cases we have an af:inputListOfValues without any values, due to restrictions in the query. Unfortunately, a NullPointerException is thrown in this case. Actually, we are using JDev 11.1.1.5.
    Is there any solution or workaround to allow empty af:inputListOfValues?
    Regards,
    Christoph
    Edited by: mephistopheles on Sep 3, 2012 11:47 PM

    Hi,
    can you verify with JDeveloper 11.1.1.6 and provide a reproducible set of steps if it reproduces? Also I am wondering if the NPE is throw when you close the LOV or when you submit the form later
    Frank

  • Edit locally throws NullPointerException

    Hi All,
    While doing EditLocally  in a Custom Repository Manager,it throws a null pointer Exception.
    As per the Repository Manager Implementation
    log ,we don’t any exception. So as there is no such relevent error realted to repository manager in default.trc file.
    RF doesn’t pass call to setContent() method of ContentManager.
    We failed to do so in Nw04 SPS11 and Nw04 SPS14.
    Where as we can able to edit successfully in NW04 SPS09.
    Regards
    Arati
    Following is the stack trace we got in iview of edit locally
    Please wait
    Your request is being processed
    System Error
    An exception occurred during the program execution. Below you will find technical information pertaining to this exception that you might want to forward to your system administrator.
    Exception Class 
    Call Stack java.lang.NullPointerException
            at com.sapportals.wcm.control.edit.ResourceClientSideEditControl.renderLockedByUser(ResourceClientSideEditControl.java:1029)
            at com.sapportals.wcm.control.edit.ResourceClientSideEditControl.renderIsLockedByOther(ResourceClientSideEditControl.java:344)
            at com.sapportals.wcm.control.edit.ResourceClientSideEditControl.renderCurrentConditions(ResourceClientSideEditControl.java:302)
            at com.sapportals.wcm.control.edit.ResourceClientSideEditControl.render(ResourceClientSideEditControl.java:191)
            at com.sapportals.wdf.layout.HorizontalLayout.renderControls(HorizontalLayout.java:42)
            at com.sapportals.wdf.stack.Pane.render(Pane.java:155)
            at com.sapportals.wdf.stack.PaneStack.render(PaneStack.java:67)
            at com.sapportals.wdf.layout.HorizontalLayout.renderPanes(HorizontalLayout.java:73)
            at com.sapportals.wdf.stack.Pane.render(Pane.java:158)
            at com.sapportals.wdf.stack.PaneStack.render(PaneStack.java:67)
            at com.sapportals.wdf.layout.HorizontalLayout.renderPanes(HorizontalLayout.java:73)
            at com.sapportals.wdf.stack.Pane.render(Pane.java:158)
            at com.sapportals.wdf.stack.PaneStack.render(PaneStack.java:67)
            at com.sapportals.wdf.layout.HorizontalLayout.renderPanes(HorizontalLayout.java:73)
            at com.sapportals.wdf.stack.Pane.render(Pane.java:158)
            at com.sapportals.wdf.stack.PaneStack.render(PaneStack.java:67)
            at com.sapportals.wdf.WdfCompositeController.internalRender(WdfCompositeController.java:696)
            at com.sapportals.wdf.WdfCompositeController.buildComposition(WdfCompositeController.java:664)
            at com.sapportals.htmlb.AbstractCompositeComponent.preRender(AbstractCompositeComponent.java:33)
            at com.sapportals.htmlb.Container.preRender(Container.java:118)
            at com.sapportals.htmlb.Container.preRender(Container.java:118)
            at com.sapportals.htmlb.Container.preRender(Container.java:118)
            at com.sapportals.portal.htmlb.PrtContext.render(PrtContext.java:413)
            at com.sapportals.htmlb.page.DynPage.doOutput(DynPage.java:237)
            at com.sapportals.wcm.portal.component.base.KMControllerDynPage.doOutput(KMControllerDynPage.java:130)
            at com.sapportals.htmlb.page.PageProcessor.handleRequest(PageProcessor.java:129)
            at com.sapportals.portal.htmlb.page.PageProcessorComponent.doContent(PageProcessorComponent.java:134)
            at com.sapportals.wcm.portal.component.base.ControllerComponent.doContent(ControllerComponent.java:73)
            at com.sapportals.portal.prt.component.AbstractPortalComponent.doRefresh(AbstractPortalComponent.java:355)
            at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:188)
            at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
            at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
            at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
            at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
            at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215)
            at com.sapportals.portal.pb.IviewModeProxy.doContent(IviewModeProxy.java:20)
            at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)
            at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
            at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
            at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
            at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
            at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215)
            at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:646)
            at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
            at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
            at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
            at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:753)
            at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:240)
            at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:522)
            at java.security.AccessController.doPrivileged(Native Method)
            at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:405)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
            at com.sap.engine.services.servlets_jsp.server.servlet.InvokerServlet.service(InvokerServlet.java:156)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
            at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
            at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
            at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
            at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
            at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
            at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
            at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
            at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
            at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
            at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
            at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
            at java.security.AccessController.doPrivileged(Native Method)
            at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:95)
            at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:160)
    Report Error

    Some more behavior of this problem
    1)when try to edit locally>file download started and open the file in approprite application>and in the KM iview got the null pointer exception(which usually have check in now, check in later, cancel local editing buttons)
    2) When resume local editing...nothing happens. Even doesn’t through error in iview
    3) when do a lock explicitly to any document- through selection->lock,it puts a check_out_by_me symbol rather than lock_by_me symbol
    Please any body help to resolve the issue,
    Regards
    arati

  • HttpConnection throws NullPointerException

    Hi everybody !
    I'm faceing an odd problem here. I have developed an J2ME (MIDP1.0) application that, among other things, needs to comunicate with my server. The application woks fine on the emulator, it even works great on my phone (Nokia 2650) and on my partners phone (Nokia 6610), but when tested on other phones (SonyErricson, Sagem, Motorola, even an smartphone from Nokia, a 7610 i think) it throws a NullPointerException. I've run out of ideeas regading how to solve this. Here's the piece of code that bugs me:
    public void run(){
            Pachet raspuns = null;               
            display.setCurrent(forma);
            progress.setLabel("Trying to connect");       
            try {
                conn = (HttpConnection) Connector.open(URL, Connector.READ_WRITE);
                conn.setRequestMethod( HttpConnection.POST );
                conn.setRequestProperty("Content-Type", "application/vnd.wap.wmlc");
                byte[] dataForSend = deTrimis.getRawData();
                conn.setRequestProperty("Content-Length", ""+dataForSend.length);
                progress.setLabel("Sending request");
                progress.setValue(25);                      
                forma.append("Opening outputstream\n");
                os = conn.openOutputStream();
                forma.append("Sending data\n");           
                os.write( dataForSend );
                forma.append("Flushing data\n");           
                os.flush();      // this throws the exception
                forma.append("Closing stream\n");           
                os.close();    // if i remove the "os.flush()", the exception is thrown here
                forma.append("Getting response code\n");
                int code = conn.getResponseCode(); // if i remove both os.flush() and os.close() the exception is thrown here !!!
                forma.append("Response code = "+code+"\n");                          
                progress.setLabel("Checking response");
                progress.setValue(50);
                if (code != HttpConnection.HTTP_OK){
                     throw new Exception (conn.getResponseMessage()+"("+code+")");
                progress.setLabel("Reading data");
                progress.setValue(75);           
                if (!aborted){
                    dIn = conn.openDataInputStream();               
                    raspuns = new Pachet();
                    raspuns.readPackage(dIn);
                if (!aborted)
                    listener.packageReceived(raspuns);           
            } catch (Exception e) {
                forma.append("Connection failed. Reason: "+e.getMessage());           
                e.printStackTrace();
            } finally{
                cleanUp();
        }I really need to get this working, so could please someone give me a hint.
    Thank you,
    Daniel Comsa.

    Hi
    I solved this problem.
    There is nothing wrong with the device but the connection that we use.
    Our service provider does not provide the pure HTTP connection rather it goes over WAP and thats where the problem comes.
    Cause we attach our header for the server and WAP sticks his header in between , thats why server does not handle the request and consider it as bad request.
    I have commented the following lines for my code to work
    connection.setRequestProperty("User-Agent",
    System.getProperty("microedition.profiles"));
    connection.setRequestProperty("Content-Type",
    "application/octet-stream");
    Regards,
    Sushil

  • MTOM throws NullPointerException

    Hello,
    I need to transfer large files (12Mb) of diferent types (.pdf, .jpg, .doc, etc). I changed the return type to DataHandler and tried to enable MTOM in my webservice, but when I enabled it, after the method is executed, system throws a NullPointerException.
    I'm enabling MTOM with the annotation @MTOM, and if I just take off this annotation the webservice works correctly.
    Do you know of any problem using MTOM with Java 1.6.0_10? Do you have a suggestion of a better way to transfer it?
    Thanks

    Tested this with JDK 1.4 and it works with the following changes:
    Make these static:
    static public Writer out;
    static public void validateXml (String xmlSt)
    and, of course adding:
    import java.io.*;
    import org.xml.sax.*;
    import javax.xml.parsers.SAXParserFactory;
    Then here is what I used to test it:
    public class Test2 {
         static public void main(String args[]){
              System.out.println("Hi there");
              String s = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"> <html> <head> <title> Ho there </title> </head> <body> <h1> Hi there </h1> </body> </html>";
              try {
                   xmlResHandler.validateXml(s);
              }catch (Exception ex){
                   ex.printStackTrace();
    }I think you problem make have to do with your management of the "out" Writer.

  • StartElement throws NullPointerException

    hi
    The code below throws a NullPointerException at startElement method ... Can someone help figure out how to fix it ...?
    xmlSt value is set from another method which is NOT NULL.....
    public class xmlResHandler extends HandlerBase
    public void validateXml (String xmlSt) throws Exception
    String xmlString = xmlSt;
    java.io.InputStream input=null;
    input=new java.io.ByteArrayInputStream(xmlString.getBytes());
    out = new OutputStreamWriter (System.out, "UTF8");
    SAXParserFactory factory = SAXParserFactory.newInstance();
    factory.setValidating(true);
    factory.newSAXParser().parse( input, new xmlResHandler());
    System.out.println("validation success in validateXml");
    public Writer out;
    public xmlResHandler(){}
    public void error (SAXParseException e) throws SAXParseException
    throw e;
    public void warning (SAXParseException err) throws SAXParseException
    System.out.println("** Warning" + ", line " + err.getLineNumber () + ", uri " + err.getSystemId ());
    System.out.println(" " + err.getMessage ());
    public void startDocument () throws SAXException
    showData ("<?xml version='1.0' encoding='UTF-8'?>");
    newLine();
    public void endDocument () throws SAXException
    try {
    newLine();
    out.flush ();
    } catch (IOException e) {
    throw new SAXException ("I/O error", e);
    public void startElement (String name, AttributeList attrs) throws SAXException
    showData ("<"+name);
    if (attrs != null) {
    for (int i = 0; i < attrs.getLength (); i++) {
    showData (" ");
    showData (attrs.getName(i)+"=\""+attrs.getValue (i)+"\"");
    showData (">");
    public void endElement (String name) throws SAXException
    showData ("</"+name+">");
    public void characters (char buf [], int offset, int len) throws SAXException
    String s = new String(buf, offset, len);
    showData (s);
    private void showData (String s) throws SAXException
    try {
    System.out.println (s);
    out.flush ();
    } catch (IOException e) {
    throw new SAXException ("I/O error", e);
    private void newLine () throws SAXException
    String lineEnd = System.getProperty("line.separator");
    try {
    System.out.println (lineEnd);
    out.flush ();
    } catch (IOException e) {
    throw new SAXException ("I/O error", e);
    Spent a lot of time ....no luck where i am going wrong ... Thanks for the help in advance
    prabhu

    Tested this with JDK 1.4 and it works with the following changes:
    Make these static:
    static public Writer out;
    static public void validateXml (String xmlSt)
    and, of course adding:
    import java.io.*;
    import org.xml.sax.*;
    import javax.xml.parsers.SAXParserFactory;
    Then here is what I used to test it:
    public class Test2 {
         static public void main(String args[]){
              System.out.println("Hi there");
              String s = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"> <html> <head> <title> Ho there </title> </head> <body> <h1> Hi there </h1> </body> </html>";
              try {
                   xmlResHandler.validateXml(s);
              }catch (Exception ex){
                   ex.printStackTrace();
    }I think you problem make have to do with your management of the "out" Writer.

  • 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: testGetAllTasksForSpecificProcessAsBeans 

    It 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.

  • ImapFolder.getAttributes() throws NullPointerException

    When we call ImapFolder.getAttributes() we sometimes get NullPointerException. We we dig in the source code of javamail and we saw that it will be possibly a bug ;
    Here is code block of getAttributes method:
        public String[] getAttributes() throws MessagingException {
         if (attributes == null)
             exists();          // do a LIST to set the attributes     
         return (String[])(attributes.clone());
        }Here when attributes attribute is null exists() method is called to fill this attribute but at exist() method;
         } else {
             exists = opened;
             attributes = null;
    .this else block says that even if we call exists() method attributes attribute can be null!
    after calling exists() method our attributes attribute is null and when it is called "attributes.clone()" it causes NullPointerException.

    The exists() method will fail to fill in attributes only if the LIST command
    returns no information about the folder, which should only happen if the
    folder doesn't exist. I'd love to see a protocol trace from your server
    showing the response to the LIST command. What server are you using?
    How are you sure that the folder exists? Is it a folder that always exists?
    Is the folder never removed and recreated? Is getAttributes being called
    on an open folder?
    Again, I agree that getAttributes should detect this case, but when it detects this case
    it would would throw a FolderNotFoundException rather than a NullPointerException.
    On some servers it may be possible for the folder to be open (and thus "exist"),
    but have been removed, so that LIST shows no evidence of the folder. In this case
    getAttributes should return an empty String array.
    But again, I'd still like to know what conditions are causing this problem for you,
    to make sure I fix all the possible cases correctly.

  • XMLBean.validate() throws NullPointerException

    I have an XML file that is valid against a schema. I created the XMLBeans for the schema and can create (in code) the XMLBean and call .validate() on the XMLBean and it is in fact valid. I can also validate the XML file just fine.
    I then send that XMLBean (either loaded from a file or created in code) (as a string of XML) to an EJB. The EJB creates the XMLBean successfully, but when it calls .validate() it throws a NullPointerException. Here is the stack trace:
    Valid: true
    Exception in thread "main" java.rmi.RemoteException: EJB Exception: ; nested exc
    eption is:
    java.lang.NullPointerException
    at weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundRequest.j
    ava:108)
    at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
    ef.java:284)
    at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
    ef.java:244)
    at aaa.bbb.ccc.ddd.ejb.FOOCatalog_2fiik0_EOImpl_813_WLStub.create(
    Unknown Source)
    at aaa.bbb.ccc.ddd.CatalogProxy.create(FooCatalogProxy.java:234)
    at FooPublish.main(MDCPublish.java:137)
    Caused by: java.lang.NullPointerException
    at com.bea.xbean.validator.Validator.beginEvent(Validator.java:331)
    at com.bea.xbean.validator.Validator.nextEvent(Validator.java:187)
    at com.bea.xbean.store.Saver$ValidatorSaver.emitEvent(Saver.java:3757)
    at com.bea.xbean.store.Saver$ValidatorSaver.emitEvent(Saver.java:3720)
    at com.bea.xbean.store.Saver$ValidatorSaver.emitContainer(Saver.java:364
    2)
    at com.bea.xbean.store.Saver.processContainer(Saver.java:775)
    at com.bea.xbean.store.Saver.process(Saver.java:518)
    at com.bea.xbean.store.Saver$ValidatorSaver.<init>(Saver.java:3546)
    at com.bea.xbean.store.Type.validate(Type.java:280)
    at com.bea.xbean.values.XmlObjectBase.validate(XmlObjectBase.java:310)
    Any ideas?
    Thanks

    The problem was that the weblogic server had a previously-compiled version of the same XMLBean in its classpath. Once I removed the old XMLBean from the classpath the problem went away.

  • Properties.store throws NullPointerException

    Hi,
    I have a strange problem with the java.util.Properties class. Calling
    store on a Properties object AFTER I've called System.setProperties
    always leads to a NullPointerException.
    Code sample 1:
    Properties props = new Properties();
    props.put("prop1", "val1");
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    props.store(out, "Header");
    Code sample 2:
    Properties props = new Properties();
    props.put("prop1", "val1");
    System.setProperties(props);
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    props.store(out, "Header");
    Code sample 1 works fine, sample 2 throws a NullPointerException in
    the last line. Even code sample 3 throws the exception in the last
    line.
    Code sample 3:
    Properties props = new Properties();
    props.put("prop1", "val1");
    System.setProperties(props);
    props = new Properties();
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    props.store(out, "Header");
    How can I avoid this problem. I can't guarantee that no one calls
    System.setProperties before the store call, so this is no solution. I
    need the store call to save the properties to a String. At a later
    time I want to use Properties.load to read the properties from this
    String (via ByteArrayInputStream). Perhaps there is another way to
    store/load properties to/from a String?
    Thanks,
    Markus

    Hi,
    I think the problem is that if u create a new Property it will create a new property with null value
    Creates an empty property list with no default values.
    and if u try to override the systemproperty creates a null pointer Exception.
    Insteda try this
    Properties p=System.getProperties();
              p.put("prop1","val1");
              System.setProperties(p);
              ByteArrayOutputStream out = new ByteArrayOutputStream();
              p.store(out, "Header");
    means , try to get the property object from the system and go ahead with ur coding is working fine
    Greetz
    Kumar.R

  • Persistence.createEntityManagerFactory() throw NullPointerException in oc4j

    Hi,
    I am trying to use JPA(toplink essential) with EJB 2.0 spec using the DAO pattern. Outside the oc4j container all my DAO unit tests passes but when I run the same code inside oc4j the Persistence.createEntityManagerFactory() method throws a NPE. I verified that META-INF/persistence.xml file is available through the classpath inside the container but I don’t see any toplink specific logs in oc4j. Do I need to do anything to tell oc4j load up persistence.xml? I have been trying many different options in persistence.xml but I always get the same exception. Any help will be appreciated.
    Code:
    Persistence.createEntityManagerFactory(“default”, new HashMap());
    Exception:
    07/07/06 17:25:21 java.lang.NullPointerException
    07/07/06 17:25:21 at oracle.toplink.essentials.ejb.cmp3.EntityManagerFacto
    ryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:120)
    07/07/06 17:25:21 at javax.persistence.Persistence.createEntityManagerFact
    ory(Persistence.java:59)
    07/07/06 17:25:21 at com.retek.rib.domain.hospital.dao.toplink.ToplinkSess
    ionDispenser.currentEntityManager(ToplinkSessionDispenser.java:31)
    Config File:
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence version="1.0" 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">
    <persistence-unit name="default" transaction-type="RESOURCE_LOCAL">
    <!--persistence-unit name="ribPersistenceUnit" transaction-type="JTA"-->
    <!--provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider
    </provider-->
    <provider>
    oracle.toplink.essentials.PersistenceProvider
    </provider>
    <!--jta-data-source>jdbc/OracleRibDs</jta-data-source-->
    <class>com.retek.rib.domain.hospital.bo.impl.HospitalEntryImpl</class>
    <class>com.retek.rib.domain.ribmessage.bo.impl.RibMessageFailureImpl</class>
    <class>com.retek.rib.domain.ribmessage.bo.impl.RibMessageRoutingInfoImpl</class>
    <class>com.retek.rib.domain.ribmessage.bo.impl.RibMessageHospitalRefImpl</class>
    <!--properties>
    <property name="toplink.jdbc.url" value="jdbc:derby://localhost:1527/testD
    B"/>
    <property name="toplink.jdbc.user" value="APP"/>
    <property name="toplink.jdbc.driver" value="org.apache.derby.jdbc.ClientDr
    iver"/>
    <property name="toplink.jdbc.password" value="APP"/>
    </properties-->
    <properties>
    <property name="toplink.jdbc.url" value="jdbc:oracle:thin:@pbora-lnx:1521:
    orcl"/>
    <property name="toplink.jdbc.user" value="stubby2"/>
    <property name="toplink.jdbc.driver" value="oracle.jdbc.driver.OracleDrive
    r"/>
    <property name="toplink.jdbc.password" value="retek"/>
    <property name="toplink.logging.level" value="FINE"/>
    </properties>
    <!--properties>
    <!--property name="toplink.server.platform.class.name" value="oracle.topli
    nk.essentials.platform.server.oc4j.Oc4jPlatform"/- ->
    <property name="toplink.logging.level" value="FINE"/>
    </properties-->
    </persistence-unit>
    </persistence>

    Hi,
    I am trying to use JPA(toplink essential) with EJB 2.0 spec using the DAO pattern. Outside the oc4j container all my DAO unit tests passes but when I run the same code inside oc4j the Persistence.createEntityManagerFactory() method throws a NPE. I verified that META-INF/persistence.xml file is available through the classpath inside the container but I don’t see any toplink specific logs in oc4j. Do I need to do anything to tell oc4j load up persistence.xml? I have been trying many different options in persistence.xml but I always get the same exception. Any help will be appreciated.
    Code:
    Persistence.createEntityManagerFactory(“default”, new HashMap());
    Exception:
    07/07/06 17:25:21 java.lang.NullPointerException
    07/07/06 17:25:21 at oracle.toplink.essentials.ejb.cmp3.EntityManagerFacto
    ryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:120)
    07/07/06 17:25:21 at javax.persistence.Persistence.createEntityManagerFact
    ory(Persistence.java:59)
    07/07/06 17:25:21 at com.retek.rib.domain.hospital.dao.toplink.ToplinkSess
    ionDispenser.currentEntityManager(ToplinkSessionDispenser.java:31)
    Config File:
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence version="1.0" 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">
    <persistence-unit name="default" transaction-type="RESOURCE_LOCAL">
    <!--persistence-unit name="ribPersistenceUnit" transaction-type="JTA"-->
    <!--provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider
    </provider-->
    <provider>
    oracle.toplink.essentials.PersistenceProvider
    </provider>
    <!--jta-data-source>jdbc/OracleRibDs</jta-data-source-->
    <class>com.retek.rib.domain.hospital.bo.impl.HospitalEntryImpl</class>
    <class>com.retek.rib.domain.ribmessage.bo.impl.RibMessageFailureImpl</class>
    <class>com.retek.rib.domain.ribmessage.bo.impl.RibMessageRoutingInfoImpl</class>
    <class>com.retek.rib.domain.ribmessage.bo.impl.RibMessageHospitalRefImpl</class>
    <!--properties>
    <property name="toplink.jdbc.url" value="jdbc:derby://localhost:1527/testD
    B"/>
    <property name="toplink.jdbc.user" value="APP"/>
    <property name="toplink.jdbc.driver" value="org.apache.derby.jdbc.ClientDr
    iver"/>
    <property name="toplink.jdbc.password" value="APP"/>
    </properties-->
    <properties>
    <property name="toplink.jdbc.url" value="jdbc:oracle:thin:@pbora-lnx:1521:
    orcl"/>
    <property name="toplink.jdbc.user" value="stubby2"/>
    <property name="toplink.jdbc.driver" value="oracle.jdbc.driver.OracleDrive
    r"/>
    <property name="toplink.jdbc.password" value="retek"/>
    <property name="toplink.logging.level" value="FINE"/>
    </properties>
    <!--properties>
    <!--property name="toplink.server.platform.class.name" value="oracle.topli
    nk.essentials.platform.server.oc4j.Oc4jPlatform"/- ->
    <property name="toplink.logging.level" value="FINE"/>
    </properties-->
    </persistence-unit>
    </persistence>

Maybe you are looking for