23 February 2016

Webservices Practice 5.1 alternative

To use the Glassfish JAXB RI instead of the default Eclipse MOXy implementation in Weblogic 12.1.1 add this to the beginning of your %DOMAIN_HOME%\bin\setDomainEnv.cmd. %MW_HOME% is set to the installation location of WebLogic.

if NOT "%PRE_CLASSPATH%"=="" (set PRE_CLASSPATH=;%PRE_CLASSPATH%)
set PRE_CLASSPATH=%MW_HOME%\modules\databinding.override_1.0.0.0.jar%PRE_CLASSPATH%


On Weblogic 12.2.1 you should use WL_HOME (=%MW_HOME%\wlserver) instead of MW_HOME.

21 February 2016

Link Blogger to Google Drive

Blogger supports including images from Picassa, but when you include an image as a share link from Google drive, this seems to work initially, but the converted link does not work anymore after a while. So, you end up, saving your images twice in google storage.
Here's a post on converting a Google Drive link for usage with Blogger.

20 February 2016

Webservices Excercises Module 13: JAX-WS only

 Exercise 13-1

  1. Generate SSL artefacts
    • Edit certgen.bat (do not double click). Adapt the paths at the top of the file to reflect the correct paths on your machine.
      • The individual steps that are executed by the script are explained in Practice A-2
    • Run the script from the command line
  2. Configure WebLogic for WS-Security
    • Edit sslconfig.bat (do not double click). Adapt the paths at the top of the file to reflect the correct paths on your machine.
    • Edit sslconfig.py.  Adapt the paths at the top of the file to reflect the correct paths on your machine.
      • The script uses the WebLogic Scripting Tool (WLST). The  same procedure using the administration Console is explained in Practice A-3. 
    • If WebLogic is not running, start it.
    • run sslconfig.bat from the command line 
    • The script stops WebLogic. Start it again afterwards.
    • Connect to the WebLogic Admin Console over SSL, using URL https://localhost:7002/console
      • The browser warns you because it does not know the certificate authority
        •  Verify the certificate
        • Approve the connection
  3. Open theCardDecksWS project
  4. If you did not enable JAX-WS HTTP dumping in Excercise 5-7, do it now.
  5. Add a new library to NetBeans using Tools> Ant Libraries
    • Create a new library
      • Name: WebLogic Web Services API
      • Type:  Server Libraries
    • Press Add JAR/Folder, browse to the WebLogic folder and add modules/ws.api_2.0.0.0.jar
    • Click OK   
  6. Add the "WebLogic Web Services API" library to the CardDecksWS project
  7. View the policy file you will use
    • Expand Libraries> Oracle WebLogic Server> weblogic.jar> weblogic.wsee.policy.runtime
    • Double click Wssp1.2-2007-Wss1.1-UsernameToken-Plain-X509-Basic256.xml 
    • Examine the file
    • Close the file
  8. Open ejbs.CardDeckSessionBean.java
  9. Annotate the class with @Policy to 
    • use the policy you have just viewed 
    • add it to the WSDL
  10. Using the @Policies and   @Policy annotation on every method indicate that
    • webservice calls should be signed
    • webservice calls should be encrypted
    •  this should be added to the WSDL
  11. Correct any errors and save
  12. View the WSDL at http://localhost:7001/CardDeckSessionBean/CardDeckSessionBeanService?wsdl
    •  Notice the wsp1_2:Policy elements that have been added
  13. Open the GenericCardGameWS project in NetBeans
  14. Open games.CardGameService
  15. After the creation of the port in the createCardGame method, add code to use WS-Security, as shown in slides 13-17 to 13-19
  16. Refresh the JAX-WS artefacts and cached WSDL
    • In the Web Service References Node, right click the CardDeckSessionBeanService and choose Refresh
    • Select the checkbox to also replace the WSDL
    • Click Yes
  17. Correct any errors and save
    •  Clear the WebLogic Server Output window (right click>clear)
  18. Open the Weblogic Test Client at http://localhost:7001/wls_utc
  19. Enter WSDL http://localhost:7001/GenericCardGameWS/CardGameService?wsdl
    • Create a cardGame with 1 deck and 2 jokers
    • Inspect the SOAP messages
      • View the Oracle WebLogic Server output window in NetBeans
      • Compare the calls to Try to see the difference between the calls to 
        • CardGameService
        • CardDeckSessionBeanService

 Exercise 13-2

  1. Check the time between the first and last message in a call in the previous exercise
  2. In the CardGameService class, modify the usage of the CarDeckSessionBeanService. Apply the same kind of optimisations on the service as in step 2 in the activity guide.
  3. Apply the same kind of optimisations on the CarDeckSessionBean port as in step 3 in the activity guide
  4. Correct errors and save. 
  5. Check the time again between the calls when creating a card game.

