<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>dominikdorn.com &#187; PHP</title>
	<atom:link href="http://dominikdorn.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://dominikdorn.com</link>
	<description>shit happens ;)</description>
	<lastBuildDate>Mon, 06 Sep 2010 16:37:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1-alpha</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Access Quercus PHP-Session from Java Servlets/Filters/Beans &#8211; Part 1</title>
		<link>http://dominikdorn.com/2010/06/access-quercus-php-session-from-java-servlets-filters-beans/</link>
		<comments>http://dominikdorn.com/2010/06/access-quercus-php-session-from-java-servlets-filters-beans/#comments</comments>
		<pubDate>Thu, 10 Jun 2010 16:06:15 +0000</pubDate>
		<dc:creator>Dominik Dorn</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Quercus]]></category>
		<category><![CDATA[Filter]]></category>
		<category><![CDATA[servlet]]></category>
		<category><![CDATA[Session]]></category>

		<guid isPermaLink="false">http://dominikdorn.com/?p=302</guid>
		<description><![CDATA[This article shows how to access a PHP-Session from Java when running under Quercus - an implementation of PHP in Java which runs in any decent Servlet-Container. ]]></description>
			<content:encoded><![CDATA[<p>If you are integrating a PHP Application in your Java Environment, you&#8217;ll probably came across <a href="http://quercus.caucho.com">Quercus</a>, a <a href="http://quercus.caucho.com">Java Implementation of PHP</a> provided by <a href="http://www.caucho.com">Caucho Technologies</a>. </p>
<p>As you are moving more and more into the Servlet world, you&#8217;ll probably will be using Servlet-Filters and normal Servlets todo some tasks. </p>
<p>If you then want to access Variables in a PHP Session, here&#8217;s how to do it:</p>
<p>The Quercus PHP-Session is not stored the same way as the normal Servlet HTTP-Session is stored. Quercus uses an own Session Manager that is capable of doing all this stuff that you know from PHP, like e.g. migrating Session-IDs (to prevent session-hijacking etc.). </p>
<p>To access this Session Manager, you first have to get a hand on the <strong>QuercusContext</strong>. In the current release (4.0.7) there is no easy way to get a hand on it if you are not inside a <strong>PHPModule</strong> or a PHP-Page. Thus I simply copied <strong>com.caucho.quercus.servlet.QuercusServlet</strong> to <strong>com.caucho.quercus.servlet.DCQuercusServlet</strong> and added this line to the end of the method:</p>
<pre lang='java' line='1'>
  private void initImpl(ServletConfig config)
    throws ServletException
  {
....
      config.getServletContext().setAttribute("quercusContext", quercus);
 }
</pre>
<p>which <strong>exposes the QuercusContext as an Attribute in the ServletContext</strong>.</p>
<p>(Note: If you are running multiple <strong>QuercusServlet</strong>s in your WebApp &#8211; which you probably shouldn&#8217;t &#8211; this might will be a problem)<br />
(Note2: The package name com.caucho.quercus.servlet must be used, or else you will not have access to some package scoped properties used in the QuercusServlet)<br />
Ok, so now we have access to the <strong>QuercusContext</strong> from every <strong>Servlet</strong>, <strong>Filter</strong> or <strong>JSF-Bean</strong>, horray <img src='http://dominikdorn.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
<p>But how to use it? </p>
<p>Lets take a look at the following filter and its methods helping me to work with the PHP-Session:</p>
<pre lang='java' line='1'>
public class LoginOutFilter implements Filter {

    QuercusContext context; // we store the reference to the quercusContext in the filter
    FilterConfig config; // the reference to the config 

...
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        config = filterConfig;
    }

    // looks up the QuercusContext the first time it is accessed
    // Beware: will return null if no PHP page has been rendered yet and the quercusContext is not already set.
    private QuercusContext getQuercusContext()
    {
        if(context == null)
        {
            context = (QuercusContext) config.getServletContext().getAttribute("quercusContext");
        }
        return context;

    }

    // find the PHP-Session Cookie in the array of Cookies provided by the browser
    public Cookie findPHPSessionCookie(Cookie[] cookies)
    {
        for(Cookie c : cookies)
        {
            if(c.getName().equals("PHPSESSID")){
                return c;
            }
        }
        return null;
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
     if(someCondition)
     {
                // clear a PHP-Session, e.g. when logging out a user
                Cookie c = findPHPSessionCookie(((HttpServletRequest) servletRequest).getCookies());
                if(c != null){
                    QuercusSessionManager mng = getQuercusContext().getQuercusSessionManager();
                    String phpSessionId = c.getValue();
                    mng.removeSession(phpSessionId);
                }
     }

     if(someOtherCondition) {
                        QuercusSessionManager mng = getQuercusContext().getQuercusSessionManager();

                        SessionArrayValue val;
                        Cookie c = findPHPSessionCookie(((HttpServletRequest) servletRequest).getCookies());
                        String phpSessionId;
                        if(c != null)
                        {
        // we found a session cookie
                            phpSessionId = c.getValue();
                            val = mng.getSession(null, phpSessionId, new Date().getTime()  );
                            if(val == null)
                            {
        // but the session does not exist on the server, so create it
                                val = mng.createSession(null, phpSessionId, new Date().getTime());
                            }

                        }else
                        {
          // we haven't found a php-session cookie, so create a new session
                            val = mng.createSession(null,null,new Date().getTime());
                            phpSessionId = val.getId();
          // and store the appropriate cookie
                            Cookie newCookie = new Cookie("PHPSESSID", phpSessionId);
                            ((HttpServletResponse)servletResponse).addCookie(newCookie);
                        }
     // storing data in the session
                      String username = "myUsername";
                        val.put("ludata_suserid", username);
                        val.put("ludata_nusernr", someService.getUserId(username));
                        val.put("ludata_nstatusnr", someService.getUserStatus(username));
                        val.addUse(); // This is required for saving, else an IllegalStateException will be thrown
                        mng.saveSession(null, val);
       }
     }
</pre>
<p>The above code shows how to <strong>erase a session</strong> and how to <strong>add values to a session</strong>. To <strong>get values from a session</strong>, simply use val.get(..). </p>
<p><strong>Attention: This currently only works if the page after the filter is not a Quercus Page itself (e.g. a Servlet or a JSF Page). I&#8217;m working on a solution for this</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://dominikdorn.com/2010/06/access-quercus-php-session-from-java-servlets-filters-beans/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quercus, Glassfish v3 &amp; java_bean()</title>
		<link>http://dominikdorn.com/2010/02/quercus-glassfish-v3-java_bean/</link>
		<comments>http://dominikdorn.com/2010/02/quercus-glassfish-v3-java_bean/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 22:50:59 +0000</pubDate>
		<dc:creator>Dominik Dorn</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[JavaEE6]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[JavaEE]]></category>
		<category><![CDATA[Quercus]]></category>

		<guid isPermaLink="false">http://dominikdorn.com/?p=175</guid>
		<description><![CDATA[Use java_bean() of Quercus with Glassfish v3 &#038; JavaEE6]]></description>
			<content:encoded><![CDATA[<p>Current Quercus java_bean() method does not work in Glassfish v3, because Caucho are cooking their own soup with everything new of JavaEE6 (I don&#8217;t understand why they need to reinvent all of JavaEE6 like JSF, CDI, etc. for their own app-server&#8230; why don&#8217;t use something existing and build on top of it? Why don&#8217;t push your own projects further, like Quercus, Hessian, Burlap and co.? )</p>
<p>If you, like me, want to use managed beans from inside your php code, and find out, that jndi_lookup and java_bean() do not work (= return null every time), try this little method</p>
<pre lang="PHP" line="1">
function my_java_bean($name)
{
    $beanManager = quercus_get_servlet_context()->getAttribute("javax.enterprise.inject.spi.BeanManager");
    $beans = $beanManager->getBeans($name);
    if($beans == null || count($beans) < 1)
        return null;
    $object = $beanManager->getReference($beans[0], $beans[0]->getClass(),
            $beanManager->createCreationalContext($beans[0]));
    return $object;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://dominikdorn.com/2010/02/quercus-glassfish-v3-java_bean/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quercus + PostgreSQL + JNDI + PEAR::DB</title>
		<link>http://dominikdorn.com/2009/12/quercus-postgresql-jndi-peardb/</link>
		<comments>http://dominikdorn.com/2009/12/quercus-postgresql-jndi-peardb/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 02:16:05 +0000</pubDate>
		<dc:creator>Dominik Dorn</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[JDBC]]></category>
		<category><![CDATA[JNDI]]></category>
		<category><![CDATA[PEAR]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Quercus]]></category>

		<guid isPermaLink="false">http://dominikdorn.com/?p=146</guid>
		<description><![CDATA[If you trying to migrate a legacy PHP application which still uses PEAR::DB to Quercus with PostgreSQL and JDBC-Connection Pools accessible through JNDI, this may come handy for you! 1. Create your Datasource e.g. in Glassfish v3&#8242;s admin console&#8230; I named mine jdbc/postgresDS 2. copy the file pgsqljndi.php to /usr/share/php/DB/pgsqljndi.php (or wherever you include your [...]]]></description>
			<content:encoded><![CDATA[<p>If you trying to migrate a legacy PHP application which still uses PEAR::DB to Quercus with PostgreSQL and JDBC-Connection Pools accessible through JNDI, this may come handy for you!</p>
<p>1. Create your Datasource e.g. in Glassfish v3&#8242;s admin console&#8230; I named mine jdbc/postgresDS</p>
<p>2. copy the file <a href="http://gist.github.com/253923">pgsqljndi.php</a> to /usr/share/php/DB/pgsqljndi.php (or wherever you include your PEAR stuff from..)</p>
<p>3. change the database connection creation part of your script to this:</p>
<pre lang="php" line="1">
$db = &#038; DB::connect("pgsqljndi://java:comp/env/jdbc/postgresDS");
if(DB::isError($db))
{
// error handling
}
</pre>
<p>4. remove stuff like this from your scripts</p>
<pre lang="php" line="1">
$db->query("SET NAMES 'utf-8'; ");
</pre>
<p>Your database connection with PEAR::DB, Quercus, PostgreSQL, JDBC + JNDI should work now!</p>
]]></content:encoded>
			<wfw:commentRss>http://dominikdorn.com/2009/12/quercus-postgresql-jndi-peardb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Glassfish v3 final &amp; available</title>
		<link>http://dominikdorn.com/2009/12/glassfish-v3-final-available/</link>
		<comments>http://dominikdorn.com/2009/12/glassfish-v3-final-available/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 18:30:18 +0000</pubDate>
		<dc:creator>Dominik Dorn</dc:creator>
				<category><![CDATA[JSF]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Glassfish]]></category>
		<category><![CDATA[JavaEE]]></category>
		<category><![CDATA[JEE6]]></category>

		<guid isPermaLink="false">http://dominikdorn.com/?p=144</guid>
		<description><![CDATA[Paul Sterk just announced the availability of the final version of Glassfish v3! I just tried it out and it really rocks! Download, extract, start domain, running! Even PHP Applications are easily possible: I will look further into this this weekend!]]></description>
			<content:encoded><![CDATA[<p><a href="http://blogs.sun.com/psterk/">Paul Sterk</a> just <a href="https://glassfish.dev.java.net/servlets/ReadMsg?list=users&#038;msgNo=40184">announced</a> the availability of the final version of <a href="http://glassfish.org/downloads/v3-final.html">Glassfish v3</a>!</p>
<p>I just tried it out and it really rocks! Download, extract, start domain, running!<br />
Even <a href="http://docs.sun.com/app/docs/doc/820-7697/giraf?a=view">PHP Applications</a> are easily possible: I will look further into this this weekend!</p>
]]></content:encoded>
			<wfw:commentRss>http://dominikdorn.com/2009/12/glassfish-v3-final-available/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting started with Maven for PHP</title>
		<link>http://dominikdorn.com/2009/12/getting-started-with-maven-for-php/</link>
		<comments>http://dominikdorn.com/2009/12/getting-started-with-maven-for-php/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 19:06:54 +0000</pubDate>
		<dc:creator>Dominik Dorn</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Maven]]></category>

		<guid isPermaLink="false">http://dominikdorn.com/?p=137</guid>
		<description><![CDATA[Because I&#8217;m still sometimes doing some PHP-Coding, I wanted to get started with Maven for PHP, however, I ran into various problems with the way it was described on their webpage. Unfortunately, also the mailing list did not respond to my mails, so I had to dig into the source alone. The problem I had [...]]]></description>
			<content:encoded><![CDATA[<p>Because I&#8217;m still sometimes doing some PHP-Coding, I wanted to get started with <a href="http://www.php-maven.org/">Maven for PHP</a>, however, I ran into various problems with the way it was described on their webpage. </p>
<p>Unfortunately, also the mailing list did not respond to my mails, so I had to dig into the source alone. </p>
<p>The problem I had was, that although I added the profile-php-maven to my settings.xml, the archetypes where not recognized, resulting in an error-message like this, when trying to create a new project:</p>
<pre lang="bash" line="1">
mvn archetype:generate -DarchetypeGroupId=org.phpmaven -
DarchetypeArtifactId=php5-lib-archetype -DarchetypeVersion=1.0 -
DgroupId=org.sample -DartifactId=my-app
</pre>
<pre>
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO]
------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO]    task-segment: [archetype:generate] (aggregator-style)
[INFO]
------------------------------------------------------------------------
[INFO] Preparing archetype:generate
[INFO] No goals needed for project - skipping
[INFO] Setting property: classpath.resource.loader.class =>
'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
[INFO] Setting property: velocimacro.messages.on => 'false'.
[INFO] Setting property: resource.loader => 'classpath'.
[INFO] Setting property: resource.manager.logwhenfound => 'false'.
[INFO] [archetype:generate]
[WARNING] No archetype repository found. Falling back to central
repository (http://repo1.maven.org/maven2).
[WARNING] Use -DarchetypeRepository=<your repository> if archetype's
repository is elsewhere.
Downloading: http://repo1.maven.org/maven2/org/phpmaven/php5-lib-archetype/1.0/php...
org.apache.maven.archetype.downloader.DownloadNotFoundException:
Requested download does not exist.
        at org.apache.maven.archetype.downloader.DefaultDownloader.download
(DefaultDownloader.java:62)
        at
org.apache.maven.archetype.common.DefaultArchetypeArtifactManager.exists
(DefaultArchetypeArtifactManager.java:310)
        at
org.apache.maven.archetype.ui.DefaultArchetypeGenerationConfigurator.configureArchetype
(DefaultArchetypeGenerationConfigurator.java:103)
        at
org.apache.maven.archetype.mojos.CreateProjectFromArchetypeMojo.execute
(CreateProjectFromArchetypeMojo.java:168)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo
(DefaultPluginManager.java:453)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals
(DefaultLifecycleExecutor.java:559)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal
(DefaultLifecycleExecutor.java:513)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal
(DefaultLifecycleExecutor.java:483)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures
(DefaultLifecycleExecutor.java:331)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments
(DefaultLifecycleExecutor.java:228)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute
(DefaultLifecycleExecutor.java:142)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:301)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:
315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:
430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by:
org.apache.maven.artifact.resolver.ArtifactNotFoundException: Unable
to locate resource in repository

Try downloading the file manually from the project website.

Then, install it using the command:
    mvn install:install-file -DgroupId=org.phpmaven -DartifactId=php5-
lib-archetype -Dversion=1.0 -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file
there:
    mvn deploy:deploy-file -DgroupId=org.phpmaven -DartifactId=php5-
lib-archetype -Dversion=1.0 -Dpackaging=jar -Dfile=/path/to/file -Durl=
[url] -DrepositoryId=[id]

  org.phpmaven:php5-lib-archetype:jar:1.0

from the specified remote repositories:
  php5-lib-archetype-repo (http://repo1.maven.org/maven2)

        at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve
(DefaultArtifactResolver.java:212)
        at
org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveAlways
(DefaultArtifactResolver.java:80)
        at org.apache.maven.archetype.downloader.DefaultDownloader.download
(DefaultDownloader.java:54)
        ... 21 more
Caused by: org.apache.maven.wagon.ResourceDoesNotExistException:
Unable to locate resource in repository
        at
org.apache.maven.wagon.providers.http.LightweightHttpWagon.fillInputData
(LightweightHttpWagon.java:100)
        at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:68)
        at org.apache.maven.artifact.manager.DefaultWagonManager.getRemoteFile
(DefaultWagonManager.java:475)
        at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact
(DefaultWagonManager.java:355)
        at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve
(DefaultArtifactResolver.java:196)
        ... 23 more
Caused by: java.io.FileNotFoundException:

http://repo1.maven.org/maven2/org/phpmaven/php5-lib-archetype/1.0/php...

        at sun.net.www.protocol.http.HttpURLConnection.getInputStream
(HttpURLConnection.java:1311)
        at
org.apache.maven.wagon.providers.http.LightweightHttpWagon.fillInputData
(LightweightHttpWagon.java:83)
        ... 27 more
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] The desired archetype does not exist (org.phpmaven:php5-lib-
archetype:1.0)

[INFO]
------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 5 seconds
[INFO] Finished at: Mon Dec 07 02:15:42 CET 2009
[INFO] Final Memory: 16M/288M
[INFO]
------------------------------------------------------------------------
</pre>
<p>So.. maven does not recognize my profile, even not after upgrading to maven 2.2&#8230;. So I did checkout the source, and compiled the stuff myself:</p>
<pre lang="bash" line="1">
svn checkout http://svn.key-tec.de/php-maven/trunk/ 

cd trunk/org.phpmaven.multimaster/
</pre>
<p>however, trying to build the project was not successfull because of miss-spelled directories and outdated dependencies</p>
<pre lang="bash" line="1">
 mvn clean compile install
</pre>
<pre>
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).

Project ID: unknown

Reason: Could not find the model file '/home/domdorn/work/php-maven/bla/bla2/trunk/org.phpmaven.multimaster/org.phpmaven.plugin'. for project unknown

[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.reactor.MavenExecutionException: Could not find the model file '/home/domdorn/work/php-maven/bla/bla2/trunk/org.phpmaven.multimaster/org.phpmaven.plugin'. for project unknown
	at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:404)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:272)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
	at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
	at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
	at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
	at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.project.ProjectBuildingException: Could not find the model file '/home/domdorn/work/php-maven/bla/bla2/trunk/org.phpmaven.multimaster/org.phpmaven.plugin'. for project unknown
	at org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.java:1575)
	at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFileInternal(DefaultMavenProjectBuilder.java:506)
	at org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java:200)
	at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:604)
	at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:487)
	at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:560)
	at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:391)
	... 12 more
