JDeveloper doesn’t like remote deploying to weblogic

Error, error, trying to deploy directly to Application server in JDeveloper. It kept failing, had to  deploy a war then install/deploy in weblogic console.

[09:39:49 AM] ----  Deployment started.  ----
[09:39:49 AM] Target platform is  (Weblogic 10.3).
[09:39:49 AM] Retrieving existing application information
[09:39:49 AM] Running dependency analysis...
[09:39:49 AM] Building...
[09:39:49 AM] Deploying profile...
[09:39:49 AM] Wrote Web Application Module to C:\work\Oracle_IAM\iam\JDeveloper_Projects\Captcha\deploy\captcha.war
[09:39:49 AM] Deploying Application...
[09:39:50 AM] Weblogic Server Exception: weblogic.management.ManagementException: [Deployer:149007]New source location, 'C:\app\oracle\Middleware_IAM\user_projects\domains\IAMDomain\servers\AdminServer\upload\aglc.iam.captcha\1@1\app\captcha.war', cannot be deployed to configured application, 'aglc.iam.captcha [LibSpecVersion=1,LibImplVersion=1]'. The application source is at 'C:\app\oracle\Middleware_IAM\Oracle_IAM1\server\apps\aglc.iam.captcha.war'. Changing the source location is not allowed for a previously attempted deployment. Try deploying without specifying the source.
[09:39:50 AM]   See server logs or server console for more details.
[09:39:50 AM] weblogic.management.ManagementException: [Deployer:149007]New source location, 'C:\app\oracle\Middleware_IAM\user_projects\domains\IAMDomain\servers\AdminServer\upload\aglc.iam.captcha\1@1\app\captcha.war', cannot be deployed to configured application, 'aglc.iam.captcha [LibSpecVersion=1,LibImplVersion=1]'. The application source is at 'C:\app\oracle\Middleware_IAM\Oracle_IAM1\server\apps\aglc.iam.captcha.war'. Changing the source location is not allowed for a previously attempted deployment. Try deploying without specifying the source.
[09:39:50 AM] Deployment cancelled.
[09:39:50 AM] ----  Deployment incomplete  ----.
[09:39:50 AM] Remote deployment failed (oracle.jdevimpl.deploy.common.Jsr88RemoteDeployer)
[09:43:30 AM] ----  Deployment started.  ----
[09:43:30 AM] Target platform is  (Weblogic 10.3).
[09:43:30 AM] Retrieving existing application information
[09:43:30 AM] Running dependency analysis...
[09:43:30 AM] Building...
[09:43:42 AM] Deploying profile...
[09:43:42 AM] Wrote Web Application Module to C:\work\Oracle_IAM\iam\JDeveloper_Projects\Login\deploy\login.war
[09:43:42 AM] Deploying Application...
[09:43:43 AM] Weblogic Server Exception: weblogic.management.ManagementException: [Deployer:149007]New source location, 'C:\app\oracle\Middleware_IAM\user_projects\domains\IAMDomain\servers\AdminServer\app\login.war', cannot be deployed to configured application, 'login'. The application source is at 'C:\app\oracle\Middleware_IAM\user_projects\domains\IAMDomain\servers\AdminServer\upload\login.war'. Changing the source location is not allowed for a previously attempted deployment. Try deploying without specifying the source.
[09:43:43 AM]   See server logs or server console for more details.
[09:43:43 AM] weblogic.management.ManagementException: [Deployer:149007]New source location, 'C:\app\oracle\Middleware_IAM\user_projects\domains\IAMDomain\servers\AdminServer\app\login.war', cannot be deployed to configured application, 'login'. The application source is at 'C:\app\oracle\Middleware_IAM\user_projects\domains\IAMDomain\servers\AdminServer\upload\login.war'. Changing the source location is not allowed for a previously attempted deployment. Try deploying without specifying the source.
[09:43:43 AM] Deployment cancelled.
[09:43:43 AM] ----  Deployment incomplete  ----.
[09:43:43 AM] Remote deployment failed (oracle.jdevimpl.deploy.common.Jsr88RemoteDeployer)

About these ads

Install WLS as Windows Service got ‘input line too long’ error

Following doc: https://support.oracle.com/epmos/faces/ui/km/SearchDocDisplay.jspx?_afrLoop=85729941264881&_afrWindowMode=0&_adf.ctrl-state=u0k53lbwd_130#aref_section23

Setup Node manager as NT Service is easy, just run that cmd under WL_HOME\server\bin\installNodeMgrSvc.cmd.

