Tuesday, November 18, 2014

Maximo Scheduler 7.5.2 Gantt View Java Settings

Problem:
The Gantt View tab isn't showing in Maximo Scheduler 7.5.2

I use a Maximo 7.5.0.6 environment with Maximo Scheduler 7.5.2 on a Oracle 11G database on Windows Server 2012.


Solution:

First I install Java version 7 update 25  (build 1.7.0_25-b17)

Then when opening the "Gantt View" in Maximo Scheduler 7.5.2 the following messages appear.

In the first message I choose "Later" and check "Do not ask again until next update is available" 


Then I choose [Don't Block]


Then I Check "I Accept the risk and want to run this application"
and Click [Run]


Then on the message about the wrong Java version I click [Run with the latest version]


The errors bewlow appear: 

An exception occured in the script. Error name: TypeError.Error description: Object doesn't support property or method 'initProjectDataModel'. Error number: -2146827850. Error message: Object doesn't support property or method 'initProjectDataModel'


After clicking [OK] the next error occurs:

An exception occured in the script. Error name: TypeError.Error description: Object doesn't support property or method 'setSKDServletURLBase'. Error number: -2146827850. Error message: Object doesn't support property or method 'setSKDServletURLBase'


Then after clicking [OK] the following appears:

An exception occured in the script. Error name: TypeError.Error description: Object doesn't support property or method 'setUISessionId'. Error number: -2146827850. Error message: Object doesn't support property or method 'setUISessionId'


Now when I click [OK] the Gantt shows, but grayed out.

To solve this go to C:\Program Files (x86)\Java\jre7\lib\security and open the file java.policy
In this file add the following lines:
permission java.util.PropertyPermission "user.timezone", "read";
permission java.util.PropertyPermission "user.timezone", "write"; 



Next, open up the Java Control Panel and go to the tab Security. Alter the Security Level to "Medium" 


Apply and close. Go back to the Maximo startcenter and open the Gantt View.

This time the screen is stuck, the load icon isn't moving... 



I also tried Chrome as browser, but in there it also isn't showing anything.

Reason for this is that I disn't create a schedule first.
After creating a Schedule with a query to load up some workorders I do get the Gantt to show up: 


GNZ.

Wednesday, November 12, 2014

Maximo doesn't start, SystemOut.log ORA-28001

Problem:
Maximo doesn't start. The internet browser gives a HTTP 500 Internal Server Error


I use a Maximo 7.5.0.6 environment with a Oracle 11G database on Windows Server 2012.


Solution:

First check the SystemOut.log for the cause. Usually located in  \ibm\WebSphere\AppServer\profiles\ctgAppSrv01\logs\MXServer


[11/12/14 9:03:53:171 CET] 00000011 servlet       I com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0242I: [MAXIMO] [/mbo] [ReportEngineStartupServlet]: Initialization successful.
[11/12/14 9:04:01:346 CET] 00000011 SystemOut     O 12 Nov 2014 09:04:01:335 [ERROR] [] [] BMXAA6421E - The system could not connect to the JDBC source: jdbc:oracle:thin:@localhost.:1521:ctginst1ORA-28001: the password has expired

[11/12/14 9:04:01:346 CET] 00000011 SystemOut     O 12 Nov 2014 09:04:01:346 [ERROR] [] [] BMXAA6418E - There was an error reloading the MAXPROP cache: access#DBConnectFail
[11/12/14 9:04:01:346 CET] 00000011 SystemOut     O 12 Nov 2014 09:04:01:346 [ERROR] [] [] BMXAA6538E - Failed to initialize MAXIMO business object services.
psdi.util.MXSystemException: access#DBConnectFail
at psdi.server.MaxPropCache.reloadCache(MaxPropCache.java:586)
at psdi.server.MaxPropCache.reload(MaxPropCache.java:251)
at psdi.server.MXServer.start(MXServer.java:3173)
at psdi.servlet.MAXIMOStartupServlet.init(MAXIMOStartupServlet.java:70)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:358)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.init(ServletWrapperImpl.java:169)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.initialize(ServletWrapper.java:1809)
at com.ibm.wsspi.webcontainer.extension.WebExtensionProcessor.createServletWrapper(WebExtensionProcessor.java:98)
at com.ibm.ws.webcontainer.webapp.WebApp.initializeTargetMappings(WebApp.java:704)
at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinally(WebApp.java:435)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:304)
at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:100)
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:166)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:731)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:616)
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:376)
at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:668)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1122)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1319)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:610)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:944)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:725)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2046)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:439)
at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:382)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$300(CompositionUnitMgrImpl.java:110)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:949)
at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:349)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604)
Caused by: java.sql.SQLException: ORA-28001: the password has expired


