Showing posts with label IDE. Show all posts
Showing posts with label IDE. Show all posts

Thursday, May 21, 2020

Dev Tips#38 Java Maven project in Netbeans : or one of its dependencies ...

If you are getting this type of error message while creating a maven project in Netbeans follow my video tutorial and add the mirror show below in your netbeans settings.xml.


Error message: Plugin org.apache.maven.plugins:maven-clean-plugin:2.4.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.4.1 from/to central (http://repo.maven.apache.org/maven2): Failed to transfer file: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom. Return code is: 501, ReasonPhrase: HTTPS Required. -> [Help 1]


Solution:


Here are the dependencies to be added in the settings.xml



   
<mirror>
      <id>mirror1</id>
      <mirrorOf>central</mirrorOf>
      <name>mirror1</name>
      <url>https://repo.maven.apache.org/maven2/</url>
</mirror>

 OR

<mirror>
   <id>google-maven-central</id>
   <name>Google Maven Central</name>
   <url>https://maven-central.storage.googleapis.com/maven2/</url>
   <mirrorOf>central</mirrorOf>
</mirror> 
   
  




Sunday, January 17, 2016

Where is the netbeans.conf location ?

On windows :

C:\Program Files\NetBeans 8.0\etc

On linux:

/usr/share/netbeans/etc/netbeans.conf




Thursday, March 6, 2014

Production tips#7 : Password Change in Glassfish SOLVED

Changing password in Glassfish Server can be strange sometime especially everything you do seems not to work. In this example I will focus on the case of Glassfish Server 3.0 or 3+ . I haven't yet tested on other versions. Before throwing some commands against the asadmin shell there are some important things that you need to know or at least be aware of.

  • change-admin-password : to change the admin password for the console login, in many documents out there the defaults of this user are:
 username: admin
 password: adminadmin

 However I have noticed that for Glassfish 3.0 when the installation has been done accepting all the defaults,

 the default credentials of this user are instead:

username: anonymous
password: empty 

  • change-master-password: to change the master password for controlling the DAS and IKS for more info on this read this article.
Now coming back to our aim of changing the admin password for a specific domain :

 asadmin> start-domain mydomain
asadmin> change-admin-password --port 4848 --user anonymous
  here port = your admin console page port.
 You are then prompt for a password:
  Enter admin password> just press[Enter] for accepting an empty password.
  Enter new admin password> your password
  Enter new admin password again> your password
 asadmin> stop-domain mydomain
 asadmin> start-domain mydomain

 Just access your admin console url like http:localhost:4848
  username: anonymous
 password: your password.

Congratulation you just did it ! If you still face any problems drop a comment I will come to your rescue. Don't forget to give us your feedback....




Wednesday, March 5, 2014

Production tips#6 : What do you know about Glassfish Configuration files ?

This time I would like to hear about what you really know about all these glassfish server configuration files.
To help you I'm listing them:
  1. asenv.conf
  2. asadminenv.conf
  3. domain.xml
  4. jbi.xml
  5. resources.xml
  6. server.policy
  7. sun.acc.xml
  8. webservices.xml
  9. wss-client-config.xml
 You usually make changes to these file either through the comnand-line utility or the admin console depending of your preferences, and at the end you have to restart the server for the change to take effects.

 

Tuesday, February 25, 2014

Production tips#5 : Glassfish Master Password

What is the master master password often referred to in Glassfish ? In this post I sharing with you some of the basic points regard the master password that can help you to administer your server confidently.

The master password is a password that is used to encrypt the DAS or Domain Administration Server and the instances keystores (IKS). The DAS and IKS used it to open instances at startup.
Another point worth mentioning is that the master password is not transmitted over the network nor is it used for authentication.
It is saved for the DAS and all the  instances in the domain. Contrary to what you may have in mind, the default master password is 'changeit' and not 'adminadmin'
For each domain like domain1 is it located inside  C:\glassfishv3\glassfish\domains\domain1
cmd: asadmin> create-domain  --savemasterpassword domain1

Start a domain:
asadmin> start-domain domain1

stop a domain:
asadmin> stop-domain domain1

You will have noticed that you are not prompted to enter the master password when it is starting the DAS just because it has been saved.

Change master password for a domain:
asadmin> change-master-password --savemasterpassword domain1

Delete a domain:
asadmin> delete-domain domain1


Monday, February 24, 2014

Production tips#4 : Create a secured domain in Glassfish console and assign it to the GUI in netbeans

What is really the issue here ?
Suppose you want to have your Netbeans IDE and an embedded Glassfish server GF attached to it. By default the web administration console page is not password protected. If you go directely to the web admin console page and change the admin password and hope it to work chances are that you will disappoint yourself. 
If that is the case then what to do ?
1. Go to the command prompt and navigate into the C:\glassfishv3\glassfish\bin.
   Clik on asadmin.bak
    or cd C:\glassfishv3\glassfish\bin
C:\glassfishv3\glassfish\bin> asadmin [ENTER]
asadmin > create-domain --adminport 5555--savemasterpassword domain3
 Follow the shell instruction it is interactive but enter your admin username, admin password and master password (at least 6 characters )
2. Assign the domain we just created to GUI so that we don't need to use the command line or asadmin shell  every time for the server administration.
 Go to Netbeans --> Services -->Servers :
        Right click Servers and Add a Glassfish server
 
Click Next  -->Next  and you are here
 Specify the same domain name you created previously : domain3
 
Finish and Restart you IDE, you can now visit the admin web console page by just right clicking the server name and click View Domain Admin Console  like here below
 Congratulation you just did it, feel to comment ...

Wednesday, February 19, 2014

Insert data from Excel to Oracle in Java

It is tutorial I would show you how you can easily load your data from an excel file to Oracle in Java.

Database: Oracle 10g
Excel: 97-2003 (.xls)
Oracle Driver: ojdbc14 from here or here
Poi jar: from here or here  (for this tutorial I use version 3.8)
IDE: netbeans 7.1.1

I suppose that you know how to create a java project and add libraries to a project .

1. Create a java Project and add ojdbc14 and poi jars to it.
  After adding jars under project properties you will have something like this under project lib folder.

2. Create a table called STUDENTS.


 

CREATE TABLE students
   ( id varchar2(5) PRIMARY KEY,
     stname varchar2(50),
     country varchar2(30),
     types varchar2 (2)
   )

  
3. Prepare your excel file  and make sure you have saved it as a 1997-2003 (.XLS) file
  
4. Here is your code



public static void main( String [] args ) throws ClassNotFoundException, InstantiationException, SQLException, IllegalAccessException {

    String fileName="C:\\book\\list.xls";
    Vector dataHolder=xlsReader(fileName);
    printCellDataToConsole(dataHolder);
   }
   public static Vector xlsReader(String fileName)
   {
   
     Vector cellVectorHolder = new Vector(); //Vector definition

    try{
   
    FileInputStream myInput = new FileInputStream(fileName); //stream creation
    POIFSFileSystem file = new POIFSFileSystem(myInput); //POIFSFileSystem Object
    HSSFWorkbook workBook = new HSSFWorkbook(file);
    HSSFSheet mySheet = workBook.getSheetAt(0);  //getting the first sheet from the WorkBook
    Iterator rowIter = mySheet.rowIterator(); //cells iterator

      while(rowIter.hasNext()){
          HSSFRow row = (HSSFRow) rowIter.next();
          Iterator cellIter = row.cellIterator();
          Vector cellStoreVector=new Vector();
          while(cellIter.hasNext()){
              HSSFCell cell = (HSSFCell) cellIter.next();
              cellStoreVector.addElement(cell);
          }
          cellVectorHolder.addElement(cellStoreVector);
      }
      
    }catch (Exception e){e.printStackTrace(); }
    return cellVectorHolder;
  }

  private static void printCellDataToConsole(Vector dataHolder) throws ClassNotFoundException, InstantiationException, SQLException, IllegalAccessException 
  {
     
    String id="";
    String name="";
    String country="";
    String type="";
    
    for (int i=0;i
 
5.Finally run your project, Yep ! You  made it, Congratulations !!!
 If you face any problem along then don't hesitate to drop a comment.

Tuesday, February 4, 2014

Oracle JDBC connection in java under Netbeans

1. Create your project:

2. Project name: jdbcProject
3.Downoad the oracle jar ojdbc14.jar from here or here

4. Add the jar to your project:
   - by right clicking your oracle project
   -Click on Properties
   -Under Categories at the left Select Libraries
   -Click on Add Jar/Folder button at the right
   -Go to the jar location , select it and Open, OK, OK

5. Create a table in your oracle database:
create table student (name varchar(20), country varchar(20));
6. Write code
imports:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;

 Your Code:

public class JdbcProject {

    
    public static void main(String[] args) {
       
        try {  
          String sid="orcl";  //your oracle sid
          String username="user"; 
          String password= "pass";  
          DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());  
          Connection connection = DriverManager.getConnection(  
                "jdbc:oracle:thin:@localhost:1521:"+sid, username, password);  

        //Statement statement = connection.createStatement();  
           
          String name="soulemane";
          String country="cameroon";
          String query = " insert into student(name,country)values(?,?)";
          PreparedStatement preparedStmt = connection.prepareStatement(query);
           //System.out.println("Data is inserted:");
           preparedStmt.setString(1, name);
           preparedStmt.setString(2,country);

            // execute the preparedstatement
           preparedStmt.execute();
           connection.close(); 
          } catch (Exception e) {  
            e.printStackTrace();  
          }  
           System.out.println("Data is inserted:");
    }
}
  
 7. Final RUN your project and have fun

Friday, December 13, 2013

Difference between versions of Eclipse : Europa, Helios, Galileo ,etc

Bingo ! here we are. Why am I even blogging about Eclipse today ? The truth is that Eclipse sucks and I don't have any better option.  I am sure most of you guyz out there hate eclipse for so many reasons. Me particularly when its come to choose an IDE I always choose Netbeans before even thinking about Visual studio (PROGRAM NOT RESPONDING ....no comment) or Eclipse. But the reality is that in many software companies Eclipse is being used. 
  Any way two days back I fell on OpenCV, after being amazed by its applications on computer vision, smart phones and robotics I decided to put matlab beside and explore these still unknown libraries. As you all all know the defacto and prime IDE for developing Android today is Eclipse. Same as opencv, many documentations and demo projects out there are on eclipse and C++.
  When it comes to different naming used by Eclipse, at first glance it is confusing. Are you going to use helios , juno, galileo or Europa ?  What is even the difference ?
 In fact Eclipse has it own way of versioning. Instead of using numbers say Eclipse 3.1 , Eclipse 3.2 , Eclipse 4.0 and etc it gives instead name to a particular version.

As you can see from the above table from Wikipedia these code names although appearing alphabetically as time goes on have no particular meaning.
 What I have observed is that these names are just simple version names. But feel free to drop a comment to add something or share your eclipse experience with us. A plus!!!