Service created successfully, no errors, start/stop smoothly.

The problem popped up when doing Admin server and Managed server.

Error: the input line is too long.

This is typical JAVA CLASSPATH exceed DOS/WIN environment size limit issue.

The number of characters that can be entered into a single command is limited to 8191. (this is including spaces).

In detail, The error occurs when setting EXTRA_JAVA_PROPERTIES in call %USERDOMAIN_HOME%\bin\setDomainEnv.cmd

Try to ignore those lines:
set EXTRA_JAVA_PROPERTIES=-Doracle.apm.home=%APM_ORACLE_HOME% -DAPM_HELP_FILENAME=oesohwconfig.xml %EXTRA_JAVA_PROPERTIES%
set EXTRA_JAVA_PROPERTIES= -DXL.HomeDir=%OIM_ORACLE_HOME%\server -Dscheduler.disabled=false -Djava.security.auth.login.config=%OIM_ORACLE_HOME%\server\config\authwl.conf -Dorg.owasp.esapi.resources=%OIM_ORACLE_HOME%\server\apps\oim.ear\APP-INF\classes -DeditionOverride=ee %EXTRA_JAVA_PROPERTIES%
set EXTRA_JAVA_PROPERTIES= -Doracle.oaam.home=%OAAM_ORACLE_HOME% -Djava.awt.headless=true %EXTRA_JAVA_PROPERTIES%
set EXTRA_JAVA_PROPERTIES= -Doracle.oaam.home=%OAAM_ORACLE_HOME% %EXTRA_JAVA_PROPERTIES%
set EXTRA_JAVA_PROPERTIES= -Doracle.oaam.home=%OAAM_ORACLE_HOME% %EXTRA_JAVA_PROPERTIES%
set EXTRA_JAVA_PROPERTIES= -Doam.oes.new=true -DOAM_POLICY_FILE=%DOMAIN_HOME%\config\fmwconfig\oam-policy.xml -DOAM_CONFIG_FILE=%DOMAIN_HOME%\config\fmwconfig\oam-config.xml -DOAM_ORACLE_HOME=%OAM_ORACLE_HOME% -Doracle.security.am.SERVER_INSTNCE_NAME=%SERVER_NAME% -Does.jars.home=%OAM_ORACLE_HOME%\server\lib\oes-d8 -Does.integration.path=%OAM_ORACLE_HOME%\server\lib\oeslib\oes-integration.jar -Does.enabled=true -Djavax.xml.soap.SOAPConnectionFactory=weblogic.wsee.saaj.SOAPConnectionFactoryImpl -Djavax.xml.soap.MessageFactory=oracle.j2ee.ws.saaj.soap.MessageFactoryImpl -Djavax.xml.soap.SOAPFactory=oracle.j2ee.ws.saaj.soap.SOAPFactoryImpl %EXTRA_JAVA_PROPERTIES%
set EXTRA_JAVA_PROPERTIES=%EXTRA_JAVA_PROPERTIES% -Dem.oracle.home=C:\app\oracle\Middleware_IAM\oracle_common -Djava.awt.headless=true
set EXTRA_JAVA_PROPERTIES=%EXTRA_JAVA_PROPERTIES% -Dbpm.enabled=true
set EXTRA_JAVA_PROPERTIES=%EXTRA_JAVA_PROPERTIES% -Dsoa.archives.dir=%SOA_ORACLE_HOME%\soa -Dsoa.oracle.home=%SOA_ORACLE_HOME% -Dsoa.instance.home=%DOMAIN_HOME% -Dtangosol.coherence.clusteraddress=227.7.7.9 -Dtangosol.coherence.clusterport=9778 -Dtangosol.coherence.log=jdk -Djavax.xml.soap.MessageFactory=oracle.j2ee.ws.saaj.soap.MessageFactoryImpl -Dweblogic.transaction.blocking.commit=true -Dweblogic.transaction.blocking.rollback=true -Djavax.net.ssl.trustStore=%WL_HOME%\server\lib\DemoTrust.jks
set EXTRA_JAVA_PROPERTIES=%EXTRA_JAVA_PROPERTIES% -Dums.oracle.home=%UMS_ORACLE_HOME%
set EXTRA_JAVA_PROPERTIES=-Dcommon.components.home=%COMMON_COMPONENTS_HOME% -Djrf.version=11.1.1 -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger -Ddomain.home=%DOMAIN_HOME% -Djrockit.optfile=%COMMON_COMPONENTS_HOME%\modules\oracle.jrf_11.1.1\jrocket_optfile.txt -Doracle.server.config.dir=%ORACLE_DOMAIN_CONFIG_DIR%\servers\%SERVER_NAME% -Doracle.domain.config.dir=%ORACLE_DOMAIN_CONFIG_DIR% -Digf.arisidbeans.carmlloc=%ORACLE_DOMAIN_CONFIG_DIR%\carml -Digf.arisidstack.home=%ORACLE_DOMAIN_CONFIG_DIR%\arisidprovider -Doracle.security.jps.config=%DOMAIN_HOME%\config\fmwconfig\jps-config.xml -Doracle.deployed.app.dir=%DOMAIN_HOME%\servers\%SERVER_NAME%\tmp\_WL_user -Doracle.deployed.app.ext=\- -Dweblogic.alternateTypesDirectory=%ALT_TYPES_DIR% -Djava.protocol.handler.pkgs=%PROTOCOL_HANDLERS% %WLS_JDBC_REMOTE_ENABLED% %EXTRA_JAVA_PROPERTIES%
set JAVA_PROPERTIES=%JAVA_PROPERTIES% %EXTRA_JAVA_PROPERTIES%

