mardi 4 août 2015

Cache Images with Volley

I'm trying to implement Image Caching into my app. The code i currently have regarding the images is below:

Network call to get images:

public void getImage(String url, final ImageView imageView) {

    System.out.println("Image Url is: " + url);
    ImageRequest requestImage = new ImageRequest(url, new Response.Listener<Bitmap>() {
        @Override
        public void onResponse(Bitmap response) {
            imageView.setImageBitmap(response);
        }
    }, 0, 0, null, null);

    queue.add(requestImage);
}

How could I implement the caching? I have read a few articles on SO, but am not sure on how to implement it into my app?

Thanks for your help



via Chebli Mohamed

Append the result of a left join to an entity field

I would like to append the result of a left join to an entity field. In SQL it would be this query:

SELECT * FROM thethreads t
LEFT JOIN thread_votes tv
ON t.idthread=tv.thread
AND tv.from_user like "test2";

Then I'd have a column in my Thethread entity I can populate with the left join information. I don't know how to do that.

The rest of the information is to illustrate what I want to do :

At the moment I've those two entities called "Thethread" and "ThreadVote". Each "TheThread" has a bunch of "ThreadVote" (which correspond to up votes or down votes from users, an user can have only one thread vote by thread (-1 or +1, like on StackOverflow). Anyway, I want to know if an user has already voted so I can paint the up vote or down vote arrow (like stackoverflow again). What I'm doing at the moment is inefficient: I'm getting a TheThread List and then I'm checking within that list if a vote by the current user exists. I would like to have everything done within the EJB where I make the JPA queries. I would like something like this :

private static final String SELECT_NEWEST_THREADS = "Select t From Thethread t LEFT JOIN ThreadVote tv ON t.idthread=tv.thread AND tv.user1 like :currentUser ORDER BY t.datePosted";
@Override
public List<Thethread> giveNewestThread(int amount, int page,
        String currentUser) {
    Query query = em.createQuery(SELECT_NEWEST_THREADS);
    query.setParameter("currentUser", currentUser);
    query.setMaxResults(amount);
    List<Object[]> temp = query.getResultList();
    List<Thethread> threadList = new ArrayList<Thethread>();
    for (Object[] o : temp) {
        Thethread thread = (Thethread) o[0];
        thread.setThreadcurrentUserVote((ThreadVote) o[1]);
        threadList.add(thread);
    }
    return threadList;
}

This gives me an Exception :

Exception Description: Object comparisons can only be used with OneToOneMappings.  Other mapping comparisons must be done through query keys or direct attribute level comparisons. 
Mapping: [org.eclipse.persistence.mappings.DirectToFieldMapping[idthread-->thethreads.IDTHREAD]] 

with the entities :

@Entity
@Table(name = "thethreads")
@NamedQuery(name = "Thethread.findAll", query = "SELECT t FROM Thethread t")
public class Thethread implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    private int idthread;
    private String content;
    private int downvotes;    
    private int upvotes; 
    // bi-directional many-to-one association to User
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "posted_by")
    private User user;
    // bi-directional many-to-one association to ThreadVote
    @OneToMany(mappedBy = "thethread")
    private List<ThreadVote> threadVotes;
    @Transient 
    privateThreadVote currentUserVote;
    //...
}

ThreadVote entity:

@Entity
@Table(name = "thread_votes")
@NamedQuery(name = "ThreadVote.findAll", query = "SELECT t FROM ThreadVote t")
public class ThreadVote implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @Column(name = "id_votes_thread")
    private int idVotesThread;
    private int vote;
    // bi-directional many-to-one association to Thethread
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "thread")
    private Thethread thethread;
    // bi-directional many-to-one association to User
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "from_user")
    private User user1;
    // bi-directional many-to-one association to User
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "to_user")
    private User user2;
    //...
}

I other words I would like to remove this ForumThread class and have everything queried and get the result in the entity Thethread.



via Chebli Mohamed

netbeans plugin run method but not when action event fire

i started netbeans plugin development with this basic tutorial . and i modyfied it to get the text of current edited file.

so i created a action class which extends ActionListener .so when i click the icon of my plugin from toolbar it open dialog and show content.but it repeats .when i close another one open then another dialog so on..

i think this is because i add property each time listener when i click the button .so how can i fix this ..

this is the code i used

public final class SomeAction implements ActionListener {

    @Override
    public void actionPerformed(ActionEvent e) {
        PropertyChangeListener l = new PropertyChangeListener() {
            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                JTextComponent jtc = EditorRegistry.lastFocusedComponent();
                if (jtc != null) {
                    Document d = jtc.getDocument();
                    int msgType = NotifyDescriptor.INFORMATION_MESSAGE;
                    NotifyDescriptor df;
                    try {
                        df = new NotifyDescriptor.Message(d.getText(0, d.getLength() - 1), msgType);
                        DialogDisplayer.getDefault().notify(df);
                    } catch (BadLocationException ex) {
                        Exceptions.printStackTrace(ex);
                    }

                }
            }
        };

        EditorRegistry.addPropertyChangeListener(l);  // i guess here is the problem but i couldn't able to find where should i put this line 

    }



via Chebli Mohamed

When I do not use from a condition I can get the data from php, But when I use from a condition, I Can not get data from php

My php code is correct. But I have a strange problem when I use a condition in my code. My php code sends the "A" string from server to android. In the following code when I do not use a condition in my code in the GetText() method, I can get the A string and display it in the TextView well. But when I use a condition as follows, I can not get and display the A string in the TextView . Please help me. I do not know that where is this problem.

Pass = pass.getText().toString();

// Create data variable for sent values to server

String data = URLEncoder.encode("name", "UTF-8") + "=" + URLEncoder.encode(Name, "UTF-8");
    data += "&" + URLEncoder.encode("email", "UTF-8") + "=" + URLEncoder.encode(Email, "UTF-8");
    data += "&" + URLEncoder.encode("user", "UTF-8") + "=" + URLEncoder.encode(Login, "UTF-8");
    data += "&" + URLEncoder.encode("pass", "UTF-8") + "=" + URLEncoder.encode(Pass, "UTF-8");

String text = "";
BufferedReader reader = null;

// Send data
try{
   // Defined URL  where to send data
   URL url = new URL("http://ift.tt/1VTwxEV");

   // Send POST data request
   HttpURLConnection conn = (HttpURLConnection) url.openConnection();
   conn.setDoOutput(true);
   conn.setRequestMethod("POST");
   OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
   wr.write(data);
   wr.flush();

   // Get the server response

   reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
   StringBuilder sb = new StringBuilder();
   String line = null;

   // Read Server Response
   while((line = reader.readLine()) != null){
       // Append server response in string
       sb.append(line);
    }

    text = sb.toString();
} catch(Exception ex){

} finally{
    try{
        reader.close();
    } catch(Exception ex){}
}

// Show response on activity
String A = "A";

if(text.equals(A)){
    content.setText(text); //it can not display the text in the TextView
}

}



via Chebli Mohamed

Displaying key-values in HashMap

I have 2 questions regarding the code bellow,

1.I have the key "two" twice in my hashmap, while printing, "two" is displayed only once.Why its not displaying "two" twice?

2.How to selectively display the key "two"?

import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;

public class main {
public static void main(String[] args){
HashMap<String,String> myMap = new HashMap<String,String>();

    myMap.put("one", "1");
    myMap.put("two", "2");
    myMap.put("three", "3");
    myMap.put("two", "4");

    Set <String> mySet =myMap.keySet();
    Iterator itr = mySet.iterator();

    while(itr.hasNext()){
        String key = (String) itr.next();
        System.out.println(key);
    }

}
}



via Chebli Mohamed

Calling many methods of many objects many times per second

I have a structure like that

  abstract Class Entity {
    //some variables... 
    //some methods ...
    public abstract void render(Graphics g);
    }

Thats the parent ..Now I have 3 children..

Class A extends Entity{}
Class B extends Entity{}
Class C extends Entity{} 

Every class has some different stuff do render .One is for example drawing yellow circle , second green text and the third is displaying image.

But ... there is a thing.

Class A have List<B>... 
Class B have List<C>... 

One Entity has for example 10 Bs ... and each B has 20 Cs ... So now .. I have a render method that renders 60x per second.. And I have to call every render method from every object.

So I have something like this

for(A a : listOfAs){
   for(B b : listOfBs){
      for(C c : listOfCs){
         c.render(g);
      }b.render(g);
   }a.render(g);
}

Now if you imagine I have much more objects like that and I call this method 60x per second ... I find this really ...really bad practice.. I don't know how to solve this better or so... I don't think that this for each loop is actually the best solution or not. Anyone any ideas ?

I was thinking about implementing the child like that :

Entity x = new A(); ... 
Entity y = new B(); ... 

and so but some of the classes have other methods that have to be looped like that and I cannot call them from parent.

For the render method ... Just stick to the fact that you have to loop something many times in a short period of time for a long time.

I cannot progress through this ... I got stuck here for a long time and I am not sure how to solve this.



via Chebli Mohamed

jar not launching - UnsatisfiedLinkError

I have exported my java project into a jar in my desktop (chose the option that creates a project.jar and a project_lib).

When I run java -jar project.jar on cmd, I get this exception:

    Exception in thread "main" java.lang.RuntimeException: Application launch error
    at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:122)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.UnsatisfiedLinkError: com.sun.glass.ui.win.WinApplication._invokeLater(Ljava/lang/Runnable;)V
    at com.sun.glass.ui.win.WinApplication._invokeLater(Native Method)
    at com.sun.glass.ui.Application.invokeLater(Application.java:338)
    at com.sun.javafx.tk.quantum.QuantumToolkit.defer(QuantumToolkit.java:620)
    at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:173)
    at com.sun.javafx.application.PlatformImpl.runAndWait(PlatformImpl.java:212)
    at com.sun.javafx.application.PlatformImpl.tkExit(PlatformImpl.java:320)
    at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:421)
    at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:47)
    at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:115)
    ... 1 more