19 February 2016

WebLogic 12.1.2 zip install: terminalio to read the password securely is not found


My WebLogic 12.1.2 install from the zip distribution aborted after asking for the domain admin user with the error message:

Native Library(terminalio) to read the password securely from commandline is not found
It appears that this is a different symptom of the same error I had working with Weblogic 12.1.1: the native libraries delivered with WebLogic are not in the PATH. My system is a 64 bit windows system, so i need to add the libraries for this platform to avoid this error.
I added one line to %WL_HOME%\wlserver\server\bin\setWLSEnv.cmd
set WL_HOME=C:\wl12120
@REM added the next line
set PATH=%WL_HOME%\server\native\win\x64;%PATH%
If you do this, the installation and the configuration of a default domain run smoothly. As explained in my previous post, after the domain creation, also add this line to the domain envionment setup file %domain_dir\bin\setDomainEnv.cmd. If you don't you'll get warnings about Weblogic reverting to less efficient file reading libraries etc.

13 February 2016

Oracle SQL info

  • Oracle 11g SQL reference
  • SQL developer keboard shortcuts
    •  Tools>preferences>shortcut keys
    • CTRL+SHIFT+D: copy current line down
  • Changing the password
    •  change it in the database
alter user user_name identified by "new_password" replace "old_password"

8 February 2016

Java Web Services resources (edit)

Java EE component versions overview (edit)