The error is clear: ORA-28001: the password has expired.
Since this is a Oracle error, the expired password must that of the database schema for Maximo.

To solve this problem we need to reset the Maximo database password in Oracle. I log in to the database with SQL developer as the sys user.

To reset the password you can run the follwoing statement:

ALTER USER maximo IDENTIFIED BY maximo;

This will reset the password for the maxmo user to 'maximo'

But I do not want the password to expire again. So I want to set the profile to never expire. First I need to know what profiles there are;

select profile from dba_users where username = 'SYSTEM';



Then on the profile I can set the password to never expire with the following statement;

alter profile default limit password_life_time unlimited;

After you have set this, you need to reset the password again, so the new password will use the new rules.

ALTER USER maximo IDENTIFIED BY maximo;

GNZ.

Sunday, November 9, 2014

WP App part 3 - "the Manual Automatic" - Use images / Taking photo's and storing them in the DataModel

Goal:
Create the functionality to use images from the phone / take image with my phone for my Windows Phone App 'The Manual Automatic" 



Check the first setup in part 1:
http://sometimesiliketopretend.blogspot.com/2014/09/windows-phone-app-part-1-manual.html

Check the setup of the DataModel in part 2:
http://sometimesiliketopretend.blogspot.com/2014/09/wp-app-part-2-manual-automatic-setting.html



Part 3 - Use images / Taking photo's and storing them in the DataModel

An important part of my App are the images / photo's of the manuals you can add to the title and description. They contain the part of the manual you need. So I need the use to be able to take a picture of choose a file from his phone.



Step 1 - Enabling camera functionality

First we need to enable access to the Camera and the Storage card. This is done in the Package.appxmanifest.




Step 2 - Using the FilePicker

In order to Pick a file from the phone or snap a picture, I use the FilePicker finctionality of the phone. This is standard phone behaviour and would be nice to use. 

I searched for an example of this and found a series of jumpstart lessons.

Jumpstart series - Building Apps for Windows Phone 8.1:
http://channel9.msdn.com/Series/Building-Apps-for-Windows-Phone-8-1

I watched lesson 17 - Camera, Media and Audio in Windows Phone 8.1: http://channel9.msdn.com/Series/Building-Apps-for-Windows-Phone-8-1/17

I use the code form the first demo from the jumpstart lesson.

I also need the Reference WriteableBitmapEx.WinRT because when I added some of the code from the lesson I ecountered this error when building:


'Windows.UI.Xaml.Media.Imaging.WriteableBitmap' does not contain a definition for 'FromStream' and no extension method 'FromStream' accepting a first argument of type 'Windows.UI.Xaml.Media.Imaging.WriteableBitmap' could be found (are you missing a using directive or an assembly reference?)

I right click on the References, and choose "Manage NuGet Packages"



I search for 'writable' and install the pakage




Then when buildign I ran into this Build error:

The type or namespace name 'FileOpenPickerContinuationEventArgs' could not be found (are you missing a using directive or an assembly reference?)

After searching on MSDN I found out it is in the 'Windows.ApplicationModel.Activation' namespace. check http://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.applicationmodel.activation.fileopenpickercontinuationeventargs.aspx

But that is already added to my using list. 

My using list of the App.xaml.cs:




So I did some digging on the internet and stumbled upon this post:
http://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn614994.aspx

Seems like since I used a Blank Template and that's why I am missing some basic functions...

Quote from the msdn site:
To call a FileOpenPicker and continue your app
  1. Include the SuspensionManager helper class in your project. This class simplifies lifecycle management for your app. To get the SuspensionManager helper class, create a new Windows Phone app that uses a project template other than the Blank App template. The SuspensionManager.cs file is in the Common folder of the project.
  1. Include a helper class like the custom ContinuationManager helper class in your project. This class includes interfaces and methods that make it easier to continue your app. To get the code for the ContinuationManager helper class, download the File picker sample, or see How to continue your Windows Phone app after calling an AndContinue method.

So I open a Hub App Template and check whats inside the Common folder.



I copied the Common folder of the Hubapp template to the Shared namespace of my own app in Visual Studio.



I renamed the namespace (just type a new name and choose the option to rename the namespace that becomes available:



Then I opened the File picker example folder to copy the ContinuationManager.cs



After adding the code I still get the Build error:

The type or namespace name 'FileOpenPickerContinuationEventArgs' could not be found (are you missing a using directive or an assembly reference?)

Aaarrgggg. 

So back to google...
After searching and trying different things I see that some code can but put specifically in for Windows Phone. You just have to put it between these tags: 

#if WINDOWS_PHONE_APP

#endif


When I put the code with the FileOpenPickerContinueEventsArgs between these statements it compiles!

Like so in the App.xaml.cs:

#if WINDOWS_PHONE_APP
        
        // Entry point for new WP 8.1 Contract-based activation like FileOpenPicker
        protected override void OnActivated(IActivatedEventArgs args)
        {
            var fopArgs = args as FileOpenPickerContinuationEventArgs;
            if (fopArgs != null)
            {
                // Pass the picked files to the subscribed event handlers
                // In a real world app you could also use a Messenger, Listener or any other subscriber-based model
                if (fopArgs.Files.Any() && FilesOpenPicked != null)
                {
                    FilesOpenPicked(fopArgs.Files);
                }
            } 
        }

#endif


So I clean up my code and start over with the example from the jumpstart lesson.
I include the above in the App.xaml.cs and the code below in the AddManual.xaml.cs

These are just snippets of the code, I can't post all the code here, but it should give a good idea of what I am doing.

private void addImageButton_Click(object sender, RoutedEventArgs e)
{
    // Pick photo or take new one
    var fop = new FileOpenPicker();
    foreach (var fileType in SupportedImageFileTypes)
    {
        fop.FileTypeFilter.Add(fileType);
    }
    fop.PickSingleFileAndContinue();                        

}


private async void OnFilesOpenPicked(IReadOnlyList<StorageFile> files)
{
    // Load picked file
    if (files.Count > 0)
    {
        // Check if image and pick first file to show
        var imageFile = files.FirstOrDefault(f => SupportedImageFileTypes.Contains(f.FileType.ToLower()));
        if (imageFile != null)
        {
            // Use WriteableBitmapEx to easily load from a stream
            using (var stream = await imageFile.OpenReadAsync())
            {
                originalBitmap = await new WriteableBitmap(1, 1).FromStream(stream);
                RandomAccessStreamReference rasr = RandomAccessStreamReference.CreateFromStream(stream);
                var streamWithContent = await rasr.OpenReadAsync();
                buffer = new byte[streamWithContent.Size];
                await streamWithContent.ReadAsync(buffer.AsBuffer(), (uint)streamWithContent.Size, InputStreamOptions.None);
            }
                    
            Image.Source = originalBitmap;

        }
    }
}


Next I put up a button to add and image.



When I click on it the Button the FilePicker is opened




I can snap a picture and/or choose a photo. Then the picture is shown on the page. :)

Next step is to actually save the picture in my json. I wll do that part in a next post because this is getting a bit long now.


GNZ.



References:

From the jumpstart series - Building Apps for Windows Phone 8.1:
http://channel9.msdn.com/Series/Building-Apps-for-Windows-Phone-8-1

I watched lesson 17 - Camera, Media and Audio in Windows Phone 8.1: http://channel9.msdn.com/Series/Building-Apps-for-Windows-Phone-8-1/17

Done some reading in these posts, but didn;t really used them: Quickstart: Capturing video by using the MediaCapture API:
http://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn642092.aspx