I guess it is probably caused by my project's paths but I don't know how to fix this.



via Chebli Mohamed

Html POST method not working

Why is my method does not work? My Java code:

@POST
@Path("/request=PostStage")
@Produces(MediaType.APPLICATION_JSON)
public String getStagePOST(@QueryParam("fn")String fn,
    @QueryParam("tn")String tn,
    @QueryParam("stat")String stat,
    @QueryParam("length")String length,
    @QueryParam("lon")String lon,
    @QueryParam("lat")String lat,
    @QueryParam("crgw")String crgw,
    @QueryParam("lane")String lane) throws SQLException{
    return "Lat: " + lat + " lon: " + lon + " crgw: " + crgw;
}

My HTML code:

<form action="http://localhost:9090/services/stage/request=PostStage" method="POST">                  
    <p>Localization:</p>
    <p> fn : <input  name="fn" /></p>
    <p> tn : <input  name="tn" /></p>
    <p>stat : <input  name="stat" /></p>
    <p>length : <input name="length" /></p>   
    <p>Geoposition:</p>
    <p>lon : <input name="lon" /></p>
    <p>lat : <input name="lat" /></p>
    <P> Other:</P>
    <p>crgw :  <input name = "crgw" /></p>
    <p> lane : <input  name="lane" /></p>
    <input type="submit" value="Searchh" />
</form> 

I give examples of parameters in a html page: lon - 12, lat - 12 etc. As a result, I get:

Lat: null lon: null crgw: null

Why?

I can not find the problem :(

Very thanks for all answers .



via Chebli Mohamed

refresh runtime with Executors

(1) This code runs the main method within a class (Code (3)) and then writes the console output to a file:

        Class runnable;
        File output;
        try {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            PrintStream ps = new PrintStream(byteArrayOutputStream);
            PrintStream old = System.out;
            System.setOut(ps);
            Method method = runnable.getMethod("main", String[].class);
            method.invoke(null, (Object) null);
            System.out.flush();
            System.setOut(old);
            String consoleOutput = byteArrayOutputStream.toString();
            Files.write(output, consoleOutput);
            Logger.getLogger(Autorunner.class.getName()).log(Level.INFO, "Output written to: {0}", output.getAbsolutePath());
            runnable = runnable.getClassLoader().loadClass(runnable.getName());
        } catch (NoSuchMethodException | SecurityException | IOException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | ClassNotFoundException ex) {
            Logger.getLogger(Autorunner.class.getName()).log(Level.SEVERE, null, ex);
        }

(2) This code executes the above code every 5 seconds:

Executors.newSingleThreadScheduledExecutor().scheduleAtFixedRate(new Autorunner(Test.class, new File("Stuff.txt")), 0, 5, TimeUnit.SECONDS);

(3) This code writes stuff to the console:

System.out.println("stuff");

The problem I'm having is that when I update and compile Code (3) from say System.out.println("stuff"); to System.out.println("More Stuff");, then Code (2) still writes stuff to the console instead of More Stuff. I thought since I had the line runnable = runnable.getClassLoader().loadClass(runnable.getName()); in Code (1) it wouldn't be an issue...



via Chebli Mohamed

Correct stop java application with IBM mq

I use java application with IBM mq websphere. When i am killing the application in mq is remained some information about channels. I don't know way to correct stopping of application.

Simply put, i need kill application with mq channels. Because when i restart application, it can't start and throw exception:

ERROR Failed to initialize Queue Channel.
com.ibm.msg.client.jms.DetailedJMSException: JMSWMQ0018: Failed to connect to queue manager 'TL4UZ8T' with connection mode '1' and host name 'mq4u-TL4UZ8T.lb.com(64424)'.

Thanks for helping!



via Chebli Mohamed

inserting records in database through applet

I am trying to design an applet that stores data in an Oracle database.

There is no compilation error, but when I try to insert the record by clicking the ADD button, it throws an exception:

oracle.driver.OracleDriver

This is my applet code:

import java.applet.*;
import java.awt.*;
import java.sql.*;
import java.awt.event.*;
/*<applet code=registration width=400 height=400></applet>*/
public class registration extends Applet implements ActionListener
{
    Label name;
    TextField txt_name;
    Button btn_add;
    Connection con;
    PreparedStatement pstmt;

    public void init()
    {
        setLayout(null);
        name=new Label("Name");
        name.setBounds(10,20,50,20);
        add(name);

        txt_name=new TextField(20);
        txt_name.setBounds(80,20,120,20);
        add(txt_name);

        btn_add=new Button("ADD");
        btn_add.setBounds(10,50,50,20);
        add(btn_add);

        btn_add.addActionListener(this);
    }//end of init

    public void actionPerformed(ActionEvent e)
    {
      if(e.getSource()==btn_add) {
        try {
            Class.forName("oracle.jdbc.driver.OracleDriver");
            con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","system","system");

            pstmt=con.prepareStatement("insert into test values(?)");
            pstmt.setString(1,txt_name.getText());
            pstmt.executeUpdate();
            System.out.println("saved");
        } catch(Exception c) {
            System.out.println(c.getMessage());
        }
      }
   }
}



via Chebli Mohamed

How do I bind the Interface with Implementation for Generic Classes?

I would like to have an interface for the generic class and utilize it in the dependency injection with the use of Guice. For the code listed below I get the following error:

Exception in thread "main" com.google.inject.CreationException: Unable to create injector, see the following errors:

1) Could not find a suitable constructor in com.ulmon.fsqtransit.guicetest.Class1. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private.
  at com.ulmon.fsqtransit.guicetest.Class1.class(Class1.java:14)
  at com.ulmon.fsqtransit.guicetest.Module.configure(Module.java:14)

--

public class Class1<T1 extends Number, T2 extends Number>
    implements InterfClass1<T1, T2> {
    public static final String ANNOT1 = "ANNOT1";
    public static final String ANNOT2 = "ANNOT2";
    private T1 t1;
    private T2 t2;
    // for the factory
    @AssistedInject
    public Class1(
            @Assisted(Class1.ANNOT1) T1 t1,
            @Assisted(Class1.ANNOT2) T2 t2
            ) {
        this.t1 = t1;
        this.t2 = t2;
    }
    public T1 getT1() {
        return t1;
    }
    public T2 getT2() {
        return t2;
    }
}


public class Module extends AbstractModule {
    @Override
    protected void configure() {

        bind(new TypeLiteral<InterfClass1<Integer, Integer>>(){})
            .to(new TypeLiteral<Class1<Integer, Integer>>(){});
    }

    public static void main(String[] args) {
        Injector inj = Guice.createInjector(new Module());
    }
}

What causes this error?



via Chebli Mohamed

How to call JSP from Java program

How to call JSP file from Java application, and passing to it Java Bean, so as a result I can get rendered HTML code as output. Java program - it's stand-alone application, that runs by someone. No servlet please.



via Chebli Mohamed

javaw keeps restoring itself

My javaw.exe process is infinitely restoring itself launching a windows error windows saying "A Java Exception has ocurred". I've tried taskkill, windows task manager and they keep coming back. How do I fix this?



via Chebli Mohamed

is this java interface tactic sound?

I've been thinking about implementing a certain tactic for my code.

This is my setup:

I've got an interface called "Object". Then I've got an interface called "Entity" that extends "Object". From entity then springs countless implementations, like "army", "city", "lemon", etc.

Now, I want to gather all of these Objects into some form of map. Then from that map I want to get the particular implementation of "Object".

My thought out solution for this is as follows:

Object has method :

public Entity getEntity()

All implementations of Object returns null, while Entity returns itself.

Likewise, in entity I'd have:

public Army getArmy()
public City getCity()

That way, I can simply pull an object from the map and get the specific class from it with a series of null checks, like so;

Object o = Objects.getObject(2dCoordinates);
Entity e = o.getEntity();
if (e != null){
Army a = e.getArmy();
if (a != null)
a.armySpecificMethod();
}

All without using "instanceof" and casting, which I hate.

The question is whether there's some unforeseen problem about this? I'd rather learn from someone that knows before refactoring my code and find out for myself.



via Chebli Mohamed

Regex for number range from 0 to 31 excluding preceding zeros

I have written regex from numbers from 0 to 31. It shall not allow preceding zeros.

[0-2]\\d|/3[0-2]

But it also allows preceding zeros.

01 invalid
02 invalid

Can some tell me how to fix this.



via Chebli Mohamed

How do I get the Magnolia empty webapp running with the Standard Templating Kit?

I'm having lots of trouble getting the Magnolia empty webapp project running, all related to Maven dependencies. It seems to be an extreme case of If you give a mouse a cookie, because every time I add a required dependency it throws an exception asking for another, and it's never enough.

I've been trying to follow this guide, which starts out using the Maven archetype command so it's not quite from scratch. The problem is that guide was written awhile back so the version numbers have changed a lot since then, and it seems the newest versions just aren't compatible with themselves.