The table below lists the components in latest versions of the Java Enterprise Edition.

  • I put the most important changes in red.
  • Components with a (version number) between brackets are  proposed for removal in a future release.
    • JAX-WS is intended to replace JAX-RPC
  • An x indicates a technology is removed from the specification
    • JSR's are shown as hyperlinked numbers.
    • SE indicates that an API was moved to the standard edition 
      • eventually followed with the version number
      • Java SE version history is in a separate post
    • Web technologies are in a separate post
    • EJB history is in a separate post
    • I added some application servers at the bottom of the table. 
    Technologies151
    J2EE 1.4

    2003
    244
    Java EE5

    2006
    316
    Java EE6

    2009
    342
    Java EE7

    4/2013
    366
    Java EE8
    Java SE59 1.4176 5270 6336 7337 8
    EJB153 2.1220 3.0318 3.1345 3.2
    Servlet/JSP2.42.53.03.14.0
    EE Management77 1.0



    JMS 914 1.1

    343 2.0368 2.1
    JTA 9071.01.1
    1.2
    JavaMail 9191.31.41.51.6
    Connector (JCA)112 1.51.5322 1.61.7
    Java Activation Framework (JAF) 9251.01.1SE:1.1.1
    Web Services 1091.11.21.3
    1.4
    Web Services Metadata 181
    2.0SESE(2.1)
    JAX-RPC 1011.1
    (1.1)x
    JAX-WS (SOAP) 2241.02.0SE (2.1)SE (2.2)
    JAX-RS (REST)

    311 1.1
    Jersey 1.1.5
    339 2.0370 2.1
    JAXB 222
    2.0SE:2.2
    JSON-P  353 1.03741.1
    JSON-B 367
     1.0
    JAXR (UDDI Registry)1.0
    (1.0)x
    SOAP w attachments (SAAJ) 671.21.3SE
    StAX 173
    1.0SE
    JMX1.2SESE
    container authorisation (JACC) 1151.01.11.41.5
    container authentication (JASPIC) 196

    1.01.1
    Security 375



    1.0
    Common annotations 250
    1.01.11.21.3
    Java Persistence (JPA)
    1.0317 2.0338 2.12.2
    Bean Validation

    303 1.0349 1.1
    Managed Beans

    1.0
    Interceptors
    1.01.11.2
    CDI for Java EE

    299 1.0346 1.1365 2.0
    DI for Java 330

    1.0
    Concurrency utilities 236


    1.0
    State management 350


    1.0
    Batch  352


    1.01.1
    JCache 107



    1.0
    Servers
    Sun JSAS89.1
    Glassfish23 (12/2009)4 (5/2013)
    JBoss / WildFly457 (7/2011)8 (2/2014)
    IBM Websphere678 (6/2011)-
    Oracle Weblogic91012.1.1
    (12/2011)
    12.2.1 (11/2015)
    Apache Geronimo123 (7/2012)-
    • J2EE 1.3(2001) introduced
      • Message Driven  Beans
      • Local interfaces
    • Profiles are a subset of the spec.
      • Java EE Web profile (only profile currently defined)
        • contents
          • java SE
          • web technologies,
          •  JTA, common annotations, JPA, validation, managed beans, interceptors, CDI, DI
          • EJB Lite
            • Stateless, Stateful, and Singleton session beans
              • asynchronous session beans (EJB 3.2)
            • only local EJB interfaces or no interfaces
            • interceptors
            • security
            • transactions
            • non persistent timer only (EJB 3.2)
            • No Message Driven beans and remote invocation.
          • JAX-RS (Java EE7)
        • implemented by
          • Resin 4
          • Apache TomEE 

        Java EE web technology version history (edit)


        JSR numbers are included as links.
        Servers are webcontainers.Take care, web containers do not include JSF. You have to add it yourself or use an enterprise application server. Enterprise application servers are included in the
        complete Java EE version overview.

        Java EEservletJSP     ELJSTLJSF    WebSocketMVCServer       What’s new
        2.1
        1.0

        iPlanet
        jetty 1
        ServletContext, RequestDispatcher
        1.2
        2.2
        1.1
        tomcat 3.3
        jetty 3
        war
        1.3
        53 2.3
        53 1.2
        tomcat 4.1
        jetty 4
        filters
        1.4
        154 2.4
        152 2.0
        1.0
        52 1.1
        tomcat 5.5
        jetty 5
        5
        2.5
        245 2.1
        2.1
        1.2
        127 1.2

        tomcat 6
        jetty 6
        annotations
        6
        315 3.0
        2.2
        2.2

        314 2.0

        tomcat 7
        jetty 8
        asynchronous servlets, EL method calls, more...
        7
        340 3.1
         341 3.0

        344 2.2
        356 1.0

        tomcat 8
        jetty 9.1
        HTML 5, non blocking (Listener) servlet IO
        8
        369 4.0


        372 2.3

        371 1.0tomcat 9 (future)HTTP/2

        JPA CriteriaQuery call structure

        The sequence of calls and the objects involved in a CriteriaQuery is complex at first. 
        CriteriaQuery uses a fluid builder patters which mimics the structure of a JPQL/SQL query. I highlighted the creation of the parameters and the calls in which they are used.
        The parameters are not exactly those in the API, i oversimplified to give an idea of the general structure of a criteria query.


        UMLet UML drawing & scripting (edit)

        UMLet is a basic free and open source drawing tool for UML diagrams. It is witten in java and comes in a standalone version and as an eclipse plugin. In the market of UML tools (cfr. an earlier blog on Astah) it has a unique take on modelling.

        First it is a drawing tool. Real UML tools try to have one model for which each diagram gives a different, but consistent perspective. UMLet just lets you draw and link UML components. But it does not assist you in UML syntax or consistency. Neither does it have any code or documentation generation features as the higher end tools have.
        The advantage is that UMLet does not have the overhead of defining the model behind the diagram. Also it does never get in the way when you want to do something that is not supported by UML or your tool.

        Second where you expect a drawing tool to beLaTeX targeted on a strong, intuitive, graphic and interactive user interface, each element in UML is backed by an austere interface and text definition. You draw your diagrams, elements and connections using a point and click interface. Modifiying elements , changing style and appearance, adding details is done in one associated text box. The text language is compact and simple.  This makes UMLet a very geeky tool. Sometimes you have to compose elements, like sequence diagram lifelines, from several subparts. On the other hand, you never have to wade through a hierarhy of interactions dialogues to fill in all characteristic of an element you have definied.

        Surprisingly UMLet works easy and fast, like few other tools do. It is a good fit for taking agile modeling  beyond the whiteboard. You can easily extend the toolboxes with elements or create your own.

        The default toolboxes do not have all UML elements and, what's worse, are are a bit sloppy in UML syntax. As you can easliy modify and expand this can be amended, but there is a risk that UML newbies pick up bad UML manners from the tool:

        • uses <<includes>>, <<extends>> instead of <<include>>, <<extend>>
        • synchronous messages  in sequence diagrams do not have a filled arrow head
        • return arrows in sequence diagrams do not have a dashed line
        • no found message in sequence diagram 
        • no * cardinality as in the UML standard 
        There is a set of "all in one" diagrams that present entire diagrams as one element that you can configure by editing the properties. I did not find any way to interact with them graphically. You are really scripting your diagram in text, like in the LaTeX days of text processors.

        Here's a nice intro video.

        2 February 2016

        Java plugin deprecated in Java9

        With Java9 the java web plugin will be discontinued. Browsers like Microsoft Edge are removing plugin support, so this is a logical step.
        Java's origins are in embedded execution, running applets in the browser, using the plugin.
        Oracle has a whitepaper with migration options.