Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 12 of 12

Thread: where can i find the tmp/foo directory?

  1. #1
    Junior Member
    Join Date
    Jan 2010
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question where can i find the tmp/foo directory?

    hi all,

    please, i would like to know where i can find the tmp/foo directory so i can edit the jndi.properties

    thanks for your response


  2. #2
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: where can i find the tmp/foo directory?

    The tmp/foo directory for what application, is this some directory used by an application container?

    // Json

  3. #3
    Junior Member
    Join Date
    Jan 2010
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Re: where can i find the tmp/foo directory?

    Hi Json,

    thanks for getting back to me.

    actually, i am developing a three tier application using J2ee 5. i defined my business methods in the session beans with which i used to create my web services in the ejb and web service clients in the war tier.

    however, i sometimes have this error: "NameAlreadyBoundException, use rebind to override"; and then i have to keep undeploying till the server gets rid of it. otherwise, my code works perfectly well.

    now the error has come again and i read online, that i need to edit thejndi.properties file in the /tmp/foo directory and i dont know where to fine ths directory.


    secondly, i sometimes have this warning that appears in the war tier when i build it for it to parse the wsdl and generate the necessary code for the application.
    the warning is below

    "[WARNING] schema_reference.4: Failed to read schema document 'http://localhost:16047/AlternateWSService/AlternateWS?xsd=1', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
    line 28 of file:/C:/Users/owner/Documents/NetBeansProjects/msc_project/msc_project-war/src/conf/xml-resources/web-service-references/AlternateWS/wsdl/localhost_16047/AlternateWSService/AlternateWS.wsdl#types?schema1"

    please note that whenever these two errors dont appear my application works perfectly.

    i hope i have explained all. i will appreciate if you could help.

    thanks.

  4. #4
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: where can i find the tmp/foo directory?

    What container are you running your application in? Glassfish, Weblogic, Jboss or maybe something else?

    // Json

  5. #5
    Junior Member
    Join Date
    Jan 2010
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: where can i find the tmp/foo directory?

    Json,

    just a quick one.
    i was carried with with the details of my application.
    i am using Glassfishv3

  6. #6
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: where can i find the tmp/foo directory?

    in <glassfish installation folder>/lib there is a file called appserv-rt.jar, in that file there is a jndi.properties file and if you are using a custom one it would be located in your <glassfish folder>/domains/<domain name>/lib folder I believe.

    What do you need to change in that file?

    // Json

  7. #7
    Junior Member
    Join Date
    Jan 2010
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: where can i find the tmp/foo directory?

    i got this lead from google that i should set a jndi name for each of the remote server beans i have got to solve the first problem.

    please if you have better ideas i would appreciate

  8. #8
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: where can i find the tmp/foo directory?

    What code do you use to bind your ejb names to the context?

    // Json

  9. #9
    Junior Member
    Join Date
    Jan 2010
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: where can i find the tmp/foo directory?

    i do not get this question.

    but for all i know i do not have any code binding the ejb names

    pls through more light as i am new to J2ee

  10. #10
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: where can i find the tmp/foo directory?

    Because of the NameAlreadyBoundException that you get you could try using the rebind method like they state in the message.

    // Json

  11. #11
    Junior Member
    Join Date
    Jan 2010
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: where can i find the tmp/foo directory?

    Json,

    below is what i have using netbeans

    i have a class called Locations in the ejb

    /*
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    */

    package msc_project.ejb;

    import java.io.Serializable;
    import java.util.List;
    import javax.persistence.Basic;
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.FetchType;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    import javax.persistence.Id;
    import javax.persistence.NamedQueries;
    import javax.persistence.NamedQuery;
    import javax.persistence.OneToMany;
    import javax.persistence.Table;

    /**
    *
    * @author owner
    */
    @Entity
    @Table(name = "LOCATIONS")
    @NamedQueries({
    @NamedQuery(name = "Locations.findAll", query = "SELECT l FROM Locations l"),
    @NamedQuery(name = "Locations.findById", query = "SELECT l FROM Locations l WHERE l.id = :id"),
    @NamedQuery(name = "Locations.findByLocationCode", query = "SELECT l FROM Locations l WHERE l.locationCode = :locationCode"),
    @NamedQuery(name = "Locations.findByName", query = "SELECT l FROM Locations l WHERE l.name = :name"),
    @NamedQuery(name = "Locations.findByAddress", query = "SELECT l FROM Locations l WHERE l.address = :address")})
    public class Locations implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "LOCATION_CODE")
    private String locationCode;
    @Basic(optional = false)
    @Column(name = "NAME")
    private String name;
    @Basic(optional = false)
    @Column(name = "ADDRESS")
    private String address;
    @OneToMany(mappedBy = "locationId", fetch = FetchType.EAGER)
    private List<Storerooms> storeroomsList;

    public Locations() {
    }

    public Locations(Integer id) {
    this.id = id;
    }

    public Locations(Integer id, String locationCode, String name, String address) {
    this.id = id;
    this.locationCode = locationCode;
    this.name = name;
    this.address = address;
    }

    public Integer getId() {
    return id;
    }

    public void setId(Integer id) {
    this.id = id;
    }

    public String getLocationCode() {
    return locationCode;
    }

    public void setLocationCode(String locationCode) {
    this.locationCode = locationCode;
    }

    public String getName() {
    return name;
    }

    public void setName(String name) {
    this.name = name;
    }

    public String getAddress() {
    return address;
    }

    public void setAddress(String address) {
    this.address = address;
    }

    public List<Storerooms> getStoreroomsList() {
    return storeroomsList;
    }

    public void setStoreroomsList(List<Storerooms> storeroomsList) {
    this.storeroomsList = storeroomsList;
    }

    @Override
    public int hashCode() {
    int hash = 0;
    hash += (id != null ? id.hashCode() : 0);
    return hash;
    }

    @Override
    public boolean equals(Object object) {
    // TODO: Warning - this method won't work in the case the id fields are not set
    if (!(object instanceof Locations)) {
    return false;
    }
    Locations other = (Locations) object;
    if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
    return false;
    }
    return true;
    }

    @Override
    public String toString() {
    return "msc_project.ejb.Locations[id=" + id + "]";
    }

    }


    and the i defined the methods and operation of the calss in a LocationServer that implements it remotely in a class called the LocationServerRemote

    /*
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    */

    package msc_project.ejb;

    import java.util.List;
    import javax.ejb.Stateless;
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;

    /**
    *
    * @author owner
    */
    @Stateless
    public class LocationServer implements LocationServerRemote {

    @PersistenceContext
    private EntityManager manager;

    //@PermitAll
    public Locations readLocation(int id) {
    return manager.find(Locations.class, id);
    }

    //@RolesAllowed("ADMINISTRATOR")
    public void createLocation(Locations l) {
    if (l.getId() == null) {
    manager.persist(l);
    } else {
    manager.merge(l);
    }
    }

    //@RolesAllowed("ADMINISTRATOR")
    public void updateLocation(Locations l) {
    manager.merge(l);
    }

    //@RolesAllowed("ADMINISTRATOR")
    public void deleteLocation(int id) {
    Locations l = manager.find(Locations.class, id);
    manager.remove(l);
    }

    @SuppressWarnings("unchecked")
    //@PermitAll
    public List<Locations> getLocations() {
    String query = "select l from Locations l order by l.locationCode";
    return manager.createQuery(query).getResultList();
    }

    // Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Business Method" or "Web Service > Add Operation")

    }


    /*
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    */

    package msc_project.ejb;

    import java.util.List;
    import javax.ejb.Remote;

    /**
    *
    * @author owner
    */
    @Remote
    public interface LocationServerRemote {
    Locations readLocation(int id);

    void createLocation(Locations l);

    void updateLocation(Locations l);

    void deleteLocation(int id);

    List<Locations> getLocations();

    }



    after which i created LocationWS class from the LocationServerBean


    /*
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    */

    package msc_project.ejb.ws;

    import java.util.List;
    import javax.ejb.EJB;
    import javax.jws.Oneway;
    import javax.jws.WebMethod;
    import javax.jws.WebParam;
    import javax.jws.WebService;
    import javax.ejb.Stateless;
    import msc_project.ejb.LocationServerRemote;
    import msc_project.ejb.Locations;

    /**
    *
    * @author owner
    */
    @WebService()
    @Stateless()
    public class LocationWS {
    @EJB
    private LocationServerRemote ejbRef;// Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Web Service Operation")

    @WebMethod(operationName = "readLocation")
    public Locations readLocation(@WebParam(name = "id")
    int id) {
    return ejbRef.readLocation(id);
    }

    @WebMethod(operationName = "createLocation")
    @Oneway
    public void createLocation(@WebParam(name = "l")
    Locations l) {
    ejbRef.createLocation(l);
    }

    @WebMethod(operationName = "updateLocation")
    @Oneway
    public void updateLocation(@WebParam(name = "l")
    Locations l) {
    ejbRef.updateLocation(l);
    }

    @WebMethod(operationName = "deleteLocation")
    @Oneway
    public void deleteLocation(@WebParam(name = "id")
    int id) {
    ejbRef.deleteLocation(id);
    }

    @WebMethod(operationName = "getLocations")
    public List<Locations> getLocations() {
    return ejbRef.getLocations();
    }

    }


    and that was it with the ejb.
    n/b there are other classes but i am showing you what i have done with one of the classes.

    in the web archive, i then created the web service clients from the web services to generate required classes and codes and create the LocationWSService/Ports

    then in the war, i created a LocationBeanthat the web pages call to generate result as required by a user.


    /*
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    */

    package msc_project.web;

    import java.util.List;
    import msc_project.ejb.ws.Locations;

    /**
    *
    * @author owner
    */
    public class LocationBean {
    private msc_project.ejb.ws.LocationWSService locservice;
    private msc_project.ejb.ws.LocationWS locport;
    private Locations location;
    private String error;

    public String getError() {
    return error;
    }

    public void setError(String error) {
    this.error = error;
    }

    public Locations getLocation() {
    return location;
    }

    public void setLocation(Locations location) {
    this.location = location;
    }

    public LocationBean() {
    error = "";
    location = new Locations();

    }

    public void readLocation() {

    try { // Call Web Service Operation
    //msc_project.ejb.ws.EquipmentWSService service = new msc_project.ejb.ws.EquipmentWSService();
    //msc_project.ejb.ws.EquipmentWS port = service.getEquipmentWSPort();
    setUpLocationPorts();
    // TODO initialize WS operation arguments here
    //int id = 0;
    // TODO process result here
    //msc_project.ejb.ws.Equipments result = port.readEquipment(id);
    //System.out.println("Result = "+result);
    location = locport.readLocation(location.getId());
    } catch (Exception ex) {
    // TODO handle custom exceptions here
    }
    error = "";
    }

    public void createLocation() {

    try { // Call Web Service Operation
    //msc_project.ejb.ws.EquipmentWSService service = new msc_project.ejb.ws.EquipmentWSService();
    //msc_project.ejb.ws.EquipmentWS port = service.getEquipmentWSPort();
    setUpLocationPorts();
    // TODO initialize WS operation arguments here
    //msc_project.ejb.ws.Equipments e = new msc_project.ejb.ws.Equipments();
    //port.createEquipment(e);
    locport.createLocation(location);
    } catch (Exception ex) {
    // TODO handle custom exceptions here
    }
    location = new Locations();
    error = "LOCATION - sucessfully created";
    }

    public void updateLocation() {

    try { // Call Web Service Operation
    //msc_project.ejb.ws.EquipmentWSService service = new msc_project.ejb.ws.EquipmentWSService();
    //msc_project.ejb.ws.EquipmentWS port = service.getEquipmentWSPort();
    setUpLocationPorts();
    // TODO initialize WS operation arguments here
    //msc_project.ejb.ws.Equipments e = new msc_project.ejb.ws.Equipments();
    //port.updateEquipment(e);
    locport.updateLocation(location);
    } catch (Exception ex) {
    // TODO handle custom exceptions here
    }
    location = new Locations();
    error = "LOCATION - sucessfully updated";
    }

    public void deleteLocation() {

    try { // Call Web Service Operation
    //msc_project.ejb.ws.EquipmentWSService service = new msc_project.ejb.ws.EquipmentWSService();
    //msc_project.ejb.ws.EquipmentWS port = service.getEquipmentWSPort();
    setUpLocationPorts();
    // TODO initialize WS operation arguments here
    //int id = 0;
    // port.deleteEquipment(id);
    locport.deleteLocation(location.getId());
    } catch (Exception ex) {
    // TODO handle custom exceptions here
    }
    location = new Locations();
    error = "LOCATION - sucessfully deleted";
    }

    public List<Locations> getLocations() {
    List<msc_project.ejb.ws.Locations> result = null;

    try { // Call Web Service Operation
    //msc_project.ejb.ws.EquipmentWSService service = new msc_project.ejb.ws.EquipmentWSService();
    //msc_project.ejb.ws.EquipmentWS port = service.getEquipmentWSPort();
    setUpLocationPorts();
    // TODO process result here
    //java.util.List<msc_project.ejb.ws.Equipments> result = port.getEquipments();
    result = locport.getLocations();
    System.out.println("Result = " + result);
    } catch (Exception ex) {
    // TODO handle custom exceptions here
    }
    return result;
    }

    public void setUpLocationPorts() {
    // Call Web Service Operation
    if (locservice == null) {
    locservice = new msc_project.ejb.ws.LocationWSService();
    locport = locservice.getLocationWSPort();
    }
    }
    }


    that all i can explain for now, i would like more clarifications pls
    thanks

  12. #12
    Junior Member
    Join Date
    Jan 2010
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: where can i find the tmp/foo directory?

    there was no method specified for me to use

Similar Threads

  1. Java program which can list all files in a given directory
    By JavaPF in forum Java Programming Tutorials
    Replies: 8
    Last Post: July 9th, 2013, 03:38 AM
  2. How to create directory in Java?
    By JavaPF in forum Java Programming Tutorials
    Replies: 2
    Last Post: December 24th, 2011, 11:53 AM
  3. About META-INF directory?
    By chinni in forum Java Servlet
    Replies: 2
    Last Post: February 9th, 2010, 09:36 AM
  4. Class directory
    By Kit in forum Java Theory & Questions
    Replies: 7
    Last Post: October 11th, 2009, 10:07 AM
  5. Program to print current directory path to the console
    By JavaPF in forum Java Programming Tutorials
    Replies: 1
    Last Post: October 9th, 2009, 12:59 PM