When service created and start, got an error ‘ Unable to initialize the Java virtual machine!’

This EXTRA_JAVA_PROPERTIES seems is critical for JAVA process. Giving up.

I think for now I have to keep IAM desktop never always in login status.

A helpful trick, beasvc -remove command doesn’t work. Had to run sc delete instead.

magic fields in wordpress

Custom fields in wordpress is a surprise, with custom post type wordpress suddenly become the first choice for out-of-box CMS system.

There are many plugin around, the most of them require some medium level PHP skill to change template or theme.

Some cool plugins like Custom Post type UI, just custom post type and advanced custom type. But those plugin still have one problem to solve, how to make the input UI easier to use. One common problem is in the input screen, custom field displayed twice, and still give user flexibility to add other custom fields.

Custom field template suppose fix it, but it seems still need PHP code change somewhere.

Magic fields 2 solved this problem eventual, by introducing some style middle tables at backend, the admin UI looks much cleaner. And data storage is still in post_metadata.

 

 

 

How to calculate ‘Tomorrow at 4 pm’ in iOS

NSCalendar *calendar = [NSCalendar gregorianCalendar];
NSDateComponents *oneDayComponents = [[NSDateComponents alloc] init];
oneDayComponents.day = 1;
NSDate *tomorrow = [calendar dateByAddingComponents:oneDayComponents toDate:[NSDate date] options:nil];
NSUInteger unitFlags = NSEraCalendarUnit | NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit;
NSDateComponents *tomorrowAt4PM = [calendar components:unitFlags fromDate:tomorrow];
tomorrowAt4PM.hour = 16;
tomorrowAt4PM.minute = 0;
tomorrowAt4PM.second = 0;
NSDate *alarmDate = [calendar dateFromComponents:tomorrowAt4PM];

http://adcdownload.apple.com//wwdc_2012/wwdc_2012_session_pdfs/session_304__events_and_reminders_in_event_kit.pdf

Facebook sharing feature in iOS app

Classic/Obsolete(?) way

Install SDK

Drag framework folder into XCode project.

Drag bundle into XCode project.

Drag deprecated header folder into XCode project. check copy in needed.

When picking dependency libraries, set them to optional, to allow app running on iOS5.

Set other link flag to -lsqlite3.0

Those steps are fully documented on facebook developer site: https://developers.facebook.com/docs/getting-started/facebook-sdk-for-ios/3.1/

Note: we are using old fashion Facebook sharing feature in app.  (FBDelegate vs. FBRequest) Because my client doesn’t like posting story on their wall without a preview. This way app will popup a separated window to display link to share, image, title, description, etc. User needs to type something in the textbox with placeholder ‘say something about this…’

Note: again, preset message feature has been disabled by Facebook as of 2012.

In app, we are adding #include “Facebook.h” to implement this.

Note: you can use sharekit library for this, but I want to figure out what’s happening behind the scene.

In the place you want to popup Facebook share options to user, do this to open a Facebook session.