Caused by: java.io.FileNotFoundException: /home/domdorn/work/php-maven/bla/bla2/trunk/org.phpmaven.multimaster/org.phpmaven.plugin (No such file or directory)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:106)
	at hidden.org.codehaus.plexus.util.xml.XmlReader.<init>(XmlReader.java:124)
	at hidden.org.codehaus.plexus.util.xml.XmlStreamReader.<init>(XmlStreamReader.java:67)
	at hidden.org.codehaus.plexus.util.ReaderFactory.newXmlReader(ReaderFactory.java:118)
	at org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.java:1570)
	... 18 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Wed Dec 09 19:22:46 CET 2009
[INFO] Final Memory: 3M/73M
[INFO] ------------------------------------------------------------------------
</pre>
<p>I fixed those with two small + simple commands:</p>
<pre lang="bash" line="1">
svn mv maven-php-plugin org.phpmaven.plugin # rename directory
# replace outdated wagon-ftp dependency
for i in `find . -iname 'pom.xml' | grep -v svn`; do sed 's/1.0-20080208/1.0-beta-6/g' $i > ${i}_xx ; mv ${i}_xx $i; done
</pre>
<p>after this, a simple</p>
<pre lang="bash" line="1">
mvn install
</pre>
<p>did the trick for me. </p>
<p>I'm now creating new php-maven projects like this:</p>
<pre lang="bash" line="1">
mvn archetype:generate -DarchetypeGroupId=org.phpmaven -DarchetypeArtifactId=php5-lib-archetype -DarchetypeVersion=1.1-SNAPSHOT -DgroupId=com.dominikdorn -DartifactId=my-example-app
</pre>
<pre>
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO]    task-segment: [archetype:generate] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] Preparing archetype:generate
[INFO] No goals needed for project - skipping
[INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
[INFO] Setting property: velocimacro.messages.on => 'false'.
[INFO] Setting property: resource.loader => 'classpath'.
[INFO] Setting property: resource.manager.logwhenfound => 'false'.
[INFO] [archetype:generate {execution: default-cli}]
[WARNING] No archetype repository found. Falling back to central repository (http://repo1.maven.org/maven2).
[WARNING] Use -DarchetypeRepository=<your repository> if archetype's repository is elsewhere.
[INFO] snapshot org.phpmaven:php5-lib-archetype:1.1-SNAPSHOT: checking for updates from php5-lib-archetype-repo
Downloading: http://repo1.maven.org/maven2/org/phpmaven/php5-lib-archetype/1.1-SNAPSHOT/php5-lib-archetype-1.1-SNAPSHOT.jar
[INFO] Unable to find resource 'org.phpmaven:php5-lib-archetype:jar:1.1-SNAPSHOT' in repository php5-lib-archetype-repo (http://repo1.maven.org/maven2)
Downloading: http://repo1.maven.org/maven2/org/phpmaven/php5-lib-archetype/1.1-SNAPSHOT/php5-lib-archetype-1.1-SNAPSHOT.jar
[INFO] Unable to find resource 'org.phpmaven:php5-lib-archetype:jar:1.1-SNAPSHOT' in repository php5-lib-archetype-repo (http://repo1.maven.org/maven2)
Downloading: http://repo1.maven.org/maven2/org/phpmaven/php5-lib-archetype/1.1-SNAPSHOT/php5-lib-archetype-1.1-SNAPSHOT.jar
[INFO] Unable to find resource 'org.phpmaven:php5-lib-archetype:jar:1.1-SNAPSHOT' in repository php5-lib-archetype-repo (http://repo1.maven.org/maven2)
Define value for version: : 1.0-SNAPSHOT
Define value for package: : com.dominikdorn.php-maven-example-app
Confirm properties configuration:
groupId: com.dominikdorn
artifactId: my-example-app
version: 1.0-SNAPSHOT
package: com.dominikdorn.php-maven-example-app
 Y: : Y
Downloading: http://repo1.maven.org/maven2/org/phpmaven/php5-lib-archetype/1.1-SNAPSHOT/php5-lib-archetype-1.1-SNAPSHOT.jar
[INFO] Unable to find resource 'org.phpmaven:php5-lib-archetype:jar:1.1-SNAPSHOT' in repository php5-lib-archetype-repo (http://repo1.maven.org/maven2)
Downloading: http://repo1.maven.org/maven2/org/phpmaven/php5-lib-archetype/1.1-SNAPSHOT/php5-lib-archetype-1.1-SNAPSHOT.jar
[INFO] Unable to find resource 'org.phpmaven:php5-lib-archetype:jar:1.1-SNAPSHOT' in repository php5-lib-archetype-repo (http://repo1.maven.org/maven2)
Downloading: http://repo1.maven.org/maven2/org/phpmaven/php5-lib-archetype/1.1-SNAPSHOT/php5-lib-archetype-1.1-SNAPSHOT.jar
[INFO] Unable to find resource 'org.phpmaven:php5-lib-archetype:jar:1.1-SNAPSHOT' in repository php5-lib-archetype-repo (http://repo1.maven.org/maven2)
[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference : template = archetype-resources/src/test/php/apptest.php [line 6,column 9] : $app is not a valid reference.
[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference : template = archetype-resources/src/test/php/apptest.php [line 7,column 9] : $this- is not a valid reference.
[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference : template = archetype-resources/src/test/php/apptest.php [line 7,column 42] : $app- is not a valid reference.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 29 seconds
[INFO] Finished at: Wed Dec 09 19:54:29 CET 2009
[INFO] Final Memory: 15M/166M
[INFO] ------------------------------------------------------------------------
</pre>
<p>It still does not find the dependencies, but at least it creates my project. </p>
<p>after fixing a issue with the auto-generated php-unit test, I can package my lib with this</p>
<pre lang="bash" line="1">
mvn clean compile package
</pre>
<pre>
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Sample PHP 5 library project
[INFO]    task-segment: [clean, compile, package]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean {execution: default-clean}]
[INFO] Deleting directory /tmp/test/test3/my-example-app/target
[INFO] [plugin:descriptor {execution: default-descriptor}]
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /tmp/test/test3/my-example-app/src/main/resources
[INFO] [php:php-validate {execution: default-php-validate}]
[INFO] [plugin:descriptor {execution: default-descriptor}]
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /tmp/test/test3/my-example-app/src/main/resources
[INFO] [php:php-validate {execution: default-php-validate}]
[INFO] [resources:testResources {execution: default-testResources}]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /tmp/test/test3/my-example-app/src/test/resources
[INFO] [php:phpunit {execution: default-phpunit}]
[INFO] Surefire report directory: /tmp/test/test3/my-example-app/target/surefire-reports

-------------------------------------------------------
T E S T S
-------------------------------------------------------
apptest.php
Running AppTest
Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.001249

Results :

Tests run: 1, Failures: 0, Errors: 0

[INFO] [jar:jar {execution: default-jar}]
[INFO] Building jar: /tmp/test/test3/my-example-app/target/my-example-app-1.0.jar
[INFO] [plugin:addPluginArtifactMetadata {execution: default-addPluginArtifactMetadata}]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4 seconds
[INFO] Finished at: Wed Dec 09 20:04:51 CET 2009
[INFO] Final Memory: 27M/294M
[INFO] ------------------------------------------------------------------------
</pre>
<p>I'm in contact with Christian Widemann from <a href="http://www.key-tec.de">Key-Tec</a> to resolve the outstanding problems.</p>
]]></content:encoded>
			<wfw:commentRss>http://dominikdorn.com/2009/12/getting-started-with-maven-for-php/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Single Sign On: Cas 3.3.1, phpCAS and Spring Security</title>
		<link>http://dominikdorn.com/2008/11/single-sign-on-cas-3-3-1-phpcas-and-spring-security/</link>
		<comments>http://dominikdorn.com/2008/11/single-sign-on-cas-3-3-1-phpcas-and-spring-security/#comments</comments>
		<pubDate>Sun, 23 Nov 2008 00:51:41 +0000</pubDate>
		<dc:creator>Dominik Dorn</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[CAS]]></category>
		<category><![CDATA[phpCAS]]></category>
		<category><![CDATA[Spring-Security]]></category>
		<category><![CDATA[SSO]]></category>

		<guid isPermaLink="false">http://www.dominikdorn.com/?p=29</guid>
		<description><![CDATA[Puh&#8230; after now around 18 hours (totally), I&#8217;ve managed to get a basic setup of the single-sign-on software by JA-SIG &#8211; the Yale University running. I&#8217;ll use CAS (central authentication service) to enable a smooth transition from PHP to Java on the lyrics portal I&#8217;m working on. Now, that I&#8217;ve got phpCAS working on a [...]]]></description>
			<content:encoded><![CDATA[<p>Puh&#8230; after now around 18 hours (totally), I&#8217;ve managed to get a basic setup of the <a href="http://www.ja-sig.org/products/cas/" target="_blank">single-sign-on software by JA-SIG &#8211; the Yale University</a> running.</p>
<p>I&#8217;ll use <a href="http://www.ja-sig.org/products/cas/" target="_blank">CAS (central authentication service)</a> to enable a smooth transition from PHP to Java on the <a href="http://www.lyrix.at/">lyrics portal</a> I&#8217;m working on.</p>
<p>Now, that I&#8217;ve got <a href="http://www.ja-sig.org/wiki/display/CASC/phpCAS" target="_blank">phpCAS</a> working on a small sample application (the big trick was to compile PHP with curl support), I&#8217;ll switch the authentication mechanism of the current PHP-Application to phpCAS and will use the Java-pendant for the new Java applications.</p>
<p>Next, I&#8217;ll look into the integration of CAS with Spring-Security and on using <a href="http://www.ja-sig.org/wiki/display/CASC/CAS+and+JSR-168" target="_blank">CAS with Portlets</a>, that will be interesting <img src='http://dominikdorn.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Some links I&#8217;ve found quite useful:</p>
<ol>
<li><a href="http://www.ja-sig.org/products/cas/" target="_blank">CAS main homepage</a></li>
<li><a href="http://www.ja-sig.org/downloads/cas-clients/php/current/docs/api/" target="_blank">phpCAS API Reference</a></li>
<li><a href="http://www.ja-sig.org/wiki/display/CASC/phpCAS" target="_blank">phpCAS Wiki Page</a></li>
<li><a target="_blank">Setup SSL on Tomcat 6</a></li>
<li><a href="http://esup-casgeneric.sourceforge.net/auth-database.html" target="_blank">Using existing user-database</a></li>
<li><a href="http://www.ja-sig.org/wiki/display/CASUM/Using+JDBC+for+Authentication" target="_blank">Using JDBC for Authentication</a></li>
<li><a href="http://developer.ja-sig.org/projects/cas/cas-server-support-jdbc/cas-server/cas-server-support-jdbc/apidocs/org/jasig/cas/adaptors/jdbc/QueryDatabaseAuthenticationHandler.html" target="_blank">JavaDoc Class QueryDatabaseAuthenticationHandler</a></li>
<li><a href="http://static.springframework.org/spring-security/site/" target="_blank">Spring Security Homepage</a></li>
<li><a href="http://www.ja-sig.org/wiki/display/CASC/CAS+and+JSR-168" target="_blank">CAS with Portlets</a></li>
<li><a href="http://www.lyrix.at/lyrics/Farin-Urlaub/" target="_blank">Happy Sound: Lyrics to Farin Urlaub</a></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://dominikdorn.com/2008/11/single-sign-on-cas-3-3-1-phpcas-and-spring-security/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