Here's what my acme-project-webapp/pom.xml file looks like:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://ift.tt/IH78KX" xmlns:xsi="http://ift.tt/ra1lAU" xsi:schemaLocation="http://ift.tt/IH78KX http://ift.tt/HBk9RF">

    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.acme</groupId>
        <artifactId>acme-project</artifactId>
        <version>1.0-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    <artifactId>acme-project-webapp</artifactId>
    <name>Acme Project: webapp</name>
    <packaging>war</packaging>

    <repositories>
        <repository>
            <id>magnolia-repo</id>
            <name>Magnolia Repository</name>
            <url>http://ift.tt/1MKklCr;
        </repository>
    </repositories>

   <dependencies>
    <dependency>
        <groupId>info.magnolia</groupId>
        <artifactId>magnolia-empty-webapp</artifactId>
        <type>pom</type>
    </dependency>
    <dependency>
        <groupId>info.magnolia</groupId>
        <artifactId>magnolia-empty-webapp</artifactId>
        <type>war</type>
    </dependency>
    <dependency>
        <groupId>info.magnolia</groupId>
        <artifactId>magnolia-module-standard-templating-kit</artifactId>
        <version>2.9</version>
    </dependency>
    <dependency>
        <groupId>info.magnolia</groupId>
        <artifactId>magnolia-module-dms</artifactId>
        <version>1.6.9</version>
    </dependency>
    <dependency>
        <groupId>info.magnolia</groupId>
        <artifactId>magnolia-module-fckeditor</artifactId>
        <version>4.4.2</version>
    </dependency>
    <dependency>
        <groupId>info.magnolia</groupId>
        <artifactId>magnolia-module-mail</artifactId>
        <version>5.2.2</version>
    </dependency>
    <dependency>
        <groupId>info.magnolia</groupId>
        <artifactId>magnolia-imaging-support</artifactId>
        <version>3.2</version>
    </dependency>
</dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <dependentWarExcludes>WEB-INF/lib/*.jar</dependentWarExcludes>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

When I try to run the project, I get a host of exception messages. Here's what they say:

The following exceptions were found while checking Magnolia modules dependencies (i.e. those in META-INF/magnolia/my-module.xml): Module Magnolia JSP Templating Support Module (version 5.4.0) is dependent on templating (version 5.3/*), but Magnolia Templating Module (version 4.4.2) is currently installed.

Module Magnolia RSS Aggregator Module (version 2.4.0) is dependent on scheduler (version 2.2/*), but Magnolia Scheduler Module (version 2.1.1) is currently installed.

Module Magnolia RSS Aggregator Module (version 2.4.0) is dependent on mte (version 0.5/*), which was not found.

Module Magnolia DMS Module (version 1.6.9) is dependent on adminInterface (version 4.5.8/*), but Magnolia Admin Interface Module (version 4.4.2) is currently installed.

Module Magnolia DMS Module (version 1.6.9) is dependent on fckEditor (version 4.5.8/*), but Magnolia FCKEditor Module (version 4.4.2) is currently installed.

Module Magnolia DAM Templating (version 2.1.0) is dependent on templating (version 5.4/* - optional), but Magnolia Templating Module (version 4.4.2) is currently installed.

Module Magnolia Standard Templating Kit Module (version 2.9.0) is dependent on templating (version 5.3/*), but Magnolia Templating Module (version 4.4.2) is currently installed.

Module Magnolia Standard Templating Kit Module (version 2.9.0) is dependent on adminInterface (version 5.2/*), but Magnolia Admin Interface Module (version 4.4.2) is currently installed.

Module Inplace Templating Module (version 2.4.0) is dependent on templating (version 5.4/*), but Magnolia Templating Module (version 4.4.2) is currently installed.

Module Magnolia Public User Registration Module (version 2.4.3) is dependent on templating (version 5.3/*), but Magnolia Templating Module (version 4.4.2) is currently installed.

Module Magnolia 4.5 Migration Module (version 1.2.4) is dependent on adminInterface (version 4.5.10/*), but Magnolia Admin Interface Module (version 4.4.2) is currently installed.

Module Magnolia Resources Module (version 2.4.0) is dependent on templating (version 5.4/*), but Magnolia Templating Module (version 4.4.2) is currently installed.

Module Magnolia Module Forum (version 3.4.6) is dependent on adminInterface (version 5.0.2/*), but Magnolia Admin Interface Module (version 4.4.2) is currently installed.

Module Magnolia Site Module (version 1.0.0) is dependent on templating (version 5.4/*), but Magnolia Templating Module (version 4.4.2) is currently installed.

Module Magnolia Form Module (version 2.2.12) is dependent on templating (version 5.2.2/*), but Magnolia Templating Module (version 4.4.2) is currently installed.

At first I would get messages saying dependencies were not found (in addition to the version mismatches), and so whenever I saw those I would try adding in the missing dependencies one by one. But it's been a long rabbit hole I've been falling down.

Fundamentally I don't really care about all these nested dependencies that it seems to require; all I really want is to get this running with the Standard Templating Kit, and once that's in place, with the Jackrabbit Persistence Manager (so I can use MySQL). Why is this so hard to get running out of the box? How do I even get it running in the first place?



via Chebli Mohamed

Is there a faster way to input data into an arraylist than the previous methods?

Is there any way I can input data into any array list without actually doing the following every-time I want to insert data?

ArrayList<dataType> kwh = new ArrayList<dataType>();
arrayListVariable.add(data);
arrayListVariable.add(moreData);
arrayListVariable.add(evenMoreData);

As of right now, this seems to be very time consuming if I need to put in quite a bit of data into the array list. Is there a better or faster way of doing this?



via Chebli Mohamed

Refactoring class with a lot of Switches and ifs

I'm dealing with a class which has a lot of switches and ifs. I would like to hear from somebody any advice in order to get the best refactoring. I was thinking if it is possible to use functional programming to avoid to much ifs.

The class has two enums and each enum have at least 8 possibilities. So, the logic is based on returning an enum depending on switch-if-else structures.

Thanks in advance!



via Chebli Mohamed

How to increment and decrements the value of the count inside on click listener in getChildView() of Expandable list view adapter?

I am having two buttons in the child view of expandable list view "minus" and "plus".I just need to increase the count of the variable (say int count=0). if I keep this variable on global of the adapter it will take the same count for all child of the group item. then I kept the variable inside the getChildView() as a local variable,Increment or decrements of the count can be done inside the on click listener of the two buttons minus and plus respectively and obviously changed the variable into final. And we know that final variable values cannot be changed.

I am too confused how to do this,is there any best way to do which I am not aware of here is my code. Expandable list view Adapter class:

get child view method:

 public View getChildView(int groupPosition,  int childPosition,
          boolean isLastChild, View convertView, ViewGroup parent) {

  ExChildModel model=(ExChildModel) getChild(groupPosition, childPosition);

  if (convertView == null) {
      convertView = inf.inflate(R.layout.pro_items, null);
  }

  RelativeLayout rl_main=(RelativeLayout)convertView.findViewById(R.id.rl_main);
  RelativeLayout rl_color=(RelativeLayout)convertView.findViewById(R.id.rl_color);
  LinearLayout ll_text=(LinearLayout)convertView.findViewById(R.id.ll_text);
  LinearLayout ll_add=(LinearLayout)convertView.findViewById(R.id.ll_add);
  TextView tv_subtitle=(TextView)convertView.findViewById(R.id.tv_subtitle);
  TextView tv_sub=(TextView)convertView.findViewById(R.id.tv_sub);
  final TextView tv_cost=(TextView)convertView.findViewById(R.id.tv_cost);
  final TextView tv_number=(TextView)convertView.findViewById(R.id.tv_number);
  ImageView iv_minus=(ImageView)convertView.findViewById(R.id.iv_minus);
  ImageView iv_plus=(ImageView)convertView.findViewById(R.id.iv_plus);

  tv_subtitle.setTypeface(gotham_book);
  tv_sub.setTypeface(gotham_light);
  tv_cost.setTypeface(gotham_book);
  tv_number.setTypeface(gotham_book);

  tv_subtitle.setText(model.getHeader());
  tv_sub.setText(model.getDescription());
  tv_cost.setText(Constants.currency+model.getPrice());


  final int price=Integer.parseInt(model.getPrice());


  iv_minus.setOnClickListener(new OnClickListener() {

    @Override
    public void onClick(View v) {
                    if (count!=0) {
            count--;
            tv_number.setText(String.valueOf(count));
            FragmentMenu.tv_count.setText(String.valueOf(count));
            int total=count*price;
            FragmentMenu.tv_cart_money.setText(Constants.currency+String.valueOf(total));

        }else {
            FragmentMenu.tv_count.setVisibility(View.INVISIBLE);
            FragmentMenu.tv_cart_money.setText(Constants.currency+"0");
        }
    }
});

  iv_plus.setOnClickListener(new OnClickListener() {

    @Override
    public void onClick(View v) {
        if (count>=0&&count!=99) {
            count++;
            tv_number.setText(String.valueOf(count));
            FragmentMenu.tv_count.setVisibility(View.VISIBLE);
            FragmentMenu.tv_count.setText(String.valueOf(count));
            int total=count*price;
            FragmentMenu.tv_cart_money.setText(Constants.currency+String.valueOf(total));
        }
    }
});

  return convertView;
  }



via Chebli Mohamed

Code Model Import for Class with Embedded Enum

I'm working on generating some Java classes using CodeModel and I'm having some trouble adding import statements for classes that have embedded static Enum

For example if I have a class and create an instance variable...

Class<?> clazz = getPackageClass();
cls.field(JMod.PRIVATE, codeModel._ref(sourceClass), "testUnderlying");

But this creates code like...

import com.test.platform.xxx.UnderlyingType;
....
private UnderlyingType testUnderlying;

However, if UnderlyingType had a enum field that I want to invoke a static method on (e.g. valueOf)...

private UnderlyingType.EnumType enum;
...
...
UnderlyingType.EnumType.valueOf(xxx);

it seems to confuse CodeModel and instead of having a seprate import and the instance variable I will get

private com.test.platform.xxx.UnderlyingType testUnderlying;

Is it possible invoke the static method without losing the import?

Thanks for your help!



via Chebli Mohamed

How to obscure a password in OSGi Felix component property?

I've got an OSGi component, declared with an annotation, that allows a login credential property to be configured through Felix's configuration UI. I've seen other components that obscure a property text field for passwords, but mine is still in the clear. I'd assume that there is just a flag that is included in the @Property annotation, but I can't find any mention of it in the documentation.

Does anyone know how to create a password field in the configuration UI?



via Chebli Mohamed

Slick2d Lighting with multiply

I'm trying to create some 2d lighting in slick2D. However the result is not quite what I'm looking for.

Currently it's working by drawing the light onto a lightmap and then drawing the lightmap to the screen. When drawing the light to the lightmap I'm just using the screen draw mode, and when drawing the lightmap I'm using the multiply draw mode.

The result is this Drawing the lightmap with normal draw mode I get this

I used the Lightmap image in photoshop and changed the blendingmode to multiply and got this.

For some reason the photoshop result is very dark. It looks much better in photoshop before saving, not as dark.

My question now is how do I get closer to the photoshop result?

This is my code:

public class Light 
{

    public Vector2f Pos;
    public static Image light;
    public Image lightCopy;
    public static Image lightmap;

    private float size=256;
    private static float maxSize=1024;
    public Color lightColor = new Color(255,255,255,255);;
    private static Graphics g2;
    private static Graphics g3;

    public static ArrayList<Light> LightList = new ArrayList<Light>();

    public static void init() throws SlickException
    {
        light = new Image("Light.png");

        lightmap = new Image(1920,1080);

        g3=lightmap.getGraphics();
        maxSize=light.getWidth();
    }


    public Light(Vector2f Pos) throws SlickException
    {
        this.Pos=Pos;
        LightList.add(this);
        lightCopy = light.copy();
        g2=lightCopy.getGraphics();
    }

    public void updateSingle(GameContainer gc, ArrayList<Object> BlockingObjects) throws SlickException
    {
        lightCopy = light.copy();
        g2.setDrawMode(Graphics.MODE_NORMAL);
        g2.setColor(Color.black);
        Rectangle lightPosAndSize = new Rectangle(0,0,maxSize,maxSize);
        g2.fill(lightPosAndSize);
        Vector2f pos = new Vector2f((maxSize/2)-(size/2),(maxSize/2)-(size/2));
        g2.drawImage(light.getScaledCopy(size/maxSize),pos.x, pos.y);
        for(int i=0;i!=BlockingObjects.size();i++)
        {
            Object temp = BlockingObjects.get(i);
            String type = temp.getClass().getSimpleName();
            switch(type)
            {
            case "Circle":
            {
                Circle c = (Circle) temp;
                caseCircle(c);
                break;
            }
            default:
            }
        }
        g2.flush();
    }

    public void renderToLightMap(Graphics g) throws SlickException
    {
        g3.setDrawMode(Graphics.MODE_SCREEN);
        g3.drawImage(lightCopy, Pos.x-maxSize/2, Pos.y-maxSize/2,lightColor);
        g3.setDrawMode(Graphics.MODE_NORMAL);
        g3.flush();
    }

    public static void renderLightmap(Graphics g)
    {
        g.setDrawMode(Graphics.MODE_COLOR_MULTIPLY);
        g.drawImage(lightmap, 0, 0);
        g.setDrawMode(Graphics.MODE_NORMAL);
    }

    private void caseCircle(Circle c)
    {

    }



    public static void renderAll(Graphics g, GameContainer gc,ArrayList<Object> BlockingObjects ) throws SlickException 
    {
        g3=lightmap.getGraphics();
        g3.setColor(new Color(0,0,0));
        g3.fill(new Rectangle(0,0,1920,1080));
        g3.flush();
        for(int i=0;i!=LightList.size();i++)
        {
            Light temp = LightList.get(i);
            temp.updateSingle(gc, BlockingObjects);
            temp.renderToLightMap(g);   
        }
        renderLightmap(g);
    }

I was going to post this at the slick2d forum, however I didn't recieve the activation mail so I couldn't create a thread there.

Hopefully you understand my problem and if you need more information I will try to provide you with it. Hopefully the links of my images works as well.



via Chebli Mohamed

diffuculties with a Regex Pattern in Java

I am facing a problem regarding Regex pattern creation in order to get all the required tokens. My String value on which regex will be applied have this shape can be like this;

Value:

"DB_TABLE_LUX.field_8='bbb \' `\" dsd' and DB_TABLE_FRA.field_1 = ' bbb dsd' and DB_TABLE_FRA.fieldName = ' bbb dsd ' or DB_TABLE_GER.field_3= 125 "

Required result: I want to have a list of Strings having those values

List {

"DB_TABLE_LUX.field_8='bbb \' `\" dsd'",

"DB_TABLE__FRA.field_1 = ' bbb dsd'",

"DB_TABLE_FRA.fieldName = ' bbb dsd '",

"DB_TABLE_GER.field_3= 125" }

Following the regex used :

"DB_TABLE_[a-zA-Z]{3}\.\w+\s*\=\s*([0-9]+|(\'(\s*\w+\s*)+\'))"

The regex below is not extracting the whole data, the first values is missing and below is the result

List{

"DB_TABLE_FRA.field_1 = ' bbb dsd'",

"DB_TABLE_FRA.fieldName = ' bbb dsd '",

"DB_TABLE_GER.field_3= 125" }

I want to take into account the next value

DB_TABLE_LUX.field_8='bbb \' `\" dsd'

Thanks.



via Chebli Mohamed

Find potential methods that invoke a method using reflection or static code analysis

This question is not a duplicate of - How do I find the caller of a method using stacktrace or reflection?

I am trying to analyze all possible paths to a particular method for my codebase. I'm envisioning something like this:

Class clazz = MyClass.class;
Method method = clazz.getMethod("myMethod");
Method[] possibleCallers = getMethodsThatInvokeMethod(method); // <-- How do I implement this

Is this possible using reflection? If not, are there any open libraries that can help?



via Chebli Mohamed

Hibernate JPA deadlock

I have the an entity that is being modified in a transaction. After the modification i use the entityManager.flush() method but the transaction is not committed. In another transaction I recover the modified entity using READ_UNCOMMITTED isolation. I modify the entity and I try to commit the transaction but it does not work. I get a deadlock. Is there a way to unlock the entity from the first transaction so that I can commit the second transaction with the entity modified?



via Chebli Mohamed

Get online current date and time without using Apis

Apis usually let you get limited free requests, so I am looking for an alternative to get current Date and Time always I want (online one, not from the System/device), without restrictions and free. Ofcourse, must be trusted and confirent responses (is useless to get wrong or outdate responses, or unavailable requests)



via Chebli Mohamed

ArrayList return size() zero

mNewList return size() zero but it contains data that it show in ListView, mListData.getContacts(); returns ArrayList fetched from server via internet but its not a problem as i written before it shows data in ListView.

ArrayList<String> mNewList = new ArrayList<String>();
mNewList = mListData.getContacts();
adapter = new ArrayAdapter<String>(MainActivity.this, 
android.R.layout.simple_list_item_1, mNewList);
mList.setAdapter(adapter);



via Chebli Mohamed

foxy proxy enable in chrome in webdriver

I want my web-driver program to run in chrome with foxy proxy enabled.Can someone help me,I am a beginner.I created a profile in Firefox,It worked.But for chrome i dint get.



via Chebli Mohamed

Is there a way to paste a file from the system clipboard to MS Exchange's email as attachment?

I am doing a project that needs to send email from MS Exchange server, but the company has a policy not to turn on smtp/pop3, so I was trying to find another way to send email with Java through Exchange, searched the net couldn't find an answer [ How to send email with java using MS Exchange server? ], then I suddenly realize Java has a robot, why don't I use the robot to simulate a user action to send an email by clicking and typing and attach files as a user would usually do, so with that in mind I was able to use Java robot to open a new email, paste in "To", "CC", "Subject", "Content" and click send, it was successful.

But the only obstacle now is how to simulate the attach file action ? I just learned that Java can copy a file to the system clipboard from this question : Can Java system clipboard copy a file?

The next logical question is : How do you attach this file on the system clipboard on to a new email message in MS Exchange 2013 ? I tried to use shortcuts, but none of the shortcuts has attach function :

http://ift.tt/1gFXTyt

http://ift.tt/1OMftuW

I wonder if I can somehow paste this file on the system clipboard into the email message as attachment ?



via Chebli Mohamed

Dynamically add ImageButtons

I have to dynamically create ImageButtons for an Array of images after a network call is completed. I currently have it working with the amount of buttons hardcoded, but the amount of buttons will be dynamically added and removed on the server.

The XML Code is below this works as its hardcoded:

<LinearLayout xmlns:android="http://ift.tt/nIICcg"
          xmlns:tools="http://ift.tt/LrGmb4"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:orientation="horizontal"
          android:weightSum="1"
          tools:background="@color/black"
android:id="@+id/dotw_list">

<ImageButton
    android:id="@+id/dotw_imageButton_1"
    android:layout_width="60dp"
    android:layout_height="60dp"
    android:layout_marginBottom="10dp"
    android:layout_marginLeft="10dp"
    android:layout_marginRight="10dp"
    android:layout_marginTop="10dp"
    android:adjustViewBounds="false"
    android:background="@drawable/layout_bg"
    android:padding="5dp"
    android:scaleType="centerInside"/>

<ImageButton
    android:id="@+id/dotw_imageButton_2"
    android:layout_width="60dp"
    android:layout_height="60dp"
    android:layout_marginBottom="10dp"
    android:layout_marginRight="10dp"
    android:layout_marginTop="10dp"
    android:adjustViewBounds="false"
    android:background="@drawable/layout_bg"
    android:padding="10dp"
    android:scaleType="centerInside"/>

<ImageButton
    android:id="@+id/dotw_imageButton_3"
    android:layout_width="60dp"
    android:layout_height="60dp"
    android:layout_marginBottom="10dp"
    android:layout_marginRight="10dp"
    android:layout_marginTop="10dp"
    android:adjustViewBounds="false"
    android:background="@drawable/layout_bg"
    android:padding="10dp"
    android:scaleType="centerInside"/>

<ImageButton
    android:id="@+id/dotw_imageButton_4"
    android:layout_width="60dp"
    android:layout_height="60dp"
    android:layout_marginBottom="10dp"
    android:layout_marginRight="10dp"
    android:layout_marginTop="10dp"
    android:adjustViewBounds="false"
    android:background="@drawable/layout_bg"
    android:padding="10dp"
    android:scaleType="centerInside"/>

<ImageButton
    android:id="@+id/dotw_imageButton_5"
    android:layout_width="60dp"
    android:layout_height="60dp"
    android:layout_marginBottom="10dp"
    android:layout_marginRight="10dp"
    android:layout_marginTop="10dp"
    android:adjustViewBounds="false"
    android:background="@drawable/layout_bg"
    android:padding="10dp"
    android:scaleType="centerInside"/>
</LinearLayout>

Below is the code I have used to hard code it but i need this to be dynamically changed when there are more/less items in the Array

private BroadcastReceiver mMessageReceiver = new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent intent) {

    // Get extra data included in the Intent
    String message = intent.getStringExtra("network_response");
    Log.d("receiver", "Got message: " + message);

    home = data.getHomeItem();


    try {
        for (int i = 0; i < home.dotwItemArray.size(); i++) {
            System.out.println("Size of DOTW Array for the home screen is " + home.dotwItemArray.size());

            DotwItem dotwItem = home.dotwItemArray.get(i);

            if (i == 0) {
                request.getImage(dotwItem.getThumbnailImageUrl(), button_dotw_1);
                System.out.println("dotwItem1 is set");
            }
            if (i == 1) {
                request.getImage(dotwItem.getThumbnailImageUrl(), button_dotw_2);
                System.out.println("dotwItem2 is set");
            }
            if (i == 2) {
                request.getImage(dotwItem.getThumbnailImageUrl(), button_dotw_3);
                System.out.println("dotwItem3 is set");
            }
            if (i == 3) {
                request.getImage(dotwItem.getThumbnailImageUrl(), button_dotw_4);
                System.out.println("dotwItem4 is set");
            }
        }

    } catch (Exception e) {
        System.out.println("Error is: " + e + " - Exception is it: " + e.getStackTrace()[2].getLineNumber());

    }
}
};

The reason I am doing this, is because I dont know the length of the Array that I am getting until the network call is complete. The network call is initiated in the onCreate method and as you can see this is in the onReceive method, this method is initiated once the network call is completed.

I had a look at this link from StackOverflow but Im a little confused as I am trying to set the image based on the network request.

Thanks



via Chebli Mohamed

Log4J Impacting JAXB

I am migrating a SOAP WS application from WL10 to WL12. We had an issue with how JAXB interprets this XML element:

<sch:testVar xsi:nil="true" xmlns:xsi="http://ift.tt/ra1lAU"/>

In WL10, JAXB correctly marshalls this to a null object. In WL12, JAXB converts this to an empty String.

After a lot of research about classpaths and data binding providers, we finally traced down the problem... Log4J.

We are using Maven and adding the dependency Log4J 1.2.16 changes everything. When Log4J is in the application, the XML above renders as an empty String. Removing only the Log4J dependency from the pom, JAXB renders the XML above as null.

Does anyone know why Log4J would impact JAXB?

A couple notes:

  • We are aware of how WL12 changed JAXB implementations. We spent several days changing classpaths and dependencies.
  • We are working with a very stripped down application. Our other dependencies include Spring (core, context-support, web, tx, ws-core) 3.1.1. That's it.
  • Our test endpoint doesn't do anything other than output what the object is.
  • Log4J2 works fine.
  • Our Log4J 1.2.16 dependency pulls in no other dependencies with it

The dependency tree from the maven build is below:

[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ RJM-Training-SOAP-WS ---
[INFO] com.mycompany:RJM-Training-SOAP-WS:war:0.0.1-SNAPSHOT
[INFO] +- org.springframework:spring-core:jar:3.1.1.RELEASE:compile
[INFO] |  +- org.springframework:spring-asm:jar:3.1.1.RELEASE:compile
[INFO] |  \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- org.springframework:spring-context-support:jar:3.1.1.RELEASE:compile
[INFO] |  +- org.springframework:spring-beans:jar:3.1.1.RELEASE:compile
[INFO] |  \- org.springframework:spring-context:jar:3.1.1.RELEASE:compile
[INFO] |     \- org.springframework:spring-expression:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:spring-web:jar:3.1.1.RELEASE:compile
[INFO] |  \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework:spring-tx:jar:3.1.1.RELEASE:compile
[INFO] |  \- org.springframework:spring-aop:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework.ws:spring-ws-core:jar:2.1.2.RELEASE:compile
[INFO] |  +- org.springframework.ws:spring-xml:jar:2.1.2.RELEASE:compile
[INFO] |  +- org.springframework:spring-oxm:jar:3.1.3.RELEASE:compile
[INFO] |  |  \- commons-lang:commons-lang:jar:2.5:compile
[INFO] |  +- org.springframework:spring-webmvc:jar:3.1.3.RELEASE:compile
[INFO] |  \- wsdl4j:wsdl4j:jar:1.6.1:compile
[INFO] \- log4j:log4j:jar:1.2.16:compile

The JAXB context we are using is below:

[user@server logs]$ grep JAXBContext WSServer01.log.out 
[Loaded javax.xml.bind.JAXBContext from /opt/weblogic/wl12.1.2.0/wlserver/../oracle_common/modules/endorsed/javax-xml-bind.jar]
[Loaded com.sun.xml.bind.v2.runtime.JAXBContextImpl from file:/opt/weblogic/wl12.1.2.0/oracle_common/modules/com.sun.xml.bind.jaxb-impl_2.2.jar]
[Loaded com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder from file:/opt/weblogic/wl12.1.2.0/oracle_common/modules/com.sun.xml.bind.jaxb-impl_2.2.jar]
[Loaded com.sun.xml.bind.v2.runtime.JAXBContextImpl$5 from file:/opt/weblogic/wl12.1.2.0/oracle_common/modules/com.sun.xml.bind.jaxb-impl_2.2.jar]
[Loaded com.sun.xml.bind.v2.runtime.JAXBContextImpl$6 from file:/opt/weblogic/wl12.1.2.0/oracle_common/modules/com.sun.xml.bind.jaxb-impl_2.2.jar]
[Loaded com.sun.xml.bind.v2.runtime.JAXBContextImpl$3 from file:/opt/weblogic/wl12.1.2.0/oracle_common/modules/com.sun.xml.bind.jaxb-impl_2.2.jar]
[Loaded com.sun.xml.bind.v2.runtime.JAXBContextImpl$7 from file:/opt/weblogic/wl12.1.2.0/oracle_common/modules/com.sun.xml.bind.jaxb-impl_2.2.jar]
[Loaded com.sun.xml.bind.v2.runtime.JAXBContextImpl$1 from file:/opt/weblogic/wl12.1.2.0/oracle_common/modules/com.sun.xml.bind.jaxb-impl_2.2.jar]
[Loaded com.sun.xml.bind.v2.runtime.JAXBContextImpl$2 from file:/opt/weblogic/wl12.1.2.0/oracle_common/modules/com.sun.xml.bind.jaxb-impl_2.2.jar]

I went into the code and logged the JAXB class used. It is the same in both instances.

file:/opt/weblogic/wl12.1.2.0/oracle_common/modules/endorsed/javax-xml-bind.jar!/javax/xml/bind/JAXBContext.class



via Chebli Mohamed

Exception when using array adapter and listView

This is my activity class, copied by a book (Apress, "Pro Android 5"), that, by side, is a book full of typos in the code...

package com.example.list1;

import java.util.ArrayList;
import java.util.Arrays;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class MainActivity extends Activity {

    private ListView listView1;
    private ArrayAdapter<String> listAdapter1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);



        // Create an object of type ArrayList from an array of strings
        String[] someColors = new String[] { "Red", "Orange", "Yellow", "Green", "Blue", "Indigo", "Violet", "Black", "White"};
        ArrayList<String> colorArrayList = new ArrayList<String>();
        colorArrayList.addAll( Arrays.asList(someColors) );

        // Use values from colorArraylist as values for each text1 'sbuView' used by the listView
        listAdapter1 = new ArrayAdapter<String>(this, android.R.id.text1, colorArrayList);


        // Tell to the listView to take data and layout from our adapter
        listView1 = (ListView) findViewById(R.id.listView1);        
        listView1.setAdapter( listAdapter1 );

    }
}

And this is my layout file

<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
    xmlns:tools="http://ift.tt/LrGmb4"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.list1.MainActivity" >

    <ListView
        android:id="@+id/listView1"
        android:layout_width="fill_parent"
        android:layout_height="match_parent" >

    </ListView>   

</RelativeLayout>

When I save, Eclipse give me no problem. When I run the app crash and from logcat I can see an exception that i'm not able to understand/debug

08-04 13:43:34.382: E/AndroidRuntime(888):  
android.content.res.Resources$NotFoundException: File  from xml type layout resource ID #0x1020014

What am I doing wrong?



via Chebli Mohamed

How to convert a string to boolean expression

I have a string like "((TRUE && TRUE) | (TRUE && FALSE))" which I want to convert to boolean. How can I achieve this?



via Chebli Mohamed

Draw circle countdown with the libgdx

I am prety new on LibGDX,and trying to create a circle which shows the remaning time of the game.For that purpose I find this called RadialSprite,but dont know how to apply it. what I have treid so far like this.

@Override
    public void render(float delta) {
        // TODO Auto-generated method stub

         Texture txturecircle = new Texture(Gdx.files.internal("circle.png"));;

         TextureRegion regions= new TextureRegion(txturecircle);
         RadialSprite rd=new RadialSprite(regions);

        Gdx.gl.glClearColor(1, 1, 1, 1);
        Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
        batch.begin();

        rd.draw(batch, 100, 10,0);
        batch.end();   
        stage.draw();
        stage.setDebugAll(true);


    }

My update function which create images again depents on the remaning time of the game.

int time = 0;
    @Override
    public void show() {
        // TODO Auto-generated method stub
        com.badlogic.gdx.utils.Timer.schedule(new Task() {

                    @Override
                    public void run() {
                       DrawTimer();

                    }
                }, 1,1);
    }
    private void DrawTimer() {
         Texture txturecircle = new Texture(Gdx.files.internal("circle.png"));;

         TextureRegion regions= new TextureRegion(txturecircle);
         RadialSprite rd=new RadialSprite(regions);
        Log.d("tımer",String.valueOf(time));
        batch.begin();
        time++;
        rd.draw(batch, 90, 110, 36*time);
        batch.end();

    }



via Chebli Mohamed

Is there a Matcher for recursively comparing directories?

I'm writing unit tests for IM- and exporting files. I need to test the resulting directory recursively byte by byte. I implemented a routine for flat directories by myself and know how to do this recursively also. But I don't want to reinvent the wheel.

So is there something like the following examples?

Matchers.matches(Path actual, equalsRecursive(Path value));

or

FileAssertions.equalsRecursive(Path actual, Path value);



via Chebli Mohamed

Single Threaded Server Implementation to Multi Threaded

Guys I want to convert my server implementation into multi thread so that it can handle multiple requests. Basically the server is connected with an android application and it is recieving an image from android application. I want to add a thread so that it can handle multiple requests and the thread should start when the request is recieved. Kindly help me out.

This is the Server Code.

public static void main(String[] args) throws UnknownHostException, IOException, MatlabInvocationException, MatlabConnectionException {
    while (true) {
        try {
            serverSocket = new ServerSocket(4001); // Server socket

        } catch (IOException e) {
            System.out.println("Could not listen on port: 4001");
        }
        System.out.println("Server started. Listening to the port 4001");

            clientSocket = serverSocket.accept();
            DataInputStream inputFromClient = new DataInputStream(clientSocket.getInputStream());
            int count = inputFromClient.readInt();
            int available = inputFromClient.available();
            System.out.println("Length of Image in Bytes:" + count);
            System.out.println("available:" + available);
            image = new byte[count];
            inputFromClient.readFully(image);
            System.out.println(image.length);
            System.out.println(image);
            final BufferedImage bufferedImage = ImageIO.read(new ByteArrayInputStream(image));
            ImageIO.write(bufferedImage, "jpg", new File("image.jpg"));
            System.out.println("Image has been wriiten in the directory.");

        MatlabProxyFactory mpf = new MatlabProxyFactory();
        MatlabProxy proxy = mpf.getProxy();
        proxy.eval("conclusion=DetectColorL");
        Object[] obj = proxy.returningEval("conclusion", 1);
        String Message = obj[0].toString();
        DataOutputStream outTo = new DataOutputStream(clientSocket.getOutputStream());
        outTo.writeUTF(Message.toString());
        System.out.println(Message);
        proxy.disconnect();
        serverSocket.close();



via Chebli Mohamed

Jsch Shell won't accept input from Terminal

I have written a simple groovy program that uses the Jsch Library to establish an ssh tunnel and open a shell on the target server. The script connect fine and the shell opens. In IntelliJ I can enter input into the shell and get the subsequent output if I run the program. However if I attempt to do the same in the Terminal or in a cmd it connects fine but I cannot enter any input so can't run commands.

println "Opening connection to ${sshUser}@${sshHost}:${sshPort}"
Properties config = new Properties()
config.put("StrictHostKeyChecking", "no")
JSch jsch = new JSch()

Session sshSession = jsch.getSession(sshUser, sshHost, sshPort as int)
sshSession.setPassword(sshPass)
sshSession.setConfig(config)
sshSession.connect()
println "Connected"


println "Forwarding connection to ${targetHost}:${targetPort}"
def assignedPort = sshSession.setPortForwardingL(0, targetHost, targetPort as int)
println "Got port $assignedPort"

// Set the session to open as a Shell
Channel channel = targetSession.openChannel("shell")
// Set Input and Output streams
channel.setInputStream(System.in)
channel.setOutputStream(System.out);
// Connect
channel.connect()



via Chebli Mohamed

Apache Spark Sql issue in multi node hadoop cluster

Hi I am using Spark java apis to fetch data from hive. This code is working in hadoop single node cluster. But when I tried to use it in hadoop multi node cluster it throws error as

org.apache.spark.SparkException: Detected yarn-cluster mode, but isn't running on a cluster. Deployment to YARN is not supported directly by SparkContext. Please use spark-submit.

Note : I have used master as local for single node and yarn-cluster for multi node.

And this is my java code

 SparkConf sparkConf = new SparkConf().setAppName("Hive").setMaster("yarn-cluster");
 JavaSparkContext ctx = new JavaSparkContext(sparkConf);
 HiveContext sqlContext = new HiveContext(ctx.sc());
org.apache.spark.sql.Row[] result = sqlContext.sql("Select * from Tablename").collect();

Also I have tried to change master as local and now it throws unknown hostname exception.
Can anyone help me in this?



via Chebli Mohamed

HREF + TEXT with Jsoup

I've the following HTML Page:

 </div><div id="page_content_list01" class="grid_12">
 <h2><strong class="floatleft">TEXT1</strong></h2><br>
    <table>

<tbody>
    <tr>
        <th class="no_width">

<p class="floatleft">Attachments:</p>
        </th>
        <td class="link_azure">   
            <a target="_blank" href="http://www.example.com">TEXT2</a><br/>

        </td>
    </tr>
</tbody>
    </table><h2><strong class="floatleft">TEXT3</strong></h2><br>
    <table>

<tbody>
    <tr>
        <th class="no_width">

<p class="floatleft">Atachments:</p>
        </th>
        <td class="link_azure">   
            <a target="_blank" href="http://www.example2.com">TEXT4</a><br/>

        </td>
    </tr>
</tbody>
    </table><h2><strong class="floatleft">TEXT5</strong></h2><br>
    <table>

<tbody>
    <tr>

I wanna try to select element with

 div id="page_content_list01"

that contains class grid_12. Actually I'm doing:

 Elements rows = document.select(".grid_12");

but this select also other grid_12 classes, that are not inner the div.

Althrough I also want to select "TEXT" and link. I wanna to make clickable link, so I'm using:

  for (Element eleme : rows) {
       Elements elements = eleme.select("a");
       for (Element elem : elementi) {
            String url = elem.attr("href");
            String title = elem.text();
       }
  }

and I'm getting:

 url = "http://www.example.com";
 title = "TEXT2";

and it's ok, but in this way I can't read "TEXT1" and "TEXT3". Can someone help me please?



via Chebli Mohamed

is it possible to store ResultSet from a query into an array and use the array as search parameters for an SQL query

i have two tables WorkSkillsPlanning(WSP) and TrainingAchieved(TA). WSP hold a list of planed training and targeted number of people to be trained e.g. ISOO:90001 10 people while TA holds the actual number of people trained as well as the actual course done. Since WSP and TA are dynamic in the sense that the data they hold is not static neither is known as training plans can change is it possible to run an intersect query on these table to find similarities i.e a course in WSP which has actually be done and recorded in TA. Store the results of the intersect query in an array e.g. MyArrayList{ISO,COMMUNICATION) these being values present in both table and use MyArrayList values to run count queries on TA to establish the number of people who would have done the course i.e ISO and COMMUNICATION and use the resultant to subtract from WSP (ISO,COMMUNICATION).

here is an example, first part

"Select QUALIFICATIONGROUP from  APP.WSP intersect select COURSEBOOKED from APP.BOOKCOURSE"

which results in ISO and COMMUNICATION which i want to store in an ARRAY or variable.

second part

select count(COURSEBOOKED) from APP.BOOKCOURSE where COURSEBOOKED = Variable1
 rs.getString(Count(COURSEBOOKED))
 value returned == 5

re do the process again for COMMUNICATION and any other course in the array, of which after use the values returned from the count query to subtract to subtract WSP total minus TA total.

I hope this makes sense



via Chebli Mohamed

Prime calculation formula does not shows prime number till 100000 it show till 9973

long i = 0;
int primeNumberCounter = 1;
long upperLimit = 100000;
PrintWriter writer = resp.getWriter();
while (++i <= upperLimit) {
    long i1 = (long) Math.ceil(Math.sqrt(i));
    boolean isPrimeNumber = false;
    while (i1 > 1) {
        if ((i != i1) && (i % i1 == 0)) {
            isPrimeNumber = false;
            break;
        } else if (!isPrimeNumber) {
            isPrimeNumber = true;
        }
        --i1;
    }

    if (isPrimeNumber) {
        writer.write(String.valueOf(i));
        writer.write("\n");
        ++primeNumberCounter;
    }
}

I deployed above code on google app engine.I am getting value till 9973 not 99991 which must be last prime number.Thanx any help appreciated



via Chebli Mohamed

Applying map of the earth texture a Sphere

i been trying to implement a 3D animation in openGL (using JOGL) of a solar system so far i have 5 planets of different sizes but the problem i seem to be having is i cant add a map of the earth texture on a Sphere can anybody please help me on how its done thanks this is the code i have so far in my Display method

@Override
public void display(GLAutoDrawable drawable) {
    GL2 gl = drawable.getGL().getGL2(); 
    GLU glu = new GLU();
    gl.glClear(GL.GL_COLOR_BUFFER_BIT);

    //make sure we are in model_view mode
    gl.glMatrixMode(GL2.GL_MODELVIEW);
    gl.glLoadIdentity();
    glu.gluLookAt(10,20,20,0,3,0,0, 20, 0);
    //gl.glMatrixMode(GL2.GL_PROJECTION);
    //glu.gluPerspective(45,1,1,25);

    //render ground plane
    gl.glPushMatrix();
    gl.glTranslatef(-10.75f, 3.0f, -1.0f);
    gl.glColor3f(0.3f, 0.5f, 1f);
    GLUquadric earth = glu.gluNewQuadric();
    glu.gluQuadricDrawStyle(earth, GLU.GLU_FILL);
    glu.gluQuadricNormals(earth, GLU.GLU_FLAT);
    glu.gluQuadricOrientation(earth, GLU.GLU_OUTSIDE);
    final float radius = 3.378f;
    final int slices = 89;
    final int stacks = 16;
    glu.gluSphere(earth, radius, slices, stacks);
    glu.gluDeleteQuadric(earth);

    Texture earths;
    try {
      earths = TextureIO.newTexture(new File("earth.png"), true);
    }
    catch (IOException e) {    
      javax.swing.JOptionPane.showMessageDialog(null, e);
    }        
    gl.glPopMatrix();
    //gl.glEnd();

    gl.glPushMatrix();
    gl.glTranslatef(2.75f, 3.0f, -0.0f);
    gl.glColor3f(0.3f, 0.5f, 1f);
    GLUquadric earth1 = glu.gluNewQuadric();
    glu.gluQuadricDrawStyle(earth1, GLU.GLU_FILL);
    glu.gluQuadricNormals(earth1, GLU.GLU_FLAT);
    glu.gluQuadricOrientation(earth1, GLU.GLU_OUTSIDE);
    final float radius1 = 3.378f;
    final int slices1 = 90;
    final int stacks1 = 63;
    glu.gluSphere(earth1, radius1, slices1, stacks1);
    glu.gluDeleteQuadric(earth1);
    gl.glPopMatrix();

    gl.glPushMatrix();
    gl.glTranslatef(3.75f, 6.0f, -7.20f);
    gl.glColor3f(0.3f, 0.5f, 1f);
    GLUquadric earth3 = glu.gluNewQuadric();
    glu.gluQuadricDrawStyle(earth3, GLU.GLU_FILL);
    glu.gluQuadricNormals(earth3, GLU.GLU_FLAT);
    glu.gluQuadricOrientation(earth1, GLU.GLU_OUTSIDE);
    final float radius3 = 1.878f;
    final int slices3 = 89;
    final int stacks3 = 16;
    glu.gluSphere(earth3, radius3, slices3, stacks3);
    glu.gluDeleteQuadric(earth3);
    gl.glPopMatrix();   

    gl.glPushMatrix();
    gl.glTranslatef(12.75f, 2.0f, -7.20f);
    gl.glColor3f(0.3f, 0.5f, 1f);
    GLUquadric earth4 = glu.gluNewQuadric();
    glu.gluQuadricDrawStyle(earth4, GLU.GLU_FILL);
    glu.gluQuadricNormals(earth4, GLU.GLU_FLAT);
    glu.gluQuadricOrientation(earth4, GLU.GLU_OUTSIDE);
    final float radius4 = 1.078f;
    final int slices4 = 89;
    final int stacks4 = 16;
    glu.gluSphere(earth4, radius4, slices4, stacks4);
    glu.gluDeleteQuadric(earth4);

    gl.glPopMatrix(); 

    gl.glPushMatrix();
    gl.glTranslatef(2.75f, -6.0f, -0.0f);
    gl.glColor3f(0.3f, 0.5f, 1f);
    GLUquadric earth5 = glu.gluNewQuadric();
    glu.gluQuadricDrawStyle(earth5, GLU.GLU_FILL);
    glu.gluQuadricNormals(earth5, GLU.GLU_FLAT);
    glu.gluQuadricOrientation(earth5, GLU.GLU_OUTSIDE);
    final float radius5 = 3.778f;
    final int slices5 = 90;
    final int stacks5 = 63;
    glu.gluSphere(earth5, radius5, slices5, stacks5);
    glu.gluDeleteQuadric(earth5);
    gl.glPopMatrix();        

}



via Chebli Mohamed

Java passing className + object to generic method

So I'm complete lost in the part of generic method's. In Android java I want a MyDownloadHelper for downloading my JSON data which will be returned next. Got this working in 2 seperate files with different class/object-names. However, I can't get this thing to work dynamicly. This is my current source.

The current situation will let me call the MySQLiteHelper.getRecipients(); in another activity and will me return the correct data. I am also using 2 classes (Pakbon, Recipient) for setting the correct data.

I think I'm pretty close to the solution but i really need a blow in the right direction. Thanks in advantage.

public class MyDownloadHelper {

private static final int timeout = 10000;
private  Class<? extends Object[]> cls;
private static final String API_SERVER = "http://www.***.nl/json/";
private Object[] obj;

public MyDownloadHelper(){
}

protected Recipient[] getRecipients() {
    try {
        //Recipient[] recipients = getInstance(Recipient[].class);
        Recipient[] recipients   = this.download(Recipient[].class, API_SERVER + "getRecipients");
        return recipients;
    } finally {
        return null;
    }
}

protected Pakbon[] getPackingSlips() {
    try {
        Pakbon[] pakbon = this.download(Pakbon[].class, API_SERVER + "getPackingSlips");
        return pakbon;
    } finally {
        return null;
    }
}

private <T> Object[] download(Class<T> a, String url){
    HttpURLConnection c = null;

    try {
        URL u = new URL(url);
        c = (HttpURLConnection) u.openConnection();
        c.setRequestMethod("GET");
        c.setRequestProperty("Content-length", "0");
        c.setUseCaches(false);
        c.setAllowUserInteraction(false);
        c.setConnectTimeout(timeout);
        c.setReadTimeout(timeout);
        c.connect();
        int status = c.getResponseCode();

        switch (status) {
            case 200:
            case 201:
                Gson gson = new Gson();
                BufferedReader br = new BufferedReader(new InputStreamReader(c.getInputStream()));

                Object[] objectData = gson.fromJson(br, a);
                return gson.fromJson(br, cls);

        }
    } catch (IOException ex) {

    } finally{
        if (c != null) {
            try {
                c.disconnect();
            } catch (Exception ex) {
                Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, ex);
            }
        }
    }



    return null;

}

}



via Chebli Mohamed

EC2 Instance cannot be accessed publicly

I have configured EC2 instance(Ubuntu 14.04) on AWS. Intalled JDK, Tomcat,MySQL to deploy my web-application. After deploying, I can access it using localhost or Public IP(Provided by AWS) from UBUNUTU (inside the ubuntu) but can not access from outside. I want to access it publicly. How to do that?



via Chebli Mohamed

Error creating bean 'entityManagerFactory' defined in ServletContext resource: Unable to build Hibernate SessionFactory

I have been wrestling with this project now for few days and I am at a complete loss shooting in the dark. I have followed too many tutorials and still cannot get this to cooperate. I had this "working" for a bit but later came to find out that my setup did not allow for me to take advantage of repositories. So I had to take a few steps backward. Lately, I started using a hibernate.cfg.xml that has been replaced with persistance.xml but still no luck. Thanks ahead of time.

persistance.xml:

<persistence xmlns="http://ift.tt/UICAJV"
         xmlns:xsi="http://ift.tt/ra1lAU"
         xsi:schemaLocation="http://ift.tt/UICAJV http://ift.tt/O9YdEP"
         version="2.0">
<persistence-unit name="sample" transaction-type="RESOURCE_LOCAL">
    <class>com.test.sms.models.SmsMessage</class>
    <properties>
        <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
        <property name="hibernate.connection.password" value="password"/>
        <property name="hibernate.connection.url" value="jdbc:http://sqlserverMasterDb0;database=SMS_SERVICE"/>
        <property name="hibernate.connection.username" value="username"/>
        <property name="hibernate.default_schema" value="SMS_SERVICE"/>
        <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>
    </properties>
</persistence-unit>

sevlet.xml

<beans xmlns="http://ift.tt/GArMu6"
   xmlns:xsi="http://ift.tt/ra1lAU"
   xmlns:mvc="http://ift.tt/1bHqwjR"
   xmlns:context="http://ift.tt/GArMu7"
   xmlns:jpa="http://ift.tt/1iMF6wA"
   xsi:schemaLocation="http://ift.tt/GArMu6
    http://ift.tt/1jdM0fG
    http://ift.tt/1bHqwjR http://ift.tt/1fmimld http://ift.tt/GArMu7 http://ift.tt/1jdLYo7
    http://ift.tt/1iMF6wA
    http://ift.tt/1jZdjKs">

<mvc:annotation-driven/>
<context:annotation-config/>
<context:component-scan base-package="com.test.sms"/>
<jpa:repositories base-package="com.test.sms.models.repository"/>

<bean id="jsonMessageConverter" class="org.springframework.http.converter.json.GsonHttpMessageConverter"/>
<bean name="handlerMapping"
      class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"/>

<bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">
    <property name="messageConverters">
        <list>
            <ref bean="jsonMessageConverter"/>
        </list>
    </property>
</bean>

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="net.sourceforge.jtds.jdbc.Driver"/>
    <property name="url" value="jdbc:http://sqlserverMasterDb0;database=SMS_SERVICE"/>
    <property name="username" value="username"/>
    <property name="password" value="password"/>
</bean>

<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="dataSource" ref="dataSource"/>
    <property name="packagesToScan" value="com.test.sms"/>
    <property name="jpaVendorAdapter">
        <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"/>
    </property>
    <property name="jpaProperties">
        <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
        </props>
    </property>
</bean>

<!-- Configure the transaction manager bean -->
<bean id="transactionManager"
      class="org.springframework.orm.jpa.JpaTransactionManager">
    <property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>

pom.xml

<project xmlns="http://ift.tt/IH78KX" xmlns:xsi="http://ift.tt/ra1lAU"
     xsi:schemaLocation="http://ift.tt/IH78KX http://ift.tt/HBk9RF">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test.sms</groupId>
<artifactId>SMSService</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>SMSService</name>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.2.5.RELEASE</version>
</parent>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
    </dependency>
    <!-- Spring dependencies -->
    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>1.0.0.GA</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-dao</artifactId>
        <version>2.0.8</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
        <version>${spring.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context-support</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <!-- Non-Spring dependencies -->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.0.1</version>
    </dependency>

    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.5</version>
    </dependency>

    <dependency>
        <groupId>com.twilio.sdk</groupId>
        <artifactId>twilio-java-sdk</artifactId>
        <version>4.4.4</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>

    <dependency>
        <groupId>org.jmockit</groupId>
        <artifactId>jmockit</artifactId>
        <version>1.18</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>net.sourceforge.jtds</groupId>
        <artifactId>com.springsource.net.sourceforge.jtds</artifactId>
        <version>1.2.2</version>
    </dependency>

    <dependency>
        <groupId>com.tngtech.java</groupId>
        <artifactId>junit-dataprovider</artifactId>
        <version>1.9.4</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.3.1</version>
    </dependency>
</dependencies>

<build>
    <finalName>SMSService</finalName>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <mainClass>com.test.sms</mainClass>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.18.1</version>
            <configuration>
                <includes>
                    <include>**/*Tests.java</include>
                </includes>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.3</version>
            <configuration>
                <webXml>src/main/webapp/WEB-INF/web.xml</webXml>
            </configuration>
        </plugin>
    </plugins>
