mercredi 14 novembre 2018

cxf deployment :No services have been found.

No services have been found.

This problem occurs when you want to deploy a web service using cxf on server like tomcat:

and you have a deployment descriptor like this:

<servlet>
 <servlet-name>cxfservlet</servlet-name>
 <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
 <load-on-startup>1</load-on-startup>
 </servlet>

  <servlet-mapping>
 <servlet-name>cxfservlet</servlet-name>
 <url-pattern>/services/*</url-pattern>
 </servlet-mapping>


And a configuration file for cxf .This file must have the name cxf-servlet.xml and this is a rule .

So to resolve this problem of  "No services have been found", you must verify the name of that file,first of all.

mardi 30 octobre 2018

Encoded password does not look like BCrypt

Encoded password does not look like BCrypt

This error occurs,if you user JWT for authentification when you develop Using SpringBoot.

if you are using in your pom.xml for example like this:


<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>


and these dependencies:

<dependency>
    <groupId>org.springframework.security.oauth</groupId>
    <artifactId>spring-security-oauth2</artifactId>
    <version>2.0.7.RELEASE</version>
</dependency>

<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-jwt</artifactId>
    <version>1.0.4.RELEASE</version>
</dependency>


change the parent version to 1.5.4.RELEASE, and it will be like this:

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

and others put their versions like this:

<dependency>
    <groupId>org.springframework.security.oauth</groupId>
    <artifactId>spring-security-oauth2</artifactId>
   </dependency>

<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-jwt</artifactId>
  
</dependency>


jeudi 21 décembre 2017

org.hibernate.cfg.jdbcbinderexception duplicate class name generated for

org.hibernate.cfg.jdbcbinderexception duplicate class name generated for


To resolve this problem you have to add this property to hibernate.cfg.xml, 
and add the value of shema in uppercase.

  <property name="hibernate.default_schema">DEV</property>

vendredi 27 octobre 2017

canno't start tomcat on netbeans

Thes problem is that if you want to start tomcat on netbeans ,it fails.

To resolve this must do like this:




and uncheck proxy:



lundi 11 septembre 2017

is not mapped as an embeddable

Is not mapped as an embeddable.

To resolve this problem you must disable JPA validation for builds.

To do this: you must:

1-Right-click on the project
2-select properties.
3-Select Validation
4-check Enable project specific settings.

5-Uncheck JPA Validator. Clean the project





mercredi 30 août 2017

org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet: class path resource [java/lang/annotation/Target.class]

org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet: class path resource [java/lang/annotation/Target.class]


To resolve this problem you must use Spring 4 is  for java 8 to . if you use   Spring version: 3.2.5.RELEASE, you must use java 7.

dimanche 30 juillet 2017

Error:Failed to find Build Tools revision 24.0.2

Error:Failed to find Build Tools revision 24.0.2


To resolve this error you must add Android SDK Build-tools like this:



mardi 11 avril 2017

Caused by: java.lang.IllegalArgumentException: Illegal pattern character 'Y'

Caused by: java.lang.IllegalArgumentException: Illegal pattern character 'Y'


This exceptions can occur, if you want to parse to a date for example and you put the patter of year wrong

on SimpleDateFormat like this:

SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-YYYY");

whereas ,it must be  like this :


SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");

jeudi 2 février 2017

java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet

java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet

This exception appears when you use a maven project.
to resolve it you must follow these steps:





mercredi 1 février 2017

List Java contains doesn't work as expected

List Java contains doesn't work as expected

I have this code not working as expexted:

import java.util.Arrays;
import java.util.List;

public class Test {
static int[] listm = { 2,3,5 };

public static void main(String[] args) {

contains(listm, 2);
}

public static boolean contains(int[] array, int key) {

List l = Arrays.asList(array);
boolean contain = l.contains(key);
System.out.println("" + contain);
return contain;
}

}

it returns  false,even the item 2 is found on the collection listm .

To resolve this problem,we must change the generic value of the collection to Integer.

The code become like this.


public class Test {
static Integer[] listm = { 2,3,5 };

public static void main(String[] args) {

contains(listm, 2);
}

public static boolean contains(Integer[] array, int key) {

List<Integer> l = Arrays.asList(array);
boolean contain = l.contains(key);
System.out.println("" + contain);
return contain;
}

}








it works :)


vendredi 16 décembre 2016

Caused by: java.lang.RuntimeException: Could not find conduit initiator for address:

Caused by: java.lang.RuntimeException: Could not find conduit initiator for address: 

This problme can be caused by the absence of  this jar :cxf-rt-transports-http-3.0.0.jar.

jeudi 15 décembre 2016

org.apache.cxf.Messages != org.apache.cxf.APIMessages

java.lang.IllegalArgumentException: org.apache.cxf.Messages != org.apache.cxf.APIMessages

This exeption can occur when we use web service with cxf.
Here,we have a problem of jar between server side and client side.
for example on server we have this version cxf-core-3.0.0.jar  wich  contains org.apache.cxf.Messages


But on client we find this version cxf-bundle-20.10 wich  contains org.apache.cxf.APIMessages.

To resolve this exception we have just to change cxf-bundle-20.10 by  cxf-bundle-3.0.0-milestone2.zip  wich  contains org.apache.cxf.Messages.

I hope this help you :)




error on mapping with @EmbeddedId

Eclipse error on mapping with @EmbeddedId.

this error occurs when you use composite id on JPA project 
To resove it you must do like this :
Preferences -> Java Persistence -> JPA -> Errors/Warnings -> Attribute -> Embedded ID classes should not contain relationship mappings: (Ignore)


dimanche 16 octobre 2016

failed to create the java virtual machine

failed to create the java virtual machine


This problem appears when you launch eclipse.

To resolve it you must open the file eclipse.ini . and change the value of -Xmx1024m to -Xmx512m


the final file you obtain is like this;


-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20120913-144807
-product
com.android.ide.eclipse.adt.package.adtproduct
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.7
-XX:MaxPermSize=256m
-Xms40m
-Xmx512m

dimanche 4 septembre 2016

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in


to resolve this deprecated warning you can add   "@" operator before function name like

 @mysql_connect("localhost","root","");

or add this function

 error_reporting(E_ALL ^ E_DEPRECATED)

in fact:
To not display the E_DEPRECATED errors (for example) without changing the rest of the configuration :
error_reporting(error_reporting() & (-1 ^ E_DEPRECATED));

http://www.php.net/manual/fr/function.error-reporting.php

error in http connection org.apache.http.conn.HttpHostConnectException: Connection to

Error in http connection org.apache.http.conn.HttpHostConnectException: Connection to http://192.168.1.72:80 refused


This exception occured when you connect to server and is not started .you must verify the server wamp or easyphp for example is started or no.

samedi 3 septembre 2016

Exception in thread "main" org.hibernate.PropertyValueException: not-null property references a null or transient value:

Exception in thread "main" org.hibernate.PropertyValueException: not-null property references a null or transient value: persistance.Client.prenom
at org.hibernate.engine.Nullability.checkNullability(Nullability.java:72)


This exception occurs because you have a column named prenom wich is not nullable , and you forgot to set it's value.

So to resolve this issue you must add a valuet to this property .

lundi 29 août 2016

org.hibernate.LazyInitializationException: could not initialize proxy - no Session

org.hibernate.LazyInitializationException: could not initialize proxy - no Session
 org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:57)
 org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:111)
 org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:150)


This problem occurs when you have a relation between tow tables.
Your objects are lazy initialized. That's mean, they are initializing only on demand on non-closed session. 
To resolve this exception add laze=false  into you mapping file or  change FetchType.LAZY to FetchType.EAGER
if you use annotation.

In fact,the EAGER strategy is a requirement on the persistence provider runtime that data must be eagerly fetched. The LAZY strategy is a hint to the persistence provider runtime that data should be fetched lazily when it is first accessed.

vendredi 26 août 2016

Error:Execution failed for task ':app:dexDebug'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program

finished with non-zero exit value 2

To resolve this issue you must go to your build.gradle on your module
and add:
 multiDexEnabled true

after defaultConfig {

and  add:
 compile 'com.android.support:multidex:1.0.0'

on dependencies {