// openSessionWithAllowLoginUI will be called by the actual sharing screen where users can click button to post message on their wall.
- (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI
{
    NSArray *permission = [[NSArray alloc] initWithObjects:@"user_likes",@"publish_actions", nil];

    return [FBSession openActiveSessionWithPublishPermissions:permission
                                              defaultAudience:FBSessionDefaultAudienceFriends
 allowLoginUI:allowLoginUI
                                            completionHandler:^(FBSession *session, FBSessionState status, NSError *error) {
                                                [self sessionStateChanged:session state:status error:error];
                                            }];}

NSString *const FBSessionStateChangedNotification = @"com.bitrixsoft.Login:FBSessionStateChangedNotifiction";

- (void)sessionStateChanged:(FBSession *)session
                    state:(FBSessionState) state
                    error:(NSError *)error
{
    switch (state) {
        case FBSessionStateOpen:
            if (!error) {
                NSLog(@"User session found");
            }
            break;
        case FBSessionStateClosed:
        case FBSessionStateClosedLoginFailed:
            [FBSession.activeSession closeAndClearTokenInformation];
        default:
            break;
    }

    [[NSNotificationCenter defaultCenter]
     postNotificationName:FBSessionStateChangedNotification
     object:session];

    if (error) {
        [[[UIAlertView alloc]
         initWithTitle:@"Error"
         message:error.localizedDescription
         delegate:nil
         cancelButtonTitle:@"OK"
          otherButtonTitles:nil] show];
    }
}

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
    return [FBSession.activeSession handleOpenURL:url];
}

I put this in appDelegate, so it can be shared. I don’t want to call this in appDelegate, otherwise the redirect to facebook to ask permission/login will annoy users.

Add those in appDelegate.h file

extern NSString *const FBSessionStateChangedNotification;

- (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI;

Before calling opensession, sharing window should subscribe statechange notification.

[[NSNotificationCenter defaultCenter]
     addObserver:self
     selector:@selector(sessionStateChanged:)
     name:FBSessionStateChangedNotification
     object:nil];

- (void)sessionStateChanged:(NSNotification *)notification
{
    if ((FBSession.activeSession.isOpen)) {

        if (nil == self.facebook) {
            self.facebook = [[Facebook alloc]
                             initWithAppId:FBSession.activeSession.appID
                             andDelegate:nil];

            self.facebook.accessToken = FBSession.activeSession.accessToken;
            self.facebook.expirationDate = FBSession.activeSession.expirationDate;

            // resume sharing routine here, because first time attempt without login will stop after app back from background, 
            // but this method will get statechange notifcation, so perfect to resume/restart here.
            [self shareViaFacebook];
        }
    }else{

        self.facebook = nil;
    }

Finally, the actual post action:

- (IBAction)shareOptions:(id)sender
{

    BNAppDelegate * appDelegate = (BNAppDelegate*)[[UIApplication sharedApplication] delegate];
    [appDelegate openSessionWithAllowLoginUI:YES];

    UIActionSheet * options = [[UIActionSheet alloc]
                               initWithTitle:@"Share"
                               delegate:self
                               cancelButtonTitle:@"Cancel"
                               destructiveButtonTitle:nil
                               otherButtonTitles:@"Twitter", @"Facebook", @"email", nil];

    [options showInView:self.view];
}
- (void)shareViaFacebook
{
    NSString * message = @"test msg from my test ios app";

    // no nil allow in any parameter
    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                   @"Bitrix News iPhone app", @"name",
                                   _post.title, @"caption",
                                   _post.exerpt, @"description",
                                   @"http://www.frankmao.com", @"link",
                                   @"http://ww1.prweb.com/prfiles/2011/02/01/8151699/gI_60506_bxlogo.jpg", @"picture",
                                   message, @"message", //already obsolete, don't bother, facebook will ignore it anyway
                                   nil];

    [self.facebook dialog:@"feed" andParams:params andDelegate:self];

}

Someother gotcha, app identifier must match between app and setting in developers.facebook.com/app, otherwise facebook will complain app is misconfigured when starting the session.

REF: https://developers.facebook.com/docs/reference/dialogs/feed/

https://developers.facebook.com/docs/howtos/feed-dialog-using-ios-sdk/

Sharing internet connection with VMWare guest

  1. Network adapter must set to host only (NAT/Bridge won’t work).
  2. On host, control panel->network and sharing center ->change adapter settings, pick the regular ‘Local Area Connection’, rename the other ‘Local Area Connection 2′ used by VMWare hosting to ‘VMWare Host Network’ for clarification. Right click on Local Area Connection, select sharing tab, allow sharing internet connection with ‘VMWare Host Network’. Note: ip address on VMWare Host Network will change to something like 192.168.137.1
  3. Stop VMware DHCP Service at service panel, set this service to manual startup type.
  4. Reboot guest. After reboot, guest should get a new ip in 192.168.137 subnet.
  5. Set http proxy in guest in necessary. Note: in RubyMine, svn has it’s own http settings tab.