</build>

<repositories>
    <repository>
        <id>spring-releases</id>
        <name>Spring Releases</name>
        <url>http://ift.tt/1A9iaEo;
    </repository>
    <repository>
        <id>org.jboss.repository.releases</id>
        <name>JBoss Maven Release Repository</name>
        <url>http://ift.tt/NpWKvb;
    </repository>
</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>spring-releases</id>
        <name>Spring Releases</name>
        <url>http://ift.tt/1A9iaEo;
    </pluginRepository>
</pluginRepositories>

Stack Trace:

08:05:20.398 [http-bio-8164-exec-5] INFO  o.s.o.j.LocalContainerEntityManagerFactoryBean - Building JPA container EntityManagerFactory for persistence unit 'default'
08:05:20.411 [http-bio-8164-exec-5] DEBUG o.s.j.d.DriverManagerDataSource - Creating new JDBC DriverManager Connection to [jdbc:http://sqlserverMasterDb0;database=SMS_SERVICE]
08:05:20.419 [http-bio-8164-exec-5] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Retrieved dependent beans for bean 'org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter#3fbdd602': [entityManagerFactory]
08:05:20.420 [http-bio-8164-exec-5] WARN  o.s.w.c.s.XmlWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/SMSService-servlet.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:956) ~[spring-context-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:747) ~[spring-context-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480) ~[spring-context-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:664) [spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:630) [spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:678) [spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:549) [spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:490) [spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136) [spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at javax.servlet.GenericServlet.init(GenericServlet.java:158) [servlet-api.jar:3.0.FR]
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284) [catalina.jar:7.0.63]
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197) [catalina.jar:7.0.63]
    at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:864) [catalina.jar:7.0.63]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:134) [catalina.jar:7.0.63]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) [catalina.jar:7.0.63]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505) [catalina.jar:7.0.63]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) [catalina.jar:7.0.63]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) [catalina.jar:7.0.63]
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:957) [catalina.jar:7.0.63]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) [catalina.jar:7.0.63]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423) [catalina.jar:7.0.63]
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079) [tomcat-coyote.jar:7.0.63]
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:620) [tomcat-coyote.jar:7.0.63]
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316) [tomcat-coyote.jar:7.0.63]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_31]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_31]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-coyote.jar:7.0.63]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_31]
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:1249) ~[hibernate-entitymanager-4.3.10.Final.jar:4.3.10.Final]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.access$600(EntityManagerFactoryBuilderImpl.java:120) ~[hibernate-entitymanager-4.3.10.Final.jar:4.3.10.Final]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:860) ~[hibernate-entitymanager-4.3.10.Final.jar:4.3.10.Final]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850) ~[hibernate-entitymanager-4.3.10.Final.jar:4.3.10.Final]
    at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:425) ~[hibernate-core-4.3.10.Final.jar:4.3.10.Final]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:849) ~[hibernate-entitymanager-4.3.10.Final.jar:4.3.10.Final]
    at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60) ~[spring-orm-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:343) ~[spring-orm-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:318) ~[spring-orm-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1633) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    ... 34 common frames omitted
Caused by: org.hibernate.AnnotationException: Cannot find the expected secondary table: no smsUser available for com.test.sms.models.database.SmsMessage
    at org.hibernate.cfg.Ejb3Column.getJoin(Ejb3Column.java:416) ~[hibernate-core-4.3.10.Final.jar:4.3.10.Final]
    at org.hibernate.cfg.Ejb3Column.getTable(Ejb3Column.java:397) ~[hibernate-core-4.3.10.Final.jar:4.3.10.Final]
    at org.hibernate.cfg.AnnotationBinder.bindManyToOne(AnnotationBinder.java:2829) ~[hibernate-core-4.3.10.Final.jar:4.3.10.Final]
    at org.hibernate.cfg.AnnotationBinder.bindOneToOne(AnnotationBinder.java:3051) ~[hibernate-core-4.3.10.Final.jar:4.3.10.Final]
    at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1839) ~[hibernate-core-4.3.10.Final.jar:4.3.10.Final]
    at org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(AnnotationBinder.java:963) ~[hibernate-core-4.3.10.Final.jar:4.3.10.Final]
    at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:796) ~[hibernate-core-4.3.10.Final.jar:4.3.10.Final]
    at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3845) ~[hibernate-core-4.3.10.Final.jar:4.3.10.Final]
    at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3799) ~[hibernate-core-4.3.10.Final.jar:4.3.10.Final]
    at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1412) ~[hibernate-core-4.3.10.Final.jar:4.3.10.Final]
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1846) ~[hibernate-core-4.3.10.Final.jar:4.3.10.Final]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:857) ~[hibernate-entitymanager-4.3.10.Final.jar:4.3.10.Final]
    ... 42 common frames omitted
08:05:20.421 [http-bio-8164-exec-5] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@792116a0: defining beans [mvcContentNegotiationManager,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0,org.springframework.format.support.FormattingConversionServiceFactoryBean#0,org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean#0,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#0,mvcUriComponentsContributor,org.springframework.web.servlet.handler.MappedInterceptor#0,org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver#0,org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver#0,org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver#0,org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping,org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter,org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,sendController,messageValidator,org.springframework.data.jpa.repository.config.JpaRepositoryConfigExtension#0,org.springframework.data.repository.core.support.RepositoryInterfaceAwareBeanPostProcessor,foo,jpaMappingContext,smsMessageRepository,smsUserRepository,jsonMessageConverter,handlerMapping,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#1,dataSource,entityManagerFactory,transactionManager,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor,org.springframework.orm.jpa.SharedEntityManagerCreator#0]; root of factory hierarchy
08:05:20.421 [http-bio-8164-exec-5] ERROR o.s.web.servlet.DispatcherServlet - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/SMSService-servlet.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:956) ~[spring-context-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:747) ~[spring-context-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480) ~[spring-context-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:664) ~[spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:630) ~[spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:678) ~[spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:549) ~[spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:490) ~[spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136) [spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at javax.servlet.GenericServlet.init(GenericServlet.java:158) [servlet-api.jar:3.0.FR]
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284) [catalina.jar:7.0.63]
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197) [catalina.jar:7.0.63]
    at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:864) [catalina.jar:7.0.63]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:134) [catalina.jar:7.0.63]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) [catalina.jar:7.0.63]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505) [catalina.jar:7.0.63]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) [catalina.jar:7.0.63]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) [catalina.jar:7.0.63]
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:957) [catalina.jar:7.0.63]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) [catalina.jar:7.0.63]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423) [catalina.jar:7.0.63]
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079) [tomcat-coyote.jar:7.0.63]
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:620) [tomcat-coyote.jar:7.0.63]
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316) [tomcat-coyote.jar:7.0.63]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_31]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_31]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-coyote.jar:7.0.63]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_31]
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:1249) ~[hibernate-entitymanager-4.3.10.Final.jar:4.3.10.Final]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.access$600(EntityManagerFactoryBuilderImpl.java:120) ~[hibernate-entitymanager-4.3.10.Final.jar:4.3.10.Final]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:860) ~[hibernate-entitymanager-4.3.10.Final.jar:4.3.10.Final]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850) ~[hibernate-entitymanager-4.3.10.Final.jar:4.3.10.Final]
    at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:425) ~[hibernate-core-4.3.10.Final.jar:4.3.10.Final]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:849) ~[hibernate-entitymanager-4.3.10.Final.jar:4.3.10.Final]
    at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60) ~[spring-orm-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:343) ~[spring-orm-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    at 



via Chebli